Giter VIP home page Giter VIP logo

Comments (4)

leetal avatar leetal commented on May 14, 2024

Hmm.. I'll have to verify this at work tomorrow. But it seems some of the flags are being overridden somehow by the CMakeLists.txt in the protobuf project. Is it the standard google protobuf repo you are trying to build with the toolchain?

from ios-cmake.

lebdron avatar lebdron commented on May 14, 2024

Yes, standard repo (not the latest master though), but the build process is somewhat not trivial, because build requires some binaries on host system:

git clone https://github.com/google/protobuf
(cd ./protobuf ; git checkout 80a37e0782d2d702d52234b62dd4b9ec74fd2c95)
cmake -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF -H./protobuf/cmake -B./protobuf/host_build # build for host to get js_embed
VERBOSE=1 cmake --build ./protobuf/host_build
sed -i .bak "s~COMMAND js_embed~COMMAND $(pwd)/protobuf/host_build/js_embed~" ./protobuf/cmake/libprotoc.cmake
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=$(pwd)/ios-cmake/ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR -DCMAKE_INSTALL_PREFIX=./dependencies -Dprotobuf_BUILD_TESTS=OFF -H./protobuf/cmake -B./protobuf/.build
VERBOSE=1 cmake --build ./protobuf/.build --target install

from ios-cmake.

leetal avatar leetal commented on May 14, 2024

So, i have now checked the situation, and it all seems very reasonable for Apple not to include bitcode in ARClite for simulator builds. Bitcode is only used by Apple for recompiling the binary blobs for newer SDKs and such. And since simulator slices are removed (more like prohibited by Apple) in AppStore-builds, there is little to no reason for them to supply bitcode in ARClite for simulator builds.

After digging through the protobuf code, my recommendation to you is to simply build libprotobuf without ARC, by supplying -DENABLE_ARC=0.

So, the correct commands would look like:

git clone https://github.com/google/protobuf
(cd ./protobuf ; git checkout 80a37e0782d2d702d52234b62dd4b9ec74fd2c95)
cmake -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF -H./protobuf/cmake -B./protobuf/host_build # build for host to get js_embed
VERBOSE=1 cmake --build ./protobuf/host_build
sed -i .bak "s~COMMAND js_embed~COMMAND $(pwd)/protobuf/host_build/js_embed~" ./protobuf/cmake/libprotoc.cmake
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=$(pwd)/ios-cmake/ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR -DENABLE_ARC=0 -DCMAKE_INSTALL_PREFIX=./dependencies -Dprotobuf_BUILD_TESTS=OFF -H./protobuf/cmake -B./protobuf/.build
VERBOSE=1 cmake --build ./protobuf/.build --target install

The resulting files under .dependencies will contain the LLVM slices required.

This way, you would be able to build with bitcode (but with ARC disabled for libprotobuf, since it seems that there is no need for it), even for the simulator (to ease one´s life a little). :)

from ios-cmake.

leetal avatar leetal commented on May 14, 2024

I will close this issue, since it is more a problem with documentation of the protobuf library, than an error with this toolchain.

from ios-cmake.

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.