Thank you for your detailed explanation.
On 09/09/2022 14:34, Alex wrote:
Hi,
I intergrated my application to buildroot. Complie is successfull by
when linking I get errors:
x86_64-buildroot-linux-gnu/sysroot/usr/lib64/libstdc++.so.6: error
adding symbols: DSO missing from command line
This error means that:
- the linker found a library with a DT_NEEDED dependency on
libstdc++.so.6
- the linker found libstdc++.so.6
- the linker is missing symbols
- the linker found the missing symbols in libstdc++.so.6
- but the linker command line does not include libstdc++.so.6
- so the linker is not sure if the user actually intended to link with
libstdc++.so.6.
- so it refuses to link.
Since libstdc++.so.6 is the C++ runtime library, this either mean that:
- you are linking a C++ program with ld or gcc instead of g++
Yap, outside of buildroot, linking calls the g++ but when linking inside
buildroot, calls the x86_64-buildroot-linux-gnu-ld,
because $(LD) in the makefile is set to x86_64-buildroot-linux-gnu-ld
within buildroot.
Inside the package .mk file of the BUILD_CMDS calls make:
$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
So (a kludge to test), i replaced in the Makefile
$(LD)
by
$(HOST_DIR)/bin/x86_64-linux-g++
Now linking is successfull...
Is there a more "elegant" way to do this...? Not so a kludge like that,
mean setting this within the mk file before calling the projekt make...
And how to specifey $(CC) also to g++??
- you are linking a C program with a C++ library that requires
libstdc++.so.6, in this case you may need -lstdc++ on the linker
command line.
Are libraries missing from buildroot environment?
No, only the linker command line is incorrect.
Additional I get warnings that some .so files not found, but they are
available in output/build/<Tool>/lib
The compiler will only search libraries in output/staging/lib or
output/staging/usr/lib.
The package for <Tool> should install the libraries there, so that
other programs can link with them. This is done by putting
<TOOL>_INSTALL_STAGING = YES
in its .mk file. If <Tool> is a generic-package (and not a
autotools/meson/cmake package), then you also need to manually explain
how to install libraries to $(STAGING_DIR)/lib:
Indeed I forgot one of the .so to be installed to staging. After adding
this and append to the $(MAKE) call the LD_LIBRARY_PATH="$(@D)../<Tool>/lib"
compile and linking is successfull.
https://nightly.buildroot.org/manual.html#_infrastructure_for_packages_with_specific_build_systems
But I included this path by $(@D)/../<Tool>/lib
While it may work, this is a kludge.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox