Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] unit_capi_exception_wrapper fails to link against catch2 3.5.0 #4590

Open
barracuda156 opened this issue Dec 22, 2023 · 6 comments
Open

Comments

@barracuda156
Copy link
Contributor

--->  Testing tiledb
Executing:  cd "/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build" && /usr/bin/make check 
/opt/local/bin/cmake -S/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/TileDB-2.18.2 -B/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build --check-build-system CMakeFiles/Makefile.cmake 0
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 check
/opt/local/bin/cmake -S/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/TileDB-2.18.2 -B/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build --check-build-system CMakeFiles/Makefile.cmake 0
/opt/local/bin/cmake -E cmake_progress_start /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build/CMakeFiles 0
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 CMakeFiles/check.dir/all
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/check.dir/build.make CMakeFiles/check.dir/depend
cd /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build && /opt/local/bin/cmake -E cmake_depends "Unix Makefiles" /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/TileDB-2.18.2 /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/TileDB-2.18.2 /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build/CMakeFiles/check.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/check.dir/build.make CMakeFiles/check.dir/build
cd /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build/tiledb && /opt/local/bin/cmake --build . --target check --config MacPorts
gmake[4]: Entering directory '/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build/tiledb'
[  0%] Generating ../magic_mgc_gzipped.bin
[  0%] Built target gen_mgc_unarch
Consolidate compiler generated dependencies of target TILEDB_CORE_OBJECTS
[ 28%] Built target TILEDB_CORE_OBJECTS
[ 28%] Built target tiledb_shared
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/regression.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-12024.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-15387.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-18836.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-23712.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-19240_cppapi-vfs-exception.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-24079.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-25116.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-29682.cc.o
[ 30%] Building CXX object test/regression/CMakeFiles/tiledb_regression.dir/targets/sc-33480.cc.o
[ 31%] Linking CXX executable tiledb_regression
[ 31%] Built target tiledb_regression
Consolidate compiler generated dependencies of target seedable_global_PRNG
[ 32%] Built target seedable_global_PRNG
Consolidate compiler generated dependencies of target tdb_catch
[ 32%] Built target tdb_catch
[ 32%] Building CXX object test/support/test/CMakeFiles/unit_test_tdb_catch.dir/unit_tdb_catch.cc.o
[ 32%] Linking CXX executable unit_test_tdb_catch
[ 32%] Built target unit_test_tdb_catch
Consolidate compiler generated dependencies of target baseline
[ 32%] Built target baseline
Consolidate compiler generated dependencies of target parse_argument
[ 32%] Built target parse_argument
Consolidate compiler generated dependencies of target thread_pool
[ 32%] Built target thread_pool
Consolidate compiler generated dependencies of target constants
[ 32%] Built target constants
Consolidate compiler generated dependencies of target config
[ 34%] Built target config
Consolidate compiler generated dependencies of target exception_wrapper
[ 34%] Built target exception_wrapper
Consolidate compiler generated dependencies of target capi_error
[ 34%] Built target capi_error
[ 34%] Building CXX object tiledb/api/c_api/error/test/CMakeFiles/unit_capi_error.dir/unit_capi_error.cc.o
[ 35%] Linking CXX executable unit_capi_error
[ 35%] Built target unit_capi_error
Consolidate compiler generated dependencies of target stringx
[ 35%] Built target stringx
Consolidate compiler generated dependencies of target stats
[ 35%] Built target stats
Consolidate compiler generated dependencies of target storage_manager_stub
[ 35%] Built target storage_manager_stub
Consolidate compiler generated dependencies of target capi_config_stub
[ 35%] Built target capi_config_stub
Consolidate compiler generated dependencies of target cert_file
[ 35%] Built target cert_file
Consolidate compiler generated dependencies of target buffer
[ 35%] Built target buffer
Consolidate compiler generated dependencies of target cancelable_tasks
[ 35%] Built target cancelable_tasks
Consolidate compiler generated dependencies of target math
[ 35%] Built target math
Consolidate compiler generated dependencies of target vfs
[ 37%] Built target vfs
Consolidate compiler generated dependencies of target capi_context_stub
[ 37%] Built target capi_context_stub
Consolidate compiler generated dependencies of target capi_buffer_stub
[ 37%] Built target capi_buffer_stub
Consolidate compiler generated dependencies of target uuid
[ 37%] Built target uuid
Consolidate compiler generated dependencies of target enumeration
[ 37%] Built target enumeration
Consolidate compiler generated dependencies of target capi_enumeration_stub
[ 37%] Built target capi_enumeration_stub
[ 37%] Building CXX object tiledb/api/c_api/enumeration/test/CMakeFiles/unit_capi_enumeration.dir/unit_capi_enumeration.cc.o
[ 37%] Linking CXX executable unit_capi_enumeration
[ 37%] Built target unit_capi_enumeration
Consolidate compiler generated dependencies of target tile
[ 37%] Built target tile
Consolidate compiler generated dependencies of target capi_datatype
[ 37%] Built target capi_datatype
Consolidate compiler generated dependencies of target range
[ 37%] Built target range
Consolidate compiler generated dependencies of target compressors
[ 37%] Built target compressors
Consolidate compiler generated dependencies of target tiledb_crypto
[ 37%] Built target tiledb_crypto
Consolidate compiler generated dependencies of target filter
[ 38%] Built target filter
Consolidate compiler generated dependencies of target bitshuffle_filter
[ 40%] Built target bitshuffle_filter
Consolidate compiler generated dependencies of target byteshuffle_filter
[ 40%] Built target byteshuffle_filter
Consolidate compiler generated dependencies of target checksum_filters
[ 40%] Built target checksum_filters
Consolidate compiler generated dependencies of target compression_filter
[ 41%] Built target compression_filter
Consolidate compiler generated dependencies of target encryption_filters
[ 41%] Built target encryption_filters
Consolidate compiler generated dependencies of target float_scaling_filter
[ 41%] Built target float_scaling_filter
Consolidate compiler generated dependencies of target xor_filter
[ 42%] Built target xor_filter
Consolidate compiler generated dependencies of target misc_types
[ 42%] Built target misc_types
Consolidate compiler generated dependencies of target webp_filter
[ 42%] Built target webp_filter
Consolidate compiler generated dependencies of target all_filters
[ 42%] Built target all_filters
Consolidate compiler generated dependencies of target capi_filter_stub
[ 42%] Built target capi_filter_stub
Consolidate compiler generated dependencies of target filter_pipeline
[ 42%] Built target filter_pipeline
Consolidate compiler generated dependencies of target capi_filter_list_stub
[ 42%] Built target capi_filter_list_stub
Consolidate compiler generated dependencies of target dimension
[ 42%] Built target dimension
Consolidate compiler generated dependencies of target capi_dimension_stub
[ 44%] Built target capi_dimension_stub
[ 44%] Building CXX object tiledb/api/c_api/dimension/test/CMakeFiles/unit_capi_dimension.dir/unit_capi_dimension.cc.o
[ 44%] Linking CXX executable unit_capi_dimension
[ 44%] Built target unit_capi_dimension
Consolidate compiler generated dependencies of target datum
[ 45%] Built target datum
Consolidate compiler generated dependencies of target domain
[ 45%] Built target domain
Consolidate compiler generated dependencies of target capi_domain_stub
[ 45%] Built target capi_domain_stub
[ 45%] Building CXX object tiledb/api/c_api/domain/test/CMakeFiles/unit_capi_domain.dir/unit_capi_domain.cc.o
[ 45%] Linking CXX executable unit_capi_domain
[ 45%] Built target unit_capi_domain
Consolidate compiler generated dependencies of target attribute
[ 45%] Built target attribute
Consolidate compiler generated dependencies of target capi_attribute_stub
[ 47%] Built target capi_attribute_stub
[ 47%] Building CXX object tiledb/api/c_api/attribute/test/CMakeFiles/unit_capi_attribute.dir/unit_capi_attribute.cc.o
[ 47%] Linking CXX executable unit_capi_attribute
[ 47%] Built target unit_capi_attribute
Consolidate compiler generated dependencies of target capi_object
[ 47%] Built target capi_object
[ 47%] Building CXX object tiledb/api/c_api/object/test/CMakeFiles/unit_capi_object_type.dir/unit_capi_object_type.cc.o
[ 47%] Linking CXX executable unit_capi_object_type
[ 47%] Built target unit_capi_object_type
[ 47%] Building CXX object tiledb/api/c_api/object/test/CMakeFiles/unit_capi_object_walk_order.dir/unit_capi_object_walk_order.cc.o
[ 47%] Linking CXX executable unit_capi_object_walk_order
[ 47%] Built target unit_capi_object_walk_order
Consolidate compiler generated dependencies of target capi_string
[ 47%] Built target capi_string
[ 47%] Building CXX object tiledb/api/c_api/string/test/CMakeFiles/unit_capi_string.dir/unit_capi_string.cc.o
[ 47%] Linking CXX executable unit_capi_string
[ 47%] Built target unit_capi_string
[ 47%] Building CXX object test/support/CMakeFiles/tiledb_test_support_lib.dir/src/ast_helpers.cc.o
[ 47%] Building CXX object test/support/CMakeFiles/tiledb_test_support_lib.dir/src/helpers.cc.o
[ 47%] Building CXX object test/support/CMakeFiles/tiledb_test_support_lib.dir/src/serialization_wrappers.cc.o
[ 47%] Building CXX object test/support/CMakeFiles/tiledb_test_support_lib.dir/src/vfs_helpers.cc.o
[ 47%] Linking CXX static library libtiledb_test_support_lib.a
[ 47%] Built target tiledb_test_support_lib
Consolidate compiler generated dependencies of target query_plan
[ 47%] Built target query_plan
Consolidate compiler generated dependencies of target capi_query_plan
[ 47%] Built target capi_query_plan
[ 47%] Building CXX object tiledb/api/c_api/query_plan/test/CMakeFiles/unit_capi_query_plan.dir/unit_capi_query_plan.cc.o
[ 47%] Linking CXX executable unit_capi_query_plan
ld: warning: ignoring duplicate libraries: '/opt/local/lib/libCatch2.a'
[ 47%] Built target unit_capi_query_plan
Consolidate compiler generated dependencies of target capi_query_aggregate
[ 48%] Built target capi_query_aggregate
[ 48%] Building CXX object tiledb/api/c_api/query_aggregate/test/CMakeFiles/unit_capi_query_aggregate.dir/unit_capi_query_aggregate.cc.o
[ 48%] Linking CXX executable unit_capi_query_aggregate
ld: warning: ignoring duplicate libraries: '/opt/local/lib/libCatch2.a'
[ 48%] Built target unit_capi_query_aggregate
Consolidate compiler generated dependencies of target capi_query_field
[ 48%] Built target capi_query_field
[ 50%] Building CXX object tiledb/api/c_api/query_field/test/CMakeFiles/unit_capi_query_field.dir/unit_capi_query_field.cc.o
[ 50%] Linking CXX executable unit_capi_query_field
ld: warning: ignoring duplicate libraries: '/opt/local/lib/libCatch2.a'
[ 50%] Built target unit_capi_query_field
[ 50%] Building CXX object tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/unit_capi_exception_wrapper.cc.o
[ 50%] Building CXX object tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/unit_capi_error_tree.cc.o
[ 50%] Linking CXX executable unit_capi_exception_wrapper
ld: Undefined symbols:
  Catch::StringMaker<std::__1::basic_string_view<char, std::__1::char_traits<char>>, void>::convert(std::__1::basic_string_view<char, std::__1::char_traits<char>>), referenced from:
      Catch::BinaryExpr<std::__1::basic_string_view<char, std::__1::char_traits<char>>&, char const (&) [7]>::streamReconstructedExpression(std::__1::basic_ostream<char, std::__1::char_traits<char>>&) const in unit_capi_error_tree.cc.o
      Catch::BinaryExpr<std::__1::basic_string_view<char, std::__1::char_traits<char>>&, char const (&) [8]>::streamReconstructedExpression(std::__1::basic_ostream<char, std::__1::char_traits<char>>&) const in unit_capi_error_tree.cc.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[7]: *** [tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/build.make:153: tiledb/api/c_api_support/exception_wrapper/test/unit_capi_exception_wrapper] Error 1
