conan-center-index icon indicating copy to clipboard operation
conan-center-index copied to clipboard

[package] grpc/1.65.0: downstream builds break if absel is used as shared

Open weatherhead99 opened this issue 6 months ago • 3 comments

Description

When building a package which depends on gRPC, and using abseil as a shared library, downstream builds can break with an error like (on gcc):

undefined reference to symbol '_ZN4absl12lts_2024011612log_internal17MakeCheckOpStringImmEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_T0_PKc'
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/danw/.conan2/p/b/absei344124e3560e9/p/lib/libabsl_log_internal_check_op.so.2401.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

or similar. In the recipe for gRPC, the self.requires statement for abseil correctly adds the "transitive_headers=True" trait. It should also add the "transitive_libs=True", because downstream consumers need to link to the abseil shared library.

This is not true for static library usage, but unfortunately I don't see a way to detect whether abseil is a shared library at this point in the build. Using self.options['abseil'].shared doesn't seem to work, and of course `self.dependencies' doesn't exist at the time of the 'requirements()' method being called.

Package and Environment Details

  • Package Name/Version: grpc/1.65.0
  • Operating System+version: Linux openSUSE Tumbleweed
  • Compiler+version: GCC 13.3.0
  • Conan version: conan 2.6.0
  • Python version: Python 3.11.9

Conan profile

[settings] arch=x86_64 build_type=RelWithDebInfo compiler=gcc compiler.cppstd=gnu20 compiler.libcxx=libstdc++11 compiler.version=13 os=Linux [buildenv] [conf] [options] grpc/*:with_libsystemd=False /:shared=True

Steps to reproduce

create package which uses grpc/1.65.0 as a dependency conan build . -oabseil/*:shared=True --build=missing

package build fails with missing DSO from command line related to absl

Logs

Click to expand log
[ 16%] Linking CXX executable asio_server_dev
[ 18%] Linking CXX shared library libfoxtrot_server.so
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/asio_server_dev.dir/asio_server_dev.cpp.o: undefined reference to symbol '_ZN4absl12lts_2024011612log_internal17MakeCheckOpStringImmEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_T0_PKc'
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: /home/danw/.conan2/p/b/absei344124e3560e9/p/lib/libabsl_log_internal_check_op.so.2401.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
gmake[2]: *** [devprogs/CMakeFiles/asio_server_dev.dir/build.make:123: devprogs/asio_server_dev] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:350: devprogs/CMakeFiles/asio_server_dev.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[ 27%] Built target foxtrot_server
gmake: *** [Makefile:136: all] Error 2

ERROR: conanfile.py (foxtrot_server/0.5.1-b2+dev-5-g90d8ee8-dirty): Error in build() method, line 110
        cmake.build()
        ConanException: Error 2 while executing

weatherhead99 avatar Aug 03 '24 11:08 weatherhead99