rive-app / rive-runtime

Low-level C++ Rive runtime and renderer
MIT License
655 stars 36 forks source link

Incomplete instructions and build issues #7

Open Simran-B opened 7 months ago

Simran-B commented 7 months ago

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

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:

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

Voulz commented 7 months ago

@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

Simran-B commented 7 months ago

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!

MickeyMiao7 commented 6 months ago
  • 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')