rive-runtime icon indicating copy to clipboard operation
rive-runtime copied to clipboard

Incomplete instructions and build issues

Open Simran-B opened this issue 1 year ago • 9 comments

Trying to compile following the README.md, I can into the following problems:

  • The git clone command shows the use of the SSH protocol. This results in a [email protected]: permission denied (publickey) error for me. Using git clone https://github.com/rive-app/rive-renderer works.
  • Using git clone --resurve-submodules https://... fails with the same error. Changing .gitmodules to url = https://github.com/rive-app/rive-cpp.git and then running git submodule update --init --recursive helped.
  • The Build GLFW step requires CMake. A standard Xcode installation does not come with a bundled CMake (at least not in v12.4), it needs to be installed separately and added to the PATH to avoid ./make_glfw.sh: line 24: cmake: command not found
  • The Call Premake & Build step doesn't mention at what path to run the commands. It can be deduced that it must be the rive-renderer folder, though.
  • Running the ... premake5 gmake2 ... command fails with Error: ...renderer/submodules/rive-cpp/build/rive_build_config.lua:323: attempts to concatenate a nil value (global 'iphoneos_sysroot'). I'm not familiar enough with Lua/premake but it seems strange that the code where the concatenation happens is executed despite filter({ 'system:ios', ... }). I worked around the problem by adding or '' in build/rive_build_config.lua where the sysroot variables are set.
  • path_fiddle is in the rive_renderer folder, not in out/release.
  • The metal utility is required, which means you need a full Xcode installation, not only the Command Line Tools for Xcode. I can't install Xcode on the device in question and I'm not even sure if the latest available Xcode for the outdated platform includes the metal utility so I cannot check for more issues with the compilation.

The system I tried the above on was a MacBook Air from 2014 running Catalina, Intel CPU. This may not be a representative device but I think all of the above papercuts equally apply to newer devices and OS versions.


On Windows, the first two bullet points apply as well. Other issues I encountered:

  • To run make make_glfw.sh, you can use Git Bash. But it doesn't have the touch command which is used in renderer/shaders/Makefile. I substituted @touch $(MINIFY_STAMP) with echo "" > $(MINIFY_STAMP).
  • The premake command needs to be different to use the Microsoft toolchain. The environment variable needs to be set differently - I used $Env:PREMAKE_PATH="C:/<some-path>/submodules/rive-cpp/build" in PowerShell. The generator needs to be set according to the installed Visual Studio version, e.g. premake5 vs2019 --toolset msc ... instead of premake gmake2 ....
  • There were issues with the path_fiddle target that I worked around by setting the C++ standard to C++20 and disabling to treat warnings as errors (/WX-) in Visual Studio for the rive.sln. Using vcvars64.bat, everything compiled successfully with msbuild .\rive.sln and the path_fiddle.exe works.

I'd appreciate it if you could share the commands you use to compile for Windows. Do you use MinGW?

Simran-B avatar Apr 02 '24 13:04 Simran-B

@Simran-B, I have used the commands below to successfully compile rive-renderer on Windows using Git Bash (after installing premake5 and the python library). Once the rive-renderer and submodules are cloned, right click in the folder and use Git Bash Here, then run the following commands:

premake5 --scripts=submodules/rive-cpp/build --with_rive_text --config=release vs2022
## Then we need to build glfw
cd submodules/rive-cpp/skia/dependencies
sh make_glfw.sh
cd ../../../..
## might need to run the premake command again

You should then have a new folder out/release/ with a solution file rive.sln. Running path fiddle from VS works for me

Voulz avatar Apr 09 '24 13:04 Voulz

It's possible that the C++20 issues are fixed in VS2022, I only have VS2019 installed at the moment and therefore only tried this version. Not sure about the touch command, it does appear to be available in Git Bash, but I definitely got an error saying that it is not available when it got called from the script. Maybe it's one of these odd shell script errors that are caused by Windows line endings (Git core.autocrlf true) - this does occasionally lead to strange errors like "... command not found" despite the command existing.

I did manage to compile Rive on Windows with my workarounds already but thanks for sharing what works for you!

Simran-B avatar Apr 09 '24 22:04 Simran-B

  • Running the ... premake5 gmake2 ... command fails with Error: ...renderer/submodules/rive-cpp/build/rive_build_config.lua:323: attempts to concatenate a nil value (global 'iphoneos_sysroot'). I'm not familiar enough with Lua/premake but it seems strange that the code where the concatenation happens is executed despite filter({ 'system:ios', ... }). I worked around the problem by adding or '' in build/rive_build_config.lua where the sysroot variables are set.

for the convenience of anyone potentially came into the same issue when trying to build river-renderer on Mac, I managed to solve this issue by installing XCode and then ran this command the shell:

