ornladios / ADIOS2

Next generation of ADIOS developed in the Exascale Computing Program
https://adios2.readthedocs.io/en/latest/index.html
Apache License 2.0
268 stars 125 forks source link

2.9.2: macos-11 arm64 Linker Issue #3898

Open ax3l opened 9 months ago

ax3l commented 9 months ago

Describe the bug

I am preparing PyPI wheels for openPMD-api with ADIOS 2.9.2. Building ADIOS2 v2.9.1 errors with this linker issue:

  [ 95%] Building CXX object bindings/CXX11/CMakeFiles/adios2_cxx11.dir/adios2/cxx11/Operator.cpp.o
  cd /Users/runner/work/openPMD-api/openPMD-api/src/build-adios2/bindings/CXX11 && /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -I/Users/runner/work/openPMD-api/openPMD-api/src/ADIOS2-2.9.2/bindings/CXX11 -I/Users/runner/work/openPMD-api/openPMD-api/src/ADIOS2-2.9.2/source -I/Users/runner/work/openPMD-api/openPMD-api/src/build-adios2/source -I/Users/runner/work/openPMD-api/openPMD-api/src/ADIOS2-2.9.2/thirdparty/pugixml/pugixml/src -fPIC -arch arm64 -O3 -DNDEBUG -std=c++11 -arch arm64 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11 -fPIC -MD -MT bindings/CXX11/CMakeFiles/adios2_cxx11.dir/adios2/cxx11/Operator.cpp.o -MF CMakeFiles/adios2_cxx11.dir/adios2/cxx11/Operator.cpp.o.d -o CMakeFiles/adios2_cxx11.dir/adios2/cxx11/Operator.cpp.o -c /Users/runner/work/openPMD-api/openPMD-api/src/ADIOS2-2.9.2/bindings/CXX11/adios2/cxx11/Operator.cpp
  [ 96%] Linking CXX shared module ../../lib/libEncryptionOperator.so
  cd /Users/runner/work/openPMD-api/openPMD-api/src/build-adios2/plugins/operators && /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/cibw-run-gln4viao/cp38-macosx_arm64/build/venv/lib/python3.8/site-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/EncryptionOperator.dir/link.txt --verbose=1
  /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -fPIC -arch arm64 -O3 -DNDEBUG -arch arm64 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11 -bundle -Wl,-headerpad_max_install_names -o ../../lib/libEncryptionOperator.so CMakeFiles/EncryptionOperator.dir/EncryptionOperator.cpp.o  ../../lib/libadios2_core.a /usr/local/Cellar/libsodium/1.0.18_1/lib/libsodium.dylib ../../lib/libadios2_evpath.a ../../lib/libadios2_ffs.a -lm ../../lib/libadios2_dill.a ../../lib/libadios2_atl.a ../../lib/libadios2_enet.a /usr/local/lib/libblosc2.a /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/lib/libz.tbd /usr/local/lib/libz.a /usr/local/lib/libzfp.a 
  ld: warning: ignoring file /usr/local/Cellar/libsodium/1.0.18_1/lib/libsodium.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
  Undefined symbols for architecture arm64:
    "_crypto_secretbox_easy", referenced from:
        adios2::plugin::EncryptionOperator::Operate(char const*, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, adios2::DataType, char*) in EncryptionOperator.cpp.o
    "_crypto_secretbox_keygen", referenced from:
        adios2::plugin::EncryptionOperator::EncryptImpl::GenerateOrReadKey() in EncryptionOperator.cpp.o
    "_crypto_secretbox_open_easy", referenced from:
  [ 97%] Building CXX object bindings/CXX11/CMakeFiles/adios2_cxx11.dir/adios2/cxx11/Query.cpp.o
        adios2::plugin::EncryptionOperator::InverseOperate(char const*, unsigned long, char*) in EncryptionOperator.cpp.o
  cd /Users/runner/work/openPMD-api/openPMD-api/src/build-adios2/bindings/CXX11 && /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -I/Users/runner/work/openPMD-api/openPMD-api/src/ADIOS2-2.9.2/bindings/CXX11 -I/Users/runner/work/openPMD-api/openPMD-api/src/ADIOS2-2.9.2/source -I/Users/runner/work/openPMD-api/openPMD-api/src/build-adios2/source -I/Users/runner/work/openPMD-api/openPMD-api/src/ADIOS2-2.9.2/thirdparty/pugixml/pugixml/src -fPIC -arch arm64 -O3 -DNDEBUG -std=c++11 -arch arm64 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11 -fPIC -MD -MT bindings/CXX11/CMakeFiles/adios2_cxx11.dir/adios2/cxx11/Query.cpp.o -MF CMakeFiles/adios2_cxx11.dir/adios2/cxx11/Query.cpp.o.d -o CMakeFiles/adios2_cxx11.dir/adios2/cxx11/Query.cpp.o -c /Users/runner/work/openPMD-api/openPMD-api/src/ADIOS2-2.9.2/bindings/CXX11/adios2/cxx11/Query.cpp
    "_randombytes_buf", referenced from:
        adios2::plugin::EncryptionOperator::Operate(char const*, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, adios2::DataType, char*) in EncryptionOperator.cpp.o
    "_sodium_init", referenced from:
        adios2::plugin::EncryptionOperator::EncryptionOperator(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) in EncryptionOperator.cpp.o
    "_sodium_mlock", referenced from:
        adios2::plugin::EncryptionOperator::EncryptImpl::GenerateOrReadKey() in EncryptionOperator.cpp.o
    "_sodium_munlock", referenced from:
        adios2::plugin::EncryptionOperator::EncryptionOperator(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) in EncryptionOperator.cpp.o
        adios2::plugin::EncryptionOperator::~EncryptionOperator() in EncryptionOperator.cpp.o
  ld: symbol(s) not found for architecture arm64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

