google / bloaty

Bloaty: a size profiler for binaries
Apache License 2.0
4.73k stars 341 forks source link

Update ABSL to tip #384

Closed carlocab closed 2 weeks ago

carlocab commented 3 weeks ago

This should hopefully fix the failing build.

carlocab commented 3 weeks ago

Nope, this doesn't work:

: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -W -Wall -Wno-sign-compare -fdiagnostics-color=always -O2 -g1 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/bloaty.dir/src/main.cc.o -o bloaty  liblibbloaty.a  third_party/protobuf/cmake/libprotoc.a  third_party/re2/libre2.a  third_party/capstone/libcapstone.a  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/libz.tbd  third_party/abseil-cpp/absl/strings/libabsl_strings.a  third_party/protobuf/cmake/libprotobuf.a  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/libz.tbd  third_party/abseil-cpp/absl/strings/libabsl_strings_internal.a  third_party/abseil-cpp/absl/strings/libabsl_string_view.a  third_party/abseil-cpp/absl/base/libabsl_base.a  third_party/abseil-cpp/absl/base/libabsl_spinlock_wait.a  third_party/abseil-cpp/absl/numeric/libabsl_int128.a  third_party/abseil-cpp/absl/base/libabsl_throw_delegate.a  third_party/abseil-cpp/absl/types/libabsl_bad_optional_access.a  third_party/abseil-cpp/absl/base/libabsl_raw_logging_internal.a  third_party/abseil-cpp/absl/base/libabsl_log_severity.a && :
Undefined symbols for architecture arm64:
  "absl::debugging_internal::Demangle(char const*, char*, unsigned long)", referenced from:
      bloaty::ItaniumDemangle(std::__1::basic_string_view<char, std::__1::char_traits<char>>, bloaty::DataSource) in liblibbloaty.a[2](bloaty.cc.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The call site seems fine:

https://github.com/google/bloaty/blob/6b78e080efcb63fa4ef9d2c1f062e3d5bf158e94/src/bloaty.cc#L181-L182

So I suspect we just need to link the right absl library.

haberman commented 3 weeks ago

Is it possible that we're just missing a lib in the list of libs here? https://github.com/google/bloaty/blob/6b78e080efcb63fa4ef9d2c1f062e3d5bf158e94/CMakeLists.txt#L313-L315

carlocab commented 3 weeks ago

Yes, I think so. Added absl::demangle_internal to the list of libraries that need to be linked.

Edit: nope, that error was just from picking up a separate Abseil install on my system. This PR builds fine for me now. Please have a look, @haberman.

carlocab commented 3 weeks ago

Note that the update to Abseil is not needed to fix anything, but I kept it anyway since it doesn't seem to hurt. Happy to back out that change if needed.

carlocab commented 3 weeks ago

Windows is still broken, but everything else seems to work now.

Don't know anything about Windows unfortunately. I'll try to dig into it tomorrow.

I also wonder if dropping the Abseil update and keeping only the change to CMakeLists.txt will be enough to fix Windows.

Oyyko commented 3 weeks ago

Only Adding list(APPEND LIBBLOATY_LIBS absl::demangle_internal) works for me (Ubuntu 20.04 x86-64). Thanks!

carlocab commented 3 weeks ago

Windows CI should be good at #385.

carlocab commented 2 weeks ago

Looks like #385 worked.

Would still be nice to update Abseil to tip anyway, but I'm not sure how to fix the Windows errors...

carlocab commented 2 weeks ago

@haberman, this should be good to go too: https://github.com/carlocab/bloaty/actions/runs/10594891815