sudo xcode-select --switch /Applications/Xcode.app;

It makes sure that the two variables get the value properly in the lua script:

iphoneos_sysroot = os.outputof('xcrun --sdk iphoneos --show-sdk-path')
iphonesimulator_sysroot = os.outputof('xcrun --sdk iphonesimulator --show-sdk-path')

MickeyMiao7 avatar Apr 28 '24 09:04 MickeyMiao7

I was able to build on windows by running /rive/build/build_rive.sh using git bash.

However, I first had to add the line: require("rive_build_config") in the file premake5.lua, BELOW require('setup_compiler'). I'm not sure why this was not included, but that solved it for me.

Also had to install clang compiler and LLVM for msvc https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170

error that msbuild.exe was not found is solved by adding the Path environment variable, in my case: C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin

I also had to install Make: https://gnuwin32.sourceforge.net/packages/make.htm

I also found the generated vs project in release mode generates both DEBUG and NDEBUG preprocessor definitions causing build errors. In order to build, I just removed DEBUG in the vs project's release configuration manually, but this should be solved in the premake file.

AnimatorJeroen avatar Mar 12 '25 10:03 AnimatorJeroen

Adding to the discussion:

I tried building Rive for Windows Desktop using Visual Studio 2022 with the Clang++ compiler. The following steps worked for me, but please note the few changes I had to make in order to compile rive successfully:

  1. Check out the rive repository, then browse to the ./build folder and open Git Bash there.
  2. Run ./build_rive.bat from the Git Bash command line. This will download the dependencies and compile them.
  3. The premake5 command will probably not work and trigger an "Error: invalid option 'config'" or "Error: invalid option 'out'".
  4. Assuming premake5 was built correctly in step 2, it can be found here: ./dependencies/premake-core/bin/release/premake5.exe.
  5. Run the following call from the Git Bash command line: ./dependencies/premake-core/bin/release/premake5.exe vs2022 --with_rive_text --with_rive_layout
  6. A rive.sln and rive.vcxproj file can now be found in your ./build folder.
  7. ~~Open the rive.vcxproj file in a text editor, look for the Wno-atomic-alignment option and remove it, as this is a Clang++ only option.~~
  8. Open the rive.vcxproj file in Visual Studio, make sure the "Runtime Library" is set to "Multi-threaded Debug (/MTd)" for all projects in the Debug target and compile both the Debug and Release targets.

I have been able to use the resulting rive.lib libraries to create a static library of my own, but so far I have not been able to compile an executable with it (due to an "unresolved external __std_search_1" error), so take my instructions with a grain of salt.

My hope is that by sharing my build experience on Windows, the Rive team may be able to adapt or slightly change the build scripts to counter the issues. And while a GitHub issue may not be meant to incite a long discussion about what works or not, I personally would love to hear other people's progress on building Rive for different platforms, most notably Windows Desktop.

paulhoux avatar Mar 18 '25 11:03 paulhoux

There is a very useful repo called yup, a cross-platform application library that implements the rive-renderer. It compiles using cmake. https://github.com/kunitoki/yup

AnimatorJeroen avatar Mar 20 '25 23:03 AnimatorJeroen

Thanks, Jeroen,

I was able to get most Rive files working after replicating some of the code in yup_Artboard.cpp. Very excited to have basic support for Rive files in our front-end now.

paulhoux avatar Mar 25 '25 09:03 paulhoux

Has anybody been able to get renderer on windows compiling? Stuck at shader compiler step.

make -C D:/Dev/2025/rive-runtime/renderer/src/shaders -j12 OUT=D:/Dev/2025/rive-runtime/renderer/out/debug/include/generated/shaders FLAGS="-p D:/Dev/2025/rive-runtime/renderer/dependencies/D2F85D165/ply-5c4dc94d4c6d059ec127ee1493c735963a5d2645/src" d3d
make: Entering directory 'D:/Dev/2025/rive-runtime/renderer/src/shaders'
The syntax of the command is incorrect.
make: *** [Makefile:249: D:/Dev/2025/rive-runtime/renderer/out/debug/include/generated/shaders/d3d/root.sig.h] Error 1
make: Leaving directory 'D:/Dev/2025/rive-runtime/renderer/src/shaders'
Error: D:/Dev/2025/rive-runtime/renderer/premake5_pls_renderer.lua:138:
Error executing command:
  make -C D:/Dev/2025/rive-runtime/renderer/src/shaders -j12 OUT=D:/Dev/2025/rive-runtime/renderer/out/debug/include/generated/shaders FLAGS="-p D:/Dev/2025/rive-runtime/renderer/dependencies/D2F85D165/ply-5c4dc94d4c6d059ec127ee1493c735963a5d2645/src" d3d

gerdus avatar May 11 '25 11:05 gerdus