You can chat about native SDK questions and issues here.

User avatar
By someother
#71411 Good day!

I would like to play with smartconfig. I'm using ESP Open SDK (updated for the NonOS 2.0 SDK).

Even if I'm adding manually the smartconfig library
Code: Select allLDLIBS = -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -lsmartconfig -llwip -lpp -lphy -Wl,--end-group -lgcc -lcirom


The linker couldn't compile the executable.
Code: Select allxtensa-lx106-elf-gcc -Tlinker.ld -g -O2 -Wl,-EL -mtext-section-literals -mlongcalls -Wl,--gc-sections -Wl,--cref -Wl,-Map=output.map -Wl,-N -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -lsmartconfig -llwip -lpp -lphy -Wl,--end-group -lgcc -lcirom ip_funcs.o nrf24l01.o spi.o uart.o user_main.o -o GCC/Exe/wifiRelay
user_main.o:(.irom0.literal+0x2c): undefined reference to `smartconfig_stop'
user_main.o:(.irom0.literal+0x30): undefined reference to `smartconfig_start'
user_main.o: In function `sendSingleBufferedDataToServer':
user_main.c:(.irom0.text+0x163): undefined reference to `smartconfig_stop'
user_main.c:(.irom0.text+0x16e): undefined reference to `smartconfig_start'
user_main.o: In function `smartconfig_cb':
user_main.c:(.irom0.text+0x294): undefined reference to `smartconfig_stop'
collect2: error: ld returned 1 exit status
make: *** [compile] Error 1


I found two libsmartconfig.a files in the esp-open-sdk tree and their md5 sum is equal.
Do you have some idea of what may be wrong?

PS: I can find the strings "smartconfig_start" and "smartconfig_stop" in the libsmartconfig.a file...
User avatar
By someother
#71443 Problem solved.

After I was looking this thread: https://stackoverflow.com/questions/138 ... y#13927561

Comment of Daniel Fischer:
there is no source/object file mentioned here, so I suspect it's appended to the end. The library to link with, probably needs to go after the source, so move -lfun to the end of the command line.


I moved the library list to the end of the command line and the problem disappeared.

In short, while linking, the libraries should go to the end. My current Makefile looks like this:
Code: Select all$(CC) $(LDFLAGS) $(OBJ) $(LDLIBS) -o $(BUILDDIR)/Exe/$(EXECUTABLE)


The incorrect (previous syntax) I used was:
Code: Select all$(CC) $(LDFLAGS) $(LDLIBS) $(OBJ) -o $(BUILDDIR)/Exe/$(EXECUTABLE)