mapbox/protozero

Build fails at Linking CXX executable writer_tests

jlpoolen opened this issue · 1 comments

mapbox/protozero has been defined as a prerequisite to the osmium-tool project. So I upgraded (unmasked) my GCC compiler to version 14 on Gentoo Linux and overcame the requirement of C++ v. 14. But, I ran into another problem during linkage as shown below.

jlpoole@ryzdesk /usr/local/src/protozero/build $ date
Sun Sep  1 08:37:13 AM PDT 2024
jlpoole@ryzdesk /usr/local/src/protozero/build $ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified:   ../CMakeLists.txt

Untracked files:
(use "git add <file>..." to include in what will be committed)
./

no changes added to commit (use "git add" and/or "git commit -a")
jlpoole@ryzdesk /usr/local/src/protozero/build $ git --no-pager diff ../CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d1f9de..1a4714d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,13 +15,15 @@ project(protozero VERSION 1.7.1 LANGUAGES CXX C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

#-----------------------------------------------------------------------------
+# 9/1/24 jlpoole modified to overcome make's complaint re: version 14
+#
+  if (NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14)
+      set(CMAKE_CXX_STANDARD 14)
+  endif()
+  message(STATUS "Building in C++${CMAKE_CXX_STANDARD} mode")
+  set(CMAKE_CXX_EXTENSIONS OFF)
+  set(CMAKE_CXX_STANDARD_REQUIRED ON)

-if (NOT "${CMAKE_CXX_STANDARD}")
-    set(CMAKE_CXX_STANDARD 11)
-endif()
-message(STATUS "Building in C++${CMAKE_CXX_STANDARD} mode")
-set(CMAKE_CXX_EXTENSIONS OFF)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)

#-----------------------------------------------------------------------------