gmake[6]: *** [CMakeFiles/Makefile2:6225: tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/all] Error 2
gmake[5]: *** [CMakeFiles/Makefile2:13688: test/CMakeFiles/check.dir/rule] Error 2
gmake[4]: *** [Makefile:4261: check] Error 2
gmake[4]: Leaving directory '/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_databases_tiledb/tiledb/work/build/tiledb'
make[3]: *** [CMakeFiles/check] Error 2
make[2]: *** [CMakeFiles/check.dir/all] Error 2
make[1]: *** [CMakeFiles/check.dir/rule] Error 2
make: *** [check] Error 2

OS info:

svacchanda@43-103 ~ % sw_vers
ProductName:		macOS
ProductVersion:		14.2.1
BuildVersion:		23C71

Versions used:

  catch2 @3.5.0_0 (active) requested_variants='' platform='darwin 23' archs='arm64' date='2023-12-22T19:39:43+0800'
  tiledb @2.18.2_0 (active) requested_variants='' platform='darwin 23' archs='arm64' date='2023-12-13T17:33:19+0800'
@barracuda156
Copy link
Contributor Author

This also fails with GCC:

[ 46%] Building CXX object tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/unit_capi_error_tree.cc.o
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_tiledb/tiledb/work/TileDB-2.19.1/tiledb/api/c_api_support/exception_wrapper/test/unit_capi_error_tree.cc: In function 'void CATCH2_INTERNAL_TEST_12()':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_tiledb/tiledb/work/TileDB-2.19.1/tiledb/api/c_api_support/exception_wrapper/test/unit_capi_error_tree.cc:314:65: error: call of overloaded 'ErrorTreeTest(<brace-enclosed initializer list>)' is ambiguous
  314 |   ErrorTreeTest x{{{Error{"a", "b"}, {}}, {Error{"c", "d"}, {}}}};
      |                                                                 ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_tiledb/tiledb/work/TileDB-2.19.1/tiledb/api/c_api_support/exception_wrapper/test/unit_capi_error_tree.cc:289:3: note: candidate: 'ErrorTreeTest::ErrorTreeTest(vector_type)'
  289 |   ErrorTreeTest(vector_type x)
      |   ^~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_tiledb/tiledb/work/TileDB-2.19.1/tiledb/api/c_api_support/exception_wrapper/test/unit_capi_error_tree.cc:286:3: note: candidate: 'ErrorTreeTest::ErrorTreeTest(Error)'
  286 |   ErrorTreeTest(Error e)
      |   ^~~~~~~~~~~~~
