Skip to content

Unable to create universal binaries #223

@IanEmmons

Description

@IanEmmons

I am trying to build Snappy on Mac OS (Sequoia, version 15.7.3) as a universal binary, but it fails to build. I am using this CMake command line:

% cmake -S . -B build-cmake -DCMAKE_INSTALL_PREFIX=/opt/snappy-1.2.2 -DBUILD_SHARED_LIBS=ON -DSNAPPY_BUILD_BENCHMARKS=OFF -DSNAPPY_BUILD_TESTS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"

This completes successfully, but when I invoke make in the build-cmake directory, I get this error output from the compiler (showing only the first error):

% cd build-cmake ; make
~/dev/RocksDB/snappy-1.2.2/build-cmake ~/dev/RocksDB/snappy-1.2.2
[ 20%] Building CXX object CMakeFiles/snappy.dir/snappy-c.cc.o
[ 40%] Building CXX object CMakeFiles/snappy.dir/snappy-sinksource.cc.o
[ 60%] Building CXX object CMakeFiles/snappy.dir/snappy-stubs-internal.cc.o
[ 80%] Building CXX object CMakeFiles/snappy.dir/snappy.cc.o
In file included from /Users/iemmons/dev/RocksDB/snappy-1.2.2/snappy.cc:29:
In file included from /Users/iemmons/dev/RocksDB/snappy-1.2.2/snappy-internal.h:46:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/include/arm_neon.h:28:2: error: "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
   28 | #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"
      |  ^

Poking into the source code, the problem seems to be that SNAPPY_HAVE_NEON is defined even during the compiler pass for the x86_64 architecture.

Any hints how I can create universal binaries for Snappy?

I am using this version of Apple clang:

% clang --version
Apple clang version 17.0.0 (clang-1700.6.3.2)
Target: arm64-apple-darwin24.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions