Is there a more detailed iOS compilation tutorial here?

Hi all, has anyone successfully compiled Pulse on the latest AppleSilicon Xcode16? I’m following the tutorial in the documentation and I don’t know the exact steps to follow.

I am using a command from the command line that generates a number of files, including an XcodeProject project file. I opened this project file and selected the target as ALL_BUILD and started compiling with Xcode and it reported some errors, but I don’t understand why. Where can I find a more detailed tutorial on compiling?

I used this command:
cmake …/engine/ -G Xcode -DCMAKE_TOOLCHAIN_FILE=/Volumes/HiWill_Work/Pulse/engine/cmake/ios.toolchain.cmake -DPLATFORM=OS64 -DENABLE_BITCODE=FALSE

The error info like blow:

I suggest you use the CMake GUI

Per the instructions, you need to enable and disable and set several options
You do not have all the necessary options specified in your command

My full build logMy ios.toolchaine.cmake fileHi there, hello and thank you very much for your reply! I was told by someone that this is caused by the fact that protobuf depends on absl and absl doesn’t provide a cmake build file for ios. My computer chip is Apple M2 Max, Xcode version number is 16.2.

My project project directory is “/Volumes/HiWillWork/Pulse/engine”, and my builds directory is “/Volumes/HiWillWork/Pulse/builds”.

First, I need to change ios.toolchain.cmake, and I’ve added four lines to it:

set(Pulse_NATIVE_BUILD_DIR “/Volumes/HiWill_Work/Pulse/builds/” CACHE FILEPATH “Pulse_NATIVE_BUILD_DIR path.”)
set(Pulse_C_AS_STATIC ON)
set(Pulse_JAVA_API OFF)
set(Pulse_PYTHON_API OFF)

Then I executed a command in the builds directory:

cmake /Volumes/HiWill_Work/Pulse/engine/ -G Xcode -DCMAKE_TOOLCHAIN_FILE=/Volumes/HiWill_Work/Pulse/engine/cmake/ios.toolchain. cmake -DPLATFORM=OS64 -DENABLE_BITCODE=FALSE

The above command can be executed successfully. But the next command immediately after it fails:

cmake --build . --config Release

My ios.toolchain.cmake is here , and the full build log is here, can you help me with that? I really need your help, I’ve been working on compiling iOS related work for the last few days, but this failure is making me very anxious and stressed.

Gotcha
I believe I remember seeing this too
Note, the instructions provided are for building the PulseC interface library that is required by Unity
This assumes you are building this to drop into your Unity project using Pulse

So the quickest thing you can do, is switch the protobuf version drop down to the last version without the ABSL dependency

image

I also build this iOS binary using an Intel based macos, which works just fine with abls

There are quite a bit of oddities with a silicon based macos that I run into (including this) that I will have to dig into, but not being an experienced macos person, will take a while, but I am going to try to build this and see what happens.

Per your log, it seems that absl built and installed just fine… it installed everything to /Volumes/HiWill_Work/Pulse/builds/install/lib/cmake/absl/
But it seems that protobuf was unable to find it…

It looks like you are trying to build the stable branch, which uses protobuf-27.3
Can you try building the integration branch, it is using protobuf-29.0-rc1 and I believe I also might have resolved some dependency ordering between absl and protobuf that might also be part of your problem.

Let me know what you try and how it goes, we’ll get you building, don’t worry!

Thank you very much for your reply and reassurance! After some attempts, such as manually adding ‘abs_DIR’ to ios.toolchain.cmake, I’m now able to compile protobuf, but it reports another error if I continue, and it feels like I’m going to crash! The error is something like the following:

-- Autogenerated code root : /Volumes/HiWill_Work/Pulse/builds/Innerbuild/src
-- !! NOT generating bindings !!!
-- Copying binding directory from /Volumes/HiWill_Work/Pulse/builds/Innerbuild/src/cpp/pulse
--  to /Volumes/HiWill_Work/Pulse/builds/Innerbuild/src/cpp
-- Configuring Pulse
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Configuring PulseTests
-- Configuring PulseC
-- Looking for zip shas
-- Found Git: /Applications/Xcode.app/Contents/Developer/usr/bin/git (found version "2.39.5 (Apple Git-154)")
-- Configuring done (7.5s)
CMake Error at cmake/utilities/AddLibrary.cmake:78 (add_library):
  Cannot find source file:

  /Volumes/HiWill_Work/Pulse/builds/Innerbuild/src/cpp/pulse/cdm/bind/Actions.pb.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
  .f95 .f03 .hip .ispc
Call Stack (most recent call first):
  src/cpp/CMakeLists.txt:10 (add_library_ex)


CMake Error at cmake/utilities/AddLibrary.cmake:78 (add_library):
  No SOURCES given to target: Pulse
Call Stack (most recent call first):
  src/cpp/CMakeLists.txt:10 (add_library_ex)


CMake Generate step failed.  Build files cannot be regenerated correctly.
Command PhaseScriptExecution failed with a nonzero exit code

I’ve had a look and no files exist under “/Volumes/HiWill_Work/Pulse/builds/Innerbuild/src/cpp/pulse/”.

Here is the full log, check it out if you want!