gmake[7]: *** [tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/build.make:90: tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/unit_capi_error_tree.cc.o] Error 1

@barracuda156
Copy link
Contributor Author

@eric-hughes-tiledb Could you take a look? This does not seem to work on macOS. It just fails to build with GCC on my old testing system and fails to link on Sonoma.

barracuda156 referenced this issue Jan 31, 2024
* Switch from inheritance to templates for the error tree visitor. Converted old visitor base class into a concept.

* Adjusted C API build to take into account that the exception handler is no longer header-only.

* More build adjustments

* Attempt to remove a duplicate symbol linkage causing CI fail
@barracuda156
Copy link
Contributor Author

On a side-note, this test, like a few others, needs to link against libatomic for some archs (ppc, arm, mips):

[ 46%] Building CXX object tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/unit_capi_error_tree.cc.o
[ 47%] Linking CXX executable unit_capi_exception_wrapper
ld: warning: __ZN5Catch6Detail10unique_ptrINS_12ITestInvokerEED1Ev has different visibility (default) in /opt/local/lib/libCatch2.a(catch_registry_hub.cpp.o) and (hidden) in CMakeFiles/unit_capi_exception_wrapper.dir/unit_capi_exception_wrapper.cc.o
Undefined symbols:
  "___atomic_fetch_add_8", referenced from:
      __ZNSt13__atomic_baseIyEppEv in context.cc.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
