GithubHelp home page GithubHelp logo

Cross-compilation issue with projects that use RocksDB built using Conan or Cmake on macOS with x86_64 CPU and targeted for arm64 CPUs about rocksdb HOT 2 OPEN

shpala avatar shpala commented on April 27, 2024
Cross-compilation issue with projects that use RocksDB built using Conan or Cmake on macOS with x86_64 CPU and targeted for arm64 CPUs

from rocksdb.

Comments (2)

adamretter avatar adamretter commented on April 27, 2024

We currently support cross-compilation on macOS using Make. See the target rocksdbjavastaticosx_ub in Makefile.

We might consider adding support in CMake. We don't use Conan. Can you provide the exact CMake command that you ran that will allow us to reproduce your problem please?

from rocksdb.

shpala avatar shpala commented on April 27, 2024

@adamretter The code seems to successfully cross-compile when using Make, but fails when using Cmake.
The command I'm using is:
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_PROCESSOR=arm64 ..
The main CMakeLists.txt checks this variable in order to check for whether the compiler supports the "-march=armv8-a+crc+crypto" flag and consequently set the HAS_ARMV8_CRC variable.
Without setting HAS_ARMV8_CRC, the generated makefile won't compile the required crc32c_arm64.cc .

The reason this fails is that on macOS Cmake, calls to project() in CMakeLists.txt resets CMAKE_SYSTEM_PROCESSOR to the host CPU architecture.
For this reason it's more common to use CMAKE_OSX_ARCHITECTURES on macOS systems.
The main drawback of this, is that CMAKE_OSX_ARCHITECTURES might be a list of architectures, which we really don't want to support.

In the PR I provided, I modified CMakeLists.txt to check:
Only when running on Apple systems, if CMAKE_SYSTEM_PROCESSOR is different from CMAKE_OSX_ARCHITECTURES,
then set CMAKE_SYSTEM_PROCESSOR to be the same as CMAKE_OSX_ARCHITECTURES.
The build will return an error in cases when CMAKE_OSX_ARCHITECTURES will contain more than one value

from rocksdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.