jlpoole@ryzdesk /usr/local/src/protozero/build $ make clean
jlpoole@ryzdesk /usr/local/src/protozero/build $ cmake ..
-- Building in C++14 mode
-- Looking for clang-tidy
-- Looking for clang-tidy - found /usr/lib/llvm/17/bin/clang-tidy
-- Looking for cppcheck
-- Looking for cppcheck - not found
--   Build target 'cppcheck' will not be available.
-- Looking for iwyu
-- Looking for iwyu - not found
--   Build target 'iwyu' will not be available.
-- Configuring documentation
-- Looking for doxygen
-- Looking for doxygen - found
-- Configuring documentation - done
-- Found protobuf libraries: Adding writer tests...
--   Adding bool
--   Adding bytes
--   Adding double
--   Adding enum
--   Adding fixed32
--   Adding int32
--   Adding message
--   Adding nested
--   Adding repeated
--   Adding repeated_packed_fixed32
--   Adding string
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /usr/local/src/protozero/build
jlpoole@ryzdesk /usr/local/src/protozero/build $ make
[  1%] Generating API documentation with Doxygen
warning: Tag 'OUTPUT_TEXT_DIRECTION' at line 102 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'CLANG_ASSISTED_PARSING' at line 1113 of file '/usr/local/src/protozero/build/doc/Doxyfile' belongs to an option that was not enabled at compile time.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u", or recompile doxygen with this feature enabled.
warning: Tag 'CLANG_ADD_INC_PATHS' at line 1119 of file '/usr/local/src/protozero/build/doc/Doxyfile' belongs to an option that was not enabled at compile time.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u", or recompile doxygen with this feature enabled.
warning: Tag 'CLANG_OPTIONS' at line 1127 of file '/usr/local/src/protozero/build/doc/Doxyfile' belongs to an option that was not enabled at compile time.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u", or recompile doxygen with this feature enabled.
warning: Tag 'CLANG_DATABASE_PATH' at line 1140 of file '/usr/local/src/protozero/build/doc/Doxyfile' belongs to an option that was not enabled at compile time.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u", or recompile doxygen with this feature enabled.
warning: Tag 'HTML_TIMESTAMP' at line 1287 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'FORMULA_TRANSPARENT' at line 1592 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'LATEX_SOURCE_CODE' at line 1905 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'LATEX_TIMESTAMP' at line 1921 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'RTF_SOURCE_CODE' at line 1995 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'DOCBOOK_PROGRAMLISTING' at line 2100 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'CLASS_DIAGRAMS' at line 2287 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'DOT_FONTNAME' at line 2329 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'DOT_FONTSIZE' at line 2336 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'DOT_TRANSPARENT' at line 2584 of file '/usr/local/src/protozero/build/doc/Doxyfile' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
/usr/local/src/protozero/include/protozero/varint.hpp:161: warning: found documented return type for protozero::add_varint_to_buffer that does not return anything
[  1%] Built target doc
[  2%] Building CXX object test/CMakeFiles/reader_tests.dir/reader_tests.cpp.o
[  3%] Building CXX object test/CMakeFiles/reader_tests.dir/t/alignment/reader_test_cases.cpp.o
[  4%] Building CXX object test/CMakeFiles/reader_tests.dir/t/bool/reader_test_cases.cpp.o
[  5%] Building CXX object test/CMakeFiles/reader_tests.dir/t/bytes/reader_test_cases.cpp.o
[  6%] Building CXX object test/CMakeFiles/reader_tests.dir/t/complex/reader_test_cases.cpp.o
[  7%] Building CXX object test/CMakeFiles/reader_tests.dir/t/double/reader_test_cases.cpp.o
[  8%] Building CXX object test/CMakeFiles/reader_tests.dir/t/enum/reader_test_cases.cpp.o
[  9%] Building CXX object test/CMakeFiles/reader_tests.dir/t/fixed32/reader_test_cases.cpp.o
[ 10%] Building CXX object test/CMakeFiles/reader_tests.dir/t/fixed64/reader_test_cases.cpp.o
[ 12%] Building CXX object test/CMakeFiles/reader_tests.dir/t/float/reader_test_cases.cpp.o
[ 13%] Building CXX object test/CMakeFiles/reader_tests.dir/t/int32/reader_test_cases.cpp.o
[ 14%] Building CXX object test/CMakeFiles/reader_tests.dir/t/int64/reader_test_cases.cpp.o
[ 15%] Building CXX object test/CMakeFiles/reader_tests.dir/t/message/reader_test_cases.cpp.o
[ 16%] Building CXX object test/CMakeFiles/reader_tests.dir/t/nested/reader_test_cases.cpp.o
[ 17%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated/reader_test_cases.cpp.o
[ 18%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_bool/reader_test_cases.cpp.o
[ 19%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_double/reader_test_cases.cpp.o
[ 20%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_enum/reader_test_cases.cpp.o
[ 21%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_fixed32/reader_test_cases.cpp.o
[ 23%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_fixed64/reader_test_cases.cpp.o
[ 24%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_float/reader_test_cases.cpp.o
[ 25%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_int32/reader_test_cases.cpp.o
[ 26%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_int64/reader_test_cases.cpp.o
[ 27%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_sfixed32/reader_test_cases.cpp.o
[ 28%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_sfixed64/reader_test_cases.cpp.o
[ 29%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_sint32/reader_test_cases.cpp.o
[ 30%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_sint64/reader_test_cases.cpp.o
[ 31%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_uint32/reader_test_cases.cpp.o
[ 32%] Building CXX object test/CMakeFiles/reader_tests.dir/t/repeated_packed_uint64/reader_test_cases.cpp.o
[ 34%] Building CXX object test/CMakeFiles/reader_tests.dir/t/rollback/reader_test_cases.cpp.o
[ 35%] Building CXX object test/CMakeFiles/reader_tests.dir/t/sfixed32/reader_test_cases.cpp.o
[ 36%] Building CXX object test/CMakeFiles/reader_tests.dir/t/sfixed64/reader_test_cases.cpp.o
[ 37%] Building CXX object test/CMakeFiles/reader_tests.dir/t/sint32/reader_test_cases.cpp.o
[ 38%] Building CXX object test/CMakeFiles/reader_tests.dir/t/sint64/reader_test_cases.cpp.o
[ 39%] Building CXX object test/CMakeFiles/reader_tests.dir/t/skip/reader_test_cases.cpp.o
[ 40%] Building CXX object test/CMakeFiles/reader_tests.dir/t/string/reader_test_cases.cpp.o
[ 41%] Building CXX object test/CMakeFiles/reader_tests.dir/t/tag_and_type/reader_test_cases.cpp.o
[ 42%] Building CXX object test/CMakeFiles/reader_tests.dir/t/tags/reader_test_cases.cpp.o
[ 43%] Building CXX object test/CMakeFiles/reader_tests.dir/t/uint32/reader_test_cases.cpp.o
[ 45%] Building CXX object test/CMakeFiles/reader_tests.dir/t/uint64/reader_test_cases.cpp.o
[ 46%] Building CXX object test/CMakeFiles/reader_tests.dir/t/vector_tile/reader_test_cases.cpp.o
[ 47%] Building CXX object test/CMakeFiles/reader_tests.dir/t/wrong_type_access/reader_test_cases.cpp.o
[ 48%] Linking CXX executable reader_tests
[ 48%] Built target reader_tests
[ 49%] Generating t/string/string_testcase.pb.cc, t/string/string_testcase.pb.h
[ 50%] Generating t/bool/bool_testcase.pb.cc, t/bool/bool_testcase.pb.h
[ 51%] Generating t/bytes/bytes_testcase.pb.cc, t/bytes/bytes_testcase.pb.h
[ 52%] Generating t/double/double_testcase.pb.cc, t/double/double_testcase.pb.h
[ 53%] Generating t/enum/enum_testcase.pb.cc, t/enum/enum_testcase.pb.h
[ 54%] Generating t/fixed32/fixed32_testcase.pb.cc, t/fixed32/fixed32_testcase.pb.h
[ 56%] Generating t/int32/int32_testcase.pb.cc, t/int32/int32_testcase.pb.h
[ 57%] Generating t/message/message_testcase.pb.cc, t/message/message_testcase.pb.h
[ 58%] Generating t/nested/nested_testcase.pb.cc, t/nested/nested_testcase.pb.h
[ 59%] Generating t/repeated/repeated_testcase.pb.cc, t/repeated/repeated_testcase.pb.h
[ 60%] Generating t/repeated_packed_fixed32/repeated_packed_fixed32_testcase.pb.cc, t/repeated_packed_fixed32/repeated_packed_fixed32_testcase.pb.h
[ 61%] Building CXX object test/CMakeFiles/writer_tests.dir/writer_tests.cpp.o
[ 62%] Building CXX object test/CMakeFiles/writer_tests.dir/t/bool/writer_test_cases.cpp.o
[ 63%] Building CXX object test/CMakeFiles/writer_tests.dir/t/bytes/writer_test_cases.cpp.o
[ 64%] Building CXX object test/CMakeFiles/writer_tests.dir/t/double/writer_test_cases.cpp.o
[ 65%] Building CXX object test/CMakeFiles/writer_tests.dir/t/enum/writer_test_cases.cpp.o
[ 67%] Building CXX object test/CMakeFiles/writer_tests.dir/t/fixed32/writer_test_cases.cpp.o
[ 68%] Building CXX object test/CMakeFiles/writer_tests.dir/t/int32/writer_test_cases.cpp.o
[ 69%] Building CXX object test/CMakeFiles/writer_tests.dir/t/message/writer_test_cases.cpp.o
[ 70%] Building CXX object test/CMakeFiles/writer_tests.dir/t/nested/writer_test_cases.cpp.o
[ 71%] Building CXX object test/CMakeFiles/writer_tests.dir/t/repeated/writer_test_cases.cpp.o
[ 72%] Building CXX object test/CMakeFiles/writer_tests.dir/t/repeated_packed_fixed32/writer_test_cases.cpp.o
[ 73%] Building CXX object test/CMakeFiles/writer_tests.dir/t/string/writer_test_cases.cpp.o
[ 74%] Building CXX object test/CMakeFiles/writer_tests.dir/t/bool/bool_testcase.pb.cc.o
[ 75%] Building CXX object test/CMakeFiles/writer_tests.dir/t/bytes/bytes_testcase.pb.cc.o
[ 76%] Building CXX object test/CMakeFiles/writer_tests.dir/t/double/double_testcase.pb.cc.o
[ 78%] Building CXX object test/CMakeFiles/writer_tests.dir/t/enum/enum_testcase.pb.cc.o
[ 79%] Building CXX object test/CMakeFiles/writer_tests.dir/t/fixed32/fixed32_testcase.pb.cc.o
[ 80%] Building CXX object test/CMakeFiles/writer_tests.dir/t/int32/int32_testcase.pb.cc.o
[ 81%] Building CXX object test/CMakeFiles/writer_tests.dir/t/message/message_testcase.pb.cc.o
[ 82%] Building CXX object test/CMakeFiles/writer_tests.dir/t/nested/nested_testcase.pb.cc.o
[ 83%] Building CXX object test/CMakeFiles/writer_tests.dir/t/repeated/repeated_testcase.pb.cc.o
[ 84%] Building CXX object test/CMakeFiles/writer_tests.dir/t/repeated_packed_fixed32/repeated_packed_fixed32_testcase.pb.cc.o
[ 85%] Building CXX object test/CMakeFiles/writer_tests.dir/t/string/string_testcase.pb.cc.o
[ 86%] Linking CXX executable writer_tests
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/writer_tests.dir/t/bool/bool_testcase.pb.cc.o: undefined reference to symbol '_ZN4absl12lts_2023012512log_internal21CheckOpMessageBuilder7ForVar2Ev'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libabsl_log_internal_check_op.so.2301.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/writer_tests.dir/build.make:527: test/writer_tests] Error 1
make[1]: *** [CMakeFiles/Makefile2:232: test/CMakeFiles/writer_tests.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
jlpoole@ryzdesk /usr/local/src/protozero/build $

I noted elsewhere in this project that you would like to have users have a full understanding. I'm just trying to get osmium-tools to work so i can convert OSM protobuffer formatted into XML.

I do think, though, that my change in the CMakeLists.txt would be helpful since in the project's current version, on my system, I ran into this error during make:

jlpoole@ryzdesk /usr/local/src/protozero/build $ cmake ..
-- Building in C++11 mode
-- Looking for clang-tidy
-- Looking for clang-tidy - found /usr/lib/llvm/17/bin/clang-tidy
-- Looking for cppcheck
-- Looking for cppcheck - not found
--   Build target 'cppcheck' will not be available.
-- Looking for iwyu
-- Looking for iwyu - not found
--   Build target 'iwyu' will not be available.
-- Configuring documentation
-- Looking for doxygen
-- Looking for doxygen - found
-- Configuring documentation - done
-- Found protobuf libraries: Adding writer tests...
--   Adding bool
--   Adding bytes
--   Adding double
--   Adding enum
--   Adding fixed32
--   Adding int32
--   Adding message
--   Adding nested
--   Adding repeated
--   Adding repeated_packed_fixed32
--   Adding string
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /usr/local/src/protozero/build
jlpoole@ryzdesk /usr/local/src/protozero/build $ gcc --version
gcc (Gentoo 14.2.1_p20240817 p4) 14.2.1 20240817
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

jlpoole@ryzdesk /usr/local/src/protozero/build $ 
and later when I run make, I get:
make
...
[ 61%] Building CXX object test/CMakeFiles/writer_tests.dir/writer_tests.cpp.o
[ 62%] Building CXX object test/CMakeFiles/writer_tests.dir/t/bool/writer_test_cases.cpp.o
In file included from /usr/include/absl/base/config.h:86,
from /usr/include/absl/base/attributes.h:37,
from /usr/include/absl/strings/string_view.h:39,
from /usr/include/google/protobuf/stubs/common.h:44,
from /usr/include/google/protobuf/io/coded_stream.h:130,
from /usr/local/src/protozero/build/test/t/bool/bool_testcase.pb.h:24,
from /usr/local/src/protozero/test/t/bool/writer_test_cases.cpp:6:
/usr/include/absl/base/policy_checks.h:79:2: error: #error "C++ versions less than C++14 are not supported."
79 | #error "C++ versions less than C++14 are not supported."
|  ^~~~~

For others who may find this issue in relation to their attempt to build osmium-tools, know that the problem above occurred after building whatever project libosmium needed and I was able to move forward and successfully build libosmium which allowed me to move forward with the build of osmium-tool -- though osmium-tool has now croaked on another unrelated issued. In conclusion, despite the failure of cmake to complete, what was accomplished was sufficient for my purposes.