It feels like some progress from before, thank you very much for your help.

This is from an issue from step 1 in the the iOS build instructions

Did you build Pulse on your system already?

It looks like you set the Pulse_NATIVE_BUILD_DIR to the same directory you are building for iOS?

You need to build Pulse locally (not a cross compile build) before building for iOS in xcode

Then set Pulse_NATIVE_BUILD_DIR to that native local build directory, then run cmake to build xcode / iOS to a different build directory

It looks like its trying to copy files from:
Copying binding directory from /Volumes/HiWill_Work/Pulse/builds/Innerbuild/src/cpp/pulse
– to /Volumes/HiWill_Work/Pulse/builds/Innerbuild/src/cpp

Oh, I kinda get it, I need to compile Pulse on a Mac platform (say under Pulse/mbuilds), and after that, I specify Pulse_NATIVE_BUILD_DIR as Pulse/mbuilds just now, right?

Thank you very much for your reply, I would like to ask if there is a more detailed tutorial on iOS compilation here? Or are there any tutorials on how to do it, like on youtube or something?

Hi, thank you very much, after some painful struggles and efforts now it seems to compile successfully, but some of the compiled files can’t be corresponded with the officially provided files, and there is a big gap between the file sizes, I don’t know if there is still a problem somewhere, anyway, there is some progress, thank you very much for your reply and support.

Here are all the compiled files, they are located under /builds/install/lib/, are these all the static libraries I need for the iOS platform? I found some files missing, such as CommonDataModel.a, DataModelBindings.a. Where can I find the documentation that explains exactly what libraries are needed for iOS platforms, right now I seem to be able to only compare against the official /Plugins/iOS files and come to some conclusions!



You did it!
absl creates a ridiculous number of libraries, a library file for each individual functional feature they provide.
I have not gone through to see which of all of those libraries protobuf actually uses, so I would use them all for now.

You only need the libPulseC and libPulse libraries (CommonDataModel and DataModelBindings are in libPulse now). But since the libraries have the d suffix, you have built Pulse in XCode as debug libraries, which make the huge and slow. For whatever reason, the Run build configuration is default, and builds debug libraries. So change your build scheme to either Profile or edit a scheme to build in release.

The only thing left to do after that is to copy the states and other data files generated in your native build to the Unity Asset

Thank you very much for the tip, I changed the scheme to release using Xcode and sure enough everything looks fine. Then, when I compiled it again, I got some nice results, thank you very much!

There were a few twists and turns in the compilation process, such as when protobuf would tell me that it didn’t contain a valid bundle identifier, so I had to manually open up the Xcode project for protobuf and manually change some of it’s settings in order for the compilation to complete. I’m wondering if there is a cmake file I can modify to set the bundle identifier, but I don’t know which cmake file to modify, or if I should leave that to the official protobuf maintainers.

And the problem at the beginning, I couldn’t find some configuration cmake files in absl_DIR during compilation, I had to modify ios.toolchain.cmake to add them manually after compilation failed, like this set(absl_DIR “/Users/william/Projects/Pulse/rebuilds/install/lib/cmake/absl"). Is it possible that I can also modify some cmake files so that it doesn’t make a mistake at the beginning, finds the absl_DIR file and executes without any problems?

I don’t know much about cmake, but I think some of the ideas are right, I just don’t know how to do it, if you can provide more help that would be great, thanks again for your help!

Lastly, I have a question for you, have you compiled the Pulse iOS static library lately, and have you encountered any problems with it? I’m really looking forward to seeing you compile it yourself, that would be very helpful in solving some of the problems.


I will look into the bundle identifier, can you show me what you set that configuration page to?
I think that might be needed now on the silicon chips…I have not needed that when building on intel based macs. I will research how to do that in CMake, I am pretty sure you can…

Did you build the integration branch?
That should have fixed the absl_DIR, but I will run the build again on integration.
I plan on merging integration into stable this week or next.

I will build Pulse iOS tonight or tomorrow on both an intel and a silicon based macos and report back

Thanks for all your hardwork in this, and the great feedback!

Wow, very much looking forward to the compilation results and the sharing of the compilation process. I’m still using stable branching, and I’ve tried using intergation branching and it really doesn’t report the absl_DIR error anymore. I changed the Team and bundle identifier to something real and valid so that the protobuf compiles without errors.

I pushed some updates to the integration branch.

The bundle issues were due to the protobuf build building a C library and executable.
Any executable is going to need a bundle id when cross compiling
We don’t need that C library, so I just disabled it in our build.

I was able to execute the iOS build on my intel based mac

All you need to do is run CMake to generate a makefile/ninja file for a native build of pulse
Execute that build
Then run CMake to generate an xcode project with the Specify a toolchain file for cross-compiling option using the ios toolchain file in the cmake directory, and then setting the Pulse_NATIVE_BUILD_DIR to the native build directory you created
Then open the xcode project and build the project for Profiling to start a Release build

I will need to double check this process on a silicon machine this week, but hopefully there are no gotcha’s on that platform…

Let me know if you are able to build the iOS libraries

Thanks for all your hard work lately, I tried to compile on my MacStudio with M2 Max using the latest integration branching and it went very well, it compiled without a single problem in between, thank you very much!