jsc-android-buildscripts icon indicating copy to clipboard operation
jsc-android-buildscripts copied to clipboard

Building out on macOS 10.14.3 -> CMake was unable to find a build program corresponding to "Ninja"

Open AustinHunt opened this issue 5 years ago • 9 comments

Issue Description

When attempting to build the project, I run into this error. I have the ninja package installed, cmake, and all the rest installed. They all are available on my $PATH as well. Any help would be greatly appreciated.

Also, how do you choose which version of the jsc-android library to build? Where is that config? For instance, if I want to build this un-merged branch: https://github.com/facebook/android-jsc/pull/19

AustinHunt avatar Mar 09 '19 00:03 AustinHunt

@AustinHunt any luck solving the issue. Been trying to get around it for a while but no luck 😕

eacolina avatar Mar 26 '19 00:03 eacolina

The latest RN seems to have updated the Android JSC...haven’t tested or played with this build since I made the issue.

AustinHunt avatar Mar 26 '19 03:03 AustinHunt

I got it to build, but took me quite long time from last commit. Here is things I did:

  1. jsc.sh needs to be changed: from ARCH_NAME_PLATFORM_arm="arm" to ARCH_NAME_PLATFORM_arm="armv5te"

There is no "arm" target in CMAKE Android-DeterminePlatform.cmake, so it can't really succeed.

  1. get rid of following flags in jsc.sh:
  -DCMAKE_C_COMPILER=$CROSS_COMPILE_PLATFORM-clang \
  -DCMAKE_CXX_COMPILER=$CROSS_COMPILE_PLATFORM-clang \

Setting C_COMPILER AND CXX_COMPILER flags is not recommended, there will be caching and infinite loop issues. Better is to export the variables CC and CXX. For me the current approach didn't work, as CMAKE seemed to restart itself because it changed CXX_COMPILER at some point, and had to refresh the task, losing some vairables in the process (such as PORT).

plus make sure there are no empty lines when you remove these two lines.

  1. add following exports before calling build-webkit in jsc.sh
export CC=$CROSS_COMPILE_PLATFORM-clang
export CXX=$CROSS_COMPILE_PLATFORM-clang
  1. enable SYSTEM_MALLOC in jsc.sh

For some reasons, I could not for the life of myself figure out what's wrong with that option, but read about it in the internet and see if you're happy.

  -DUSE_SYSTEM_MALLOC=ON \

I am probably not going to do pull request because I know too little how things are supposed to work, but I got it to build on OSX and they actually work when using react-native on phones.

chr4ss1 avatar Jun 27 '19 10:06 chr4ss1

BTW, which NDK version do you use to build? Current supported NDK to build is r17c.

Kudo avatar Jun 27 '19 10:06 Kudo

I use r17c, did everything according to instructions

chr4ss1 avatar Jun 27 '19 10:06 chr4ss1

Well, still have no idea for the reason of build failure. I always to use a mac 10.14 to build and not getting problems. Maybe cmake version ? That is 3.13.4 from my env.

Kudo avatar Jun 27 '19 11:06 Kudo

Interesting, I've got:

MacOS 10.14.5 Cmake 3.7.2

XCode 10.2.1

Maybe it indeed could be CMAKE version, for now, I don't need to compile this project anymore as I finally got your jsc-android@245459-fix-clear-cache-no-dfg fix working.

chr4ss1 avatar Jun 27 '19 12:06 chr4ss1

I got it to build, but took me quite long time from last commit. Here is things I did:

  1. jsc.sh needs to be changed: from ARCH_NAME_PLATFORM_arm="arm" to ARCH_NAME_PLATFORM_arm="armv5te"

There is no "arm" target in CMAKE Android-DeterminePlatform.cmake, so it can't really succeed.

  1. get rid of following flags in jsc.sh:
  -DCMAKE_C_COMPILER=$CROSS_COMPILE_PLATFORM-clang \
  -DCMAKE_CXX_COMPILER=$CROSS_COMPILE_PLATFORM-clang \

Setting C_COMPILER AND CXX_COMPILER flags is not recommended, there will be caching and infinite loop issues. Better is to export the variables CC and CXX. For me the current approach didn't work, as CMAKE seemed to restart itself because it changed CXX_COMPILER at some point, and had to refresh the task, losing some vairables in the process (such as PORT).

plus make sure there are no empty lines when you remove these two lines.

  1. add following exports before calling build-webkit in jsc.sh
export CC=$CROSS_COMPILE_PLATFORM-clang
export CXX=$CROSS_COMPILE_PLATFORM-clang
  1. enable SYSTEM_MALLOC in jsc.sh

For some reasons, I could not for the life of myself figure out what's wrong with that option, but read about it in the internet and see if you're happy.

  -DUSE_SYSTEM_MALLOC=ON \

I am probably not going to do pull request because I know too little how things are supposed to work, but I got it to build on OSX and they actually work when using react-native on phones.

This was the only way I was able to successfully compile on Ubuntu 18.04 (cmake 3.10.2, ndk r17c).

I've been bumping my head about this whole day, so I would be very grateful if someone more experienced would review those proposed changes and comment if they are production ready.

lazar-mitrovic avatar Nov 26 '19 22:11 lazar-mitrovic

Downgrading CMAKE to version 3.6 as described here (https://github.com/react-native-community/jsc-android-buildscripts/issues/87#issuecomment-494660883) fixed this build issue for me on MacOS.

newyankeecodeshop avatar Jan 30 '20 17:01 newyankeecodeshop