Xcode not compiling
calm-rad opened this issue · comments
Thanks so much for all the work you put into this library! I've been trying to get sodium-native to work on nodejs-mobile for a while now.
I'm currently running into a compile error when I try to run my app on Xcode, and I suspect it has to do with a difference in development environment.
Could you tell me a few details about the setup you used to build this:
-Version of MacOS (I'm on MacOS Catalina 10.15.3)
-Version of Xcode (I've tried 11.3.1 and 10.3 with the same results)
-Version of Xcode Command Line Tools (I've tried 11.3.1 and 10.3 with the same results)
-Did you have any environment issues that you needed to make adjustments for?
I want to figure out what this build issue is and document it so hopefully it's easy for anyone else to get this set up with ease.
Hi! I can't answer your specific questions right at this moment, I'll check that later, but in the meanwhile take a look how I use sodium-native-nodejs-mobile in my project Manyverse:
Those links are very helpful! I'm going to try a similar approach as your bundle-noderify.sh
script in case that contains the solution I need.
I was able to find instructions for running the Android scripts here:
But I'm not sure what to do for iOS in debug mode. Do you run npm run build-backend-ios
and then npm start
without opening Xcode?
@calm-rad I usually build from Xcode, but yes the sequence is npm run build-backend-ios
and then build the frontend, either through npm start
+ react-native run-ios
or through Xcode
I set up a similar script approach with my project, but the compile failure still persists. Noderify is nice though, so I'm glad I did it anyway haha.
I also tried to see if I could successfully build Manyverse in Xcode, and there's an interesting difference: It seems to produce the same compile errors, but keeps building anyway, succeeds, and installs on my device.
This makes me think there's some difference in how my project is configured, but I'm not sure what.
I tried some things that I noticed in Manyverse:
- Adding the
nodejs-mobile-react-native+0.5.0.patch
patch and applying it withpatch-package
- Linking
JavaScriptCore.framework
in Xcode - Adding the
Pre-minify Node.js Mobile project
andPost-minify Node.js Mobile project
run script phases in Xcode's Build Phases
Unfortunately none of these fixed the compile failure. But I have some more questions about how it looks in your environment that might bring some clarity:
- Do you get the
C Compiler cannot create executables
error when you build with Xcode? That's the error that I also get when I build Manyverse (even when it succeeds), but I want to see if that's a problem with my dev environment. - Are there any other changes that you recall making to Manyverse's iOS project that may be related to this?
- I noticed a difference in my project is
Checking whether C compiler works...
returns a no, while it returns a yes in Manyverse. That sounds related to the problem, but I don't know what would cause that. Any ideas why that may be?
Good news, I got the application to build! It turns out one of the modules I'm using had sodium-native
as a required dependency, so I had both sodium-native
and sodium-native-nodejs-mobile
in my nod_modules
. So all I had to do is remove sodium-native
and it builds now. I'm kicking myself for not noticing that lol
I still haven't gotten to test for any issues during runtime (I need to resolve some syntax issues with another library on nodejs-mobile first), but compiling is no longer an issue
I'm also still curious if the C Compiler cannot create executables
error is normal and if I should just ignore it
Hello again! I got through the other errors, and it looks like everything is working! Thanks for your help and for putting together this library :)