gmake[7]: *** [tiledb/api/c_api_support/exception_wrapper/test/CMakeFiles/unit_capi_exception_wrapper.dir/build.make:156: tiledb/api/c_api_support/exception_wrapper/test/unit_capi_exception_wrapper] Error 1

@eric-hughes-tiledb
Copy link
Contributor

The missing symbols Catch::StringMaker, etc. are entirely in the Catch2 library. We use it in header-only mode, which does not have this issue. My best guess, with limited information, is that (1) you've got a system-installed catch which uses a linked library, and (2) the build is picking up the system version, and thus (3) there's a missing library.

As for the GCC failure, which version? Our code does not compile on older versions.

@barracuda156
Copy link
Contributor Author

@eric-hughes-tiledb Thank you for responding!

Unfortunately, building against bundled Catch2 fails for me: #4095
So I had to use an external one (and your guess is correct).

As for the GCC failure, which version? Our code does not compile on older versions.

gcc 13.2.0, recent enough, hopefully.

@barracuda156
Copy link
Contributor Author

barracuda156 commented Jan 31, 2024

@eric-hughes-tiledb Another Catch2-related error:

[ 82%] Building CXX object test/CMakeFiles/tiledb_unit.dir/src/unit.cc.o
In file included from /opt/local/include/catch2/internal/catch_commandline.hpp:11,
                 from /opt/local/include/catch2/catch_session.hpp:11,
                 from /opt/local/include/catch2/catch_all.hpp:33,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_tiledb/tiledb/work/TileDB-2.19.1/test/../test/support/tdb_catch.h:56,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_tiledb/tiledb/work/TileDB-2.19.1/test/src/unit.cc:2:
/opt/local/include/catch2/internal/catch_clara.hpp: In instantiation of 'Catch::Clara::Parser Catch::Clara::operator|(const Parser&, T&&) [with T = Opt]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_tiledb/tiledb/work/TileDB-2.19.1/test/src/unit.cc:40:65:   required from here
/opt/local/include/catch2/internal/catch_clara.hpp:676:24: error: cannot bind non-const lvalue reference of type 'Catch::Clara::Parser&' to an rvalue of type 'Catch::Clara::Parser'
  676 |                 return Parser( p ) |= CATCH_FORWARD(rhs);
      |                        ^~~~~~~~~~~
/opt/local/include/catch2/internal/catch_clara.hpp:667:48: note:   initializing argument 1 of 'Catch::Clara::Parser& Catch::Clara::operator|=(Parser&, Opt&&)'
  667 |             friend Parser& operator|=( Parser& p, Opt&& opt ) {
      |                                        ~~~~~~~~^
gmake[7]: *** [test/CMakeFiles/tiledb_unit.dir/build.make:2008: test/CMakeFiles/tiledb_unit.dir/src/unit.cc.o] Error 1

Or is this rather a bug in Catch2 itself?

UPD. This one is a Catch2 bug indeed, but fixed as of 3.5.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants