OpenVPN / openvpn3

OpenVPN 3 is a C++ class library that implements the functionality of an OpenVPN client, and is protocol-compatible with the OpenVPN 2.x branch.
https://openvpn.net
Other
999 stars 401 forks source link

Build failure on macOS 15: Undefined symbols for architecture arm64 #332

Open i0ntempest opened 2 months ago

i0ntempest commented 2 months ago

Full log below.

:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_openvpn3/openvpn3/work/build/test/unittests && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/coreUnitTests.dir/link.txt --verbose=ON
:info:build /usr/bin/clang++ -pipe -I/opt/local/libexec/openssl3/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -mmacosx-version-min=15.0 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/libexec/openssl3/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-ld_classic -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk CMakeFiles/coreUnitTests.dir/core_tests.cpp.o CMakeFiles/coreUnitTests.dir/test_acc.cpp.o CMakeFiles/coreUnitTests.dir/test_acc_certcheck.cpp.o CMakeFiles/coreUnitTests.dir/test_route_emulation.cpp.o CMakeFiles/coreUnitTests.dir/test_log.cpp.o CMakeFiles/coreUnitTests.dir/test_comp.cpp.o CMakeFiles/coreUnitTests.dir/test_b64.cpp.o CMakeFiles/coreUnitTests.dir/test_verify_x509_name.cpp.o CMakeFiles/coreUnitTests.dir/test_ssl.cpp.o CMakeFiles/coreUnitTests.dir/test_sslctx.cpp.o CMakeFiles/coreUnitTests.dir/test_continuation.cpp.o CMakeFiles/coreUnitTests.dir/test_crypto.cpp.o CMakeFiles/coreUnitTests.dir/test_optfilt.cpp.o CMakeFiles/coreUnitTests.dir/test_clamp_typerange.cpp.o CMakeFiles/coreUnitTests.dir/test_pktstream.cpp.o CMakeFiles/coreUnitTests.dir/test_remotelist.cpp.o CMakeFiles/coreUnitTests.dir/test_relack.cpp.o CMakeFiles/coreUnitTests.dir/test_http_proxy.cpp.o CMakeFiles/coreUnitTests.dir/test_peer_fingerprint.cpp.o CMakeFiles/coreUnitTests.dir/test_safestr.cpp.o CMakeFiles/coreUnitTests.dir/test_numeric_cast.cpp.o CMakeFiles/coreUnitTests.dir/test_dns.cpp.o CMakeFiles/coreUnitTests.dir/test_header_deps.cpp.o CMakeFiles/coreUnitTests.dir/test_capture.cpp.o CMakeFiles/coreUnitTests.dir/test_cleanup.cpp.o CMakeFiles/coreUnitTests.dir/test_crypto_hashstr.cpp.o CMakeFiles/coreUnitTests.dir/test_csum.cpp.o CMakeFiles/coreUnitTests.dir/test_format.cpp.o CMakeFiles/coreUnitTests.dir/test_headredact.cpp.o CMakeFiles/coreUnitTests.dir/test_hostport.cpp.o CMakeFiles/coreUnitTests.dir/test_ip.cpp.o CMakeFiles/coreUnitTests.dir/test_ostream_containers.cpp.o CMakeFiles/coreUnitTests.dir/test_parseargv.cpp.o CMakeFiles/coreUnitTests.dir/test_path.cpp.o CMakeFiles/coreUnitTests.dir/test_pktid.cpp.o CMakeFiles/coreUnitTests.dir/test_prefixlen.cpp.o CMakeFiles/coreUnitTests.dir/test_randapi.cpp.o CMakeFiles/coreUnitTests.dir/test_rc.cpp.o CMakeFiles/coreUnitTests.dir/test_route.cpp.o CMakeFiles/coreUnitTests.dir/test_reliable.cpp.o CMakeFiles/coreUnitTests.dir/test_splitlines.cpp.o CMakeFiles/coreUnitTests.dir/test_statickey.cpp.o CMakeFiles/coreUnitTests.dir/test_streq.cpp.o CMakeFiles/coreUnitTests.dir/test_time.cpp.o CMakeFiles/coreUnitTests.dir/test_typeindex.cpp.o CMakeFiles/coreUnitTests.dir/test_tun_builder.cpp.o CMakeFiles/coreUnitTests.dir/test_userpass.cpp.o CMakeFiles/coreUnitTests.dir/test_validatecreds.cpp.o CMakeFiles/coreUnitTests.dir/test_weak.cpp.o CMakeFiles/coreUnitTests.dir/test_cliopt.cpp.o CMakeFiles/coreUnitTests.dir/test_buffer.cpp.o CMakeFiles/coreUnitTests.dir/test_proto.cpp.o CMakeFiles/coreUnitTests.dir/test_openssl_x509certinfo.cpp.o CMakeFiles/coreUnitTests.dir/test_openssl_authcert.cpp.o CMakeFiles/coreUnitTests.dir/test_opensslpki.cpp.o CMakeFiles/coreUnitTests.dir/test_openssl_misc.cpp.o CMakeFiles/coreUnitTests.dir/test_session_id.cpp.o CMakeFiles/coreUnitTests.dir/test_buffer_ip.cpp.o CMakeFiles/coreUnitTests.dir/test_cpu_time.cpp.o CMakeFiles/coreUnitTests.dir/test_misc_unix.cpp.o CMakeFiles/coreUnitTests.dir/test_pipe.cpp.o CMakeFiles/coreUnitTests.dir/test_psid_cookie.cpp.o -o coreUnitTests  -Wl,-rpath,/opt/local/lib /opt/local/lib/liblz4.dylib /opt/local/libexec/openssl3/lib/libssl.dylib -framework CoreFoundation -framework IOKit -framework CoreServices -framework SystemConfiguration -lpthread /opt/local/lib/liblzo2.dylib ../../lib/libgtest_main.a ../../lib/libgmock.a /opt/local/libexec/openssl3/lib/libcrypto.dylib /opt/local/lib/libjsoncpp.a ../../lib/libgtest.a
:info:build ld: warning: -ld_classic is deprecated and will be removed in a future release
:info:build Undefined symbols for architecture arm64:
:info:build   "testing::internal::MakeAndRegisterTestInfo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)", referenced from:
:info:build       __GLOBAL__sub_I_test_acc.cpp in test_acc.cpp.o
:info:build       __GLOBAL__sub_I_test_acc_certcheck.cpp in test_acc_certcheck.cpp.o
:info:build       __GLOBAL__sub_I_test_route_emulation.cpp in test_route_emulation.cpp.o
:info:build       __GLOBAL__sub_I_test_log.cpp in test_log.cpp.o
:info:build       __GLOBAL__sub_I_test_comp.cpp in test_comp.cpp.o
:info:build       __GLOBAL__sub_I_test_b64.cpp in test_b64.cpp.o
:info:build       __GLOBAL__sub_I_test_verify_x509_name.cpp in test_verify_x509_name.cpp.o
:info:build       ...
:info:build   "testing::internal::ReportInvalidTestSuiteType(char const*, testing::internal::CodeLocation const&)", referenced from:
:info:build       testing::internal::ParameterizedTestSuiteInfo<InvalidConfigs>* testing::internal::ParameterizedTestSuiteRegistry::GetTestSuitePatternHolder<InvalidConfigs>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, testing::internal::CodeLocation) in test_cliopt.cpp.o
:info:build       testing::internal::ParameterizedTestSuiteInfo<ValidConfigs>* testing::internal::ParameterizedTestSuiteRegistry::GetTestSuitePatternHolder<ValidConfigs>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, testing::internal::CodeLocation) in test_cliopt.cpp.o
:info:build ld: symbol(s) not found for architecture arm64
:info:build clang++: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[2]: *** [test/unittests/coreUnitTests] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_openvpn3/openvpn3/work/build'
:info:build make[1]: *** [test/unittests/CMakeFiles/coreUnitTests.dir/all] Error 2
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_openvpn3/openvpn3/work/build'
:info:build make: *** [all] Error 2

main.log

i0ntempest commented 2 months ago

Uhhh... but I'm not using Windows?

flichtenheld commented 2 months ago

Uhhh... but I'm not using Windows?

Yeah, ignore that, probably malware or something.

What version of openvpn3 is this exactly? What are the steps to reproduce the problem?

The symbol is related to GoogleTest, so might also be a problem on their side.

i0ntempest commented 2 months ago

Tried 3.10.1 and 3.9, same errors. The log is from building 3.10.1.

i0ntempest commented 2 months ago

I tried to reproduce it manually to rule out possible macports problem. A normal cmake .. && make will trigger the error. EDIT: but with slightly different messages:

Undefined symbols for architecture arm64:
  "testing::internal::MakeAndRegisterTestInfo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)", referenced from:
      ___cxx_global_var_init.5 in test_acc.cpp.o
      ___cxx_global_var_init.21 in test_acc.cpp.o
      ___cxx_global_var_init.27 in test_acc.cpp.o
      ___cxx_global_var_init.30 in test_acc.cpp.o
      ___cxx_global_var_init.38 in test_acc.cpp.o
      ___cxx_global_var_init.43 in test_acc.cpp.o
      ___cxx_global_var_init.50 in test_acc.cpp.o
      ...
  "testing::internal::ReportInvalidTestSuiteType(char const*, testing::internal::CodeLocation const&)", referenced from:
      testing::internal::ParameterizedTestSuiteInfo<InvalidConfigs>* testing::internal::ParameterizedTestSuiteRegistry::GetTestSuitePatternHolder<InvalidConfigs>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, testing::internal::CodeLocation) in test_cliopt.cpp.o
      testing::internal::ParameterizedTestSuiteInfo<ValidConfigs>* testing::internal::ParameterizedTestSuiteRegistry::GetTestSuitePatternHolder<ValidConfigs>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, testing::internal::CodeLocation) in test_cliopt.cpp.o
ld: symbol(s) not found for architecture arm64
c++: error: linker command failed with exit code 1 (use -v to see invocation)
schwabe commented 2 months ago

You have two different google test version. One from the ports/homebrew and one from the interal one that openvpn3 uses. It compiles against header of one but links against the other. Uninstall the one from homebrew as a workaround. Patches to fix this for good are welcome.

i0ntempest commented 2 months ago

I just removed add_subdirectory(test/unittests) from CMakeLists.txt since my use case doesn't need it anyway. I'll try if I can figure out a permanent fix.