blueprint-freespeech / ricochet-refresh

Anonymous peer-to-peer instant messaging
https://www.ricochetrefresh.net
Other
157 stars 27 forks source link

Add Abseil as libtego's dependency to fix linker errors #183

Open dllud opened 4 months ago

dllud commented 4 months ago

ricochet-refresh's build is failing with a DSO missing from command line error, on Arch Linux (binutils 2.42), when liking the final binary.

/usr/bin/ld: ../libtego/libtego.a(ControlChannel.pb.cc.o): undefined reference to symbol '_ZN4absl12lts_2023080212log_internal17MakeCheckOpStringIllEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_T0_PKc'
/usr/bin/ld: /usr/lib/libabsl_log_internal_check_op.so.2308.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [ricochet-refresh/CMakeFiles/ricochet-refresh.dir/build.make:440: ricochet-refresh/ricochet-refresh/ricochet-refresh] Error 1
make[1]: *** [CMakeFiles/Makefile2:363: ricochet-refresh/CMakeFiles/ricochet-refresh.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

libabsl_log_internal_check_op.so is needed to build libtego.a because protobuf depends on it. Setting the linker flags to -Wl,--copy-dt-needed-entries as I did on the AUR PKGBUILD works around the issue. However it goes against the now default behaviour of binutils of not recursively fetching dependencies for libs when linking.

Adding an explicit link to Abseil as I am doing in this PR fixes the error in the manner binutils now deems proper. On the other hand, it makes libtego build files depend on the internals of protobuf. As such I am unsure if this is the proper way to go. Reviews and comments are gladly welcomed.

pospeselr commented 4 months ago

Alternatively, we can leave the abseil check if we update ricochet-build to build with a newer protobuf dependency that includes abseil.