Open arnk-basyskom opened 1 month ago
Hi @arnk-basyskom - thank you for reporting this.
I believe this is a combination of pre-existing issues:
and perhaps the fix here https://github.com/conan-io/conan/pull/13010/files#r1091019217 not working well in the presence of a sysroot.
I'm trying to replicate this case and issue a fix (even if a workaround) - however, from the logs you are posting, the grpc
package actually built "successfully" - the issue is linking the test package due to the linker not having -rpath-link
set properly. I suspect the fix wouldn't be in either the grpc recipe or the test package, but rather in a toolchain file or similar.
Adding the following snippet - needs to happen after Conan has had a chance to set CMAKE_LIBRARY_PATH
in the toolchain - will solve the issue.
-rpath
(which it is probably doing) might not fully help because the linker is prefixing it with the sysroot-rpath-link
If this is a Conan problem, it's probably also problematic for native builds, but we may be helped by the linker looking in LD_LIBRARY_PATH
for native builds (as per https://linux.die.net/man/1/ld).
Conan knows where all the relevant directories are - and it "should be" safe to just expose them all to the linker for this:
set(rpath_link_flags "")
foreach(_libdir IN LISTS CMAKE_LIBRARY_PATH)
set(rpath_link_flags "${rpath_link_flags} -Wl,-rpath-link=${_libdir}")
endforeach()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${rpath_link_flags}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${rpath_link_flags}")
adding this snippet after the call to project()
in the grpc test_package does the job - this could go in a toolchain and we can probably consider doing this from Conan when cross-building for Linux.
will transfer this issue to the Conan repository as this is not strictly an issue with the recipe in Conan Center
Thank you for your detailed feedback. I will try to test it soon. If you need any information or want me to test something, please let me know
Update: The workaround for the CMakeLists.txt in the test_package also works on my side. I'm still confused why CMake/Conan has every lib thats needed but the generated CMake files don't have the non system libs but the paths.
I would be glad if someone can give me a starting point for debugging this issue, so I can look into it myself.
Description
I looked around and found something that looks wrong. Inside the test_package folder there are all the gernerated CMake files to find the dependencies and the OpenSSL-debug-armv8-data.cmake for example has no libs set:
For the "openssl_OpenSSL_Crypto_LIBS_DEBUG" I would expect the value "crypto" but it is empty. This is the case for all the generated CMake files.
Package and Environment Details
Conan profile
host profile (
linux-aarch64-debug
):The arm_toolchain.cmake:
build profile (
default
):Steps to reproduce
conan create recipes/grpc/all --version=1.54.3 -pr:b default -pr:h linux-aarch64-debug
Logs
Click to expand log
``` [2/2] Linking CXX executable test_package FAILED: test_package : && /opt/sdk/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux//aarch64-xilinx-linux-g++ --sysroot=/opt/sdk/sysroots/cortexa72-cortexa53-xilinx-linux -g CMakeFiles/test_package.dir/test_package.cpp.o -o test_package -L/app/conan2/conf/p/b/grpcbb326f14903b1/p/lib -L/app/conan2/conf/p/b/proto864e689518f89/p/lib -L/app/conan2/conf/p/b/zlibd0b9e959abf3e/p/lib -L/app/conan2/conf/p/b/c-are0492486f98121/p/lib -L/app/conan2/conf/p/b/re2c30f2db103b1c/p/lib -L/app/conan2/conf/p/b/absei8d53f8714273b/p/lib -L/app/conan2/conf/p/b/opens511fa12a95f89/p/lib -Wl,-rpath,/app/conan2/conf/p/b/grpcbb326f14903b1/p/lib:/app/conan2/conf/p/b/proto864e689518f89/p/lib:/app/conan2/conf/p/b/zlibd0b9e959abf3e/p/lib:/app/conan2/conf/p/b/c-are0492486f98121/p/lib:/app/conan2/conf/p/b/re2c30f2db103b1c/p/lib:/app/conan2/conf/p/b/absei8d53f8714273b/p/lib:/app/conan2/conf/p/b/opens511fa12a95f89/p/lib /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libgrpc++.so -latomic /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libgrpc.so /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libaddress_sorting.so /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libupb.so /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libgpr.so -lm -lrt -ldl -lpthread && : /opt/sdk/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/11.2.0/real-ld: warning: libprotobufd.so.32, needed by /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libgrpc++.so, not found (try using -rpath or -rpath-link) /opt/sdk/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/11.2.0/real-ld: warning: libssl.so.3, needed by /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libgrpc++.so, not found (try using -rpath or -rpath-link) /opt/sdk/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/11.2.0/real-ld: warning: libcrypto.so.3, needed by /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libgrpc++.so, not found (try using -rpath or -rpath-link) [many more] /opt/sdk/sysroots/x86_64-petalinux-linux/usr/libexec/aarch64-xilinx-linux/gcc/aarch64-xilinx-linux/11.2.0/real-ld: /app/conan2/conf/p/b/grpcbb326f14903b1/p/lib/libgrpc.so: undefined reference to `absl::lts_20230125::ByChar::Find(std::basic_string_view