To Reproduce Please see the library_builders.sh script in https://github.com/openPMD/openPMD-api/pull/1554

This is run on a GitHub actions runner with macos-11 OS using the following CMake options:

    cmake               \
        -DBUILD_SHARED_LIBS=OFF                   \
        -DBUILD_TESTING=OFF                       \
        -DCMAKE_POSITION_INDEPENDENT_CODE=ON      \
        -DADIOS2_BUILD_EXAMPLES=OFF               \
        -DADIOS2_Blosc2_PREFER_SHARED=OFF         \
        -DADIOS2_USE_BZip2=OFF                    \
        -DADIOS2_USE_Blosc2=ON                    \
        -DADIOS2_USE_Fortran=OFF                  \
        -DADIOS2_USE_HDF5=OFF                     \
        -DADIOS2_USE_MHS=OFF                      \
        -DADIOS2_USE_MPI=OFF                      \
        -DADIOS2_USE_PNG=OFF                      \
        -DADIOS2_USE_SST=ON                       \
        -DADIOS2_USE_ZFP=ON                       \
        -DADIOS2_RUN_INSTALL_TEST=OFF             \
        -DHDF5_USE_STATIC_LIBRARIES:BOOL=ON       \
        -DCMAKE_VERBOSE_MAKEFILE=ON               \
        -DCMAKE_DISABLE_FIND_PACKAGE_LibFFI=TRUE  \
        -DCMAKE_DISABLE_FIND_PACKAGE_BISON=TRUE   \
        -DADIOS2_INSTALL_GENERATE_CONFIG=OFF      \
        -DCMAKE_INSTALL_PREFIX=${BUILD_PREFIX} ../ADIOS2-*

Expected behavior This worked in v2.9.1.

Desktop (please complete the following information):

Additional context https://github.com/openPMD/openPMD-api/pull/1554

I also see a few additional linker warnings in the build log: build_log.txt

ax3l commented 9 months ago

Should I just set ADIOS2_USE_Sodium=OFF for this? Looks to me like a system package was picked up that was build for x86_64 only (but we need a cross-compile here; also, I need an all-static build for this (wheels).).

eisenhauer commented 9 months ago

Should I just set ADIOS2_USE_Sodium=OFF for this? Looks to me like a system package was picked up that was build for x86_64 only (but we need a cross-compile here; also, I need an all-static build for this (wheels).).

That's probably the quick solution. We may need to update our CMake to be smarter in OSX builds now that there is more architecture diversity. @vicentebolea ?

vicentebolea commented 9 months ago

@scottwittenburg

vicentebolea commented 1 month ago

we stop supporting/ci coverage for mac 11 (as github actions)