google / bloaty

Bloaty: a size profiler for binaries
Apache License 2.0
4.66k stars 337 forks source link

Cannot build bloaty on my Amazon Linux 2 docker image due to dwarf util error #377

Open JustinButler700 opened 3 months ago

JustinButler700 commented 3 months ago

On a fresh git clone of bloaty, when i try to compile it, using the following commands, it fails

cmake -B build -G Ninja -S .
cd build
ninja bloaty

the build fails [21/29] Building CXX object CMakeFiles/libbloaty.dir/src/dwarf/dwarf_util.cc.o FAILED: /usr/bin/g++ -DUSE_RE2 -D_LIBCXXABI_FUNC_VIS="" -I../third_party/re2 -I../third_party/capstone/include -I../. -I../src -I../third_party/abseil-cpp -Isrc -I../third_party/googletest/googletest/include -I../third_party/googletest/googlemock/include -isystem ../third_party/protobuf/src -W -Wall -Wno-sign-compare -fdiagnostics-color=always -O2 -g1 -std=gnu++1z -MD -MT CMakeFiles/libbloaty.dir/src/dwarf/dwarf_util.cc.o -MF CMakeFiles/libbloaty.dir/src/dwarf/dwarf_util.cc.o.d -o CMakeFiles/libbloaty.dir/src/dwarf/dwarf_util.cc.o -c ../src/dwarf/dwarf_util.cc In file included from ../src/dwarf/dwarf_util.h:22:0, from ../src/dwarf/dwarf_util.cc:15: ../src/util.h: In function ‘constexpr T bloaty::_BS(T)’: ../src/util.h:124:6: error: expected ‘(’ before ‘constexpr’ if constexpr (N == 1) { ^ ../src/util.h:126:5: error: ‘else’ without a previous ‘if’ } else { ^ [21/29] Building CXX object CMakeFiles/libbloaty.dir/src/dwarf/attr.cc.o FAILED: /usr/bin/g++ -DUSE_RE2 -D_LIBCXXABI_FUNC_VIS="" -I../third_party/re2 -I../third_party/capstone/include -I../. -I../src -I../third_party/abseil-cpp -Isrc -I../third_party/googletest/googletest/include -I../third_party/googletest/googlemock/include -isystem ../third_party/protobuf/src -W -Wall -Wno-sign-compare -fdiagnostics-color=always -O2 -g1 -std=gnu++1z -MD -MT CMakeFiles/libbloaty.dir/src/dwarf/attr.cc.o -MF CMakeFiles/libbloaty.dir/src/dwarf/attr.cc.o.d -o CMakeFiles/libbloaty.dir/src/dwarf/attr.cc.o -c ../src/dwarf/attr.cc In file included from ../src/dwarf/dwarf_util.h:22:0, from ../src/dwarf/debug_info.h:57, from ../src/dwarf/attr.cc:17: ../src/util.h: In function ‘constexpr T bloaty::_BS(T)’: ../src/util.h:124:6: error: expected ‘(’ before ‘constexpr’ if constexpr (N == 1) { ^ ../src/util.h:126:5: error: ‘else’ without a previous ‘if’ } else { ^

JustinButler700 commented 3 months ago

To fix this, i installed homebrew, and installed through homebrew outside of my docker image.