Actually as a little aside to this. Wont forcing C++ 11 onto the native extensions make the extensions much harder to have cross platform support.
There are a number of C++ 11 libs I remember having problems across platforms. Ie, sort of feels like it defeats the general purpose of common native extensions? Dunno.
I know ANSI C is generally used for this reason. Would be interested in what the native extension development path is, it will probably impact a fair amount of different tools and addons for me going forward.
Correct, the ticket #3743 is still not done. And while it isnāt perhaps convenient to prebuild libraries, it is certainly possible.
Adding pure C support is still on our radar, but it hasnāt been prioritized (a workaround exists). As for an ETA, I cannot give one Iām afraid.
Wont forcing C++ 11 onto the native extensions make the extensions much harder to have cross platform support.
I agree, forcing a C++ version isnāt something we recommend. And we donāt do it on the server.
Some particular extensions might need it, since 1) they were written when the default compiler version (for a platform) was lower than C++11, or 2) they use C++ 11 features.
We generally recommend avoiding āModern C++ā and the ABI compatabilities are one reason for this. You can read more about our best practices here.
Thanks for the response. The main prob Im having with prebuilding libs, is my Mac Mini died so I kinda lose ability to build IOS and OSX atm (my prob I know )
About the command line options though - whats the reason behind this not working? Locally it does and tested on the online tool here: https://godbolt.org/ with clang 13.0.1 so Im a little puzzled. Is your clang modified or options in the script that discard -std=c99 ?
Not sure. What is the error you get? For which platform?
The command lines are specified here
What does your log.txt say?
Also note that if youāre building for Darwin, youāre using Apple Clang.
You could build the tools using GitHub Actions and store the build artifact so that you can download it.
Something like this: https://github.com/britzl/lua5.1.5/blob/main/.github/workflows/build.yml
Ooh. I havent used cross platform github building. Thanks @britzl, that might be the simplest way forward for me (I did purchase another Mac Mini yesterday but I think itāll be a couple of weeks before I get it).
Thanks for the tip.
@Mathias_Westerdahl - I was getting:
/sqlite/ext.manifest
error: invalid argument '-std=c99' not allowed with 'C++'
Platform: Linux X64 - Debian 11.
And Im not sure it got far enough to spit out a log.txt - theres nothing in the build folder (odd?).
Oh. Should note this is with Steam version if that matters. Will try it with local Defold version, see if there is any difference.
Like I mentioned, we donāt specify any version. Thatās for you, the developer to do when writing an extension. Or you can add it in the .appmanifest.
Since we use C++ (Apple Clang++, as mentioned before), your flag ā-std=c99ā isnāt accepted.
What if you remove your ā-std=c99ā from your ext.manifest file?
What error do you get then?
I think Im not understanding something. I put this flag in the manifest (have used compiler and link flag previously to resolve ANSI C build issues with the compiler). And thats the error I get when I try to built the native extension for linux.
Do you mean the Apple Clang++ is used for this build type? Which I guess would make sense why Im getting the errors. If I remove the options, I get hundreds of ANSI C errors. Usually cast problems, sometimes they are incomplete struct problems and so on. I started working on sqlite3 amalg C but it looks like to get it to compile to C++ would take a big amount of changes to the code - which I dont really want to do. And they use quite strict ANSI C (for wide cross platform).
I have OSX and Linux building now with github workflows (thanks guys). Iāll hopefully get the Windows, android and IOS working (if possible) and see how that goes. Its definitely a nice workaround.
We build macOS/iOS on a macOS build machine, and yes, it runs vanilla Apple Clang++.
Ahh ok. Soz. I get it now. Probably better to have a local server or a diff build server for the native-extensions etc. Thanks for the help. Turns out the github workflow has worked really well - have three sqlite3 artefacts (currently shell exes - should be easy enough to turn into libs).
Thanks for @britzl and @Mathias_Westerdahl help - really appreciate it.
For ref heres the repo with the simple workflow (no makefiles).
Might help others if they want to build libs/obj for use in a native extension.
< update > I have three static libs getting built now. Its great!!
this is also helpful post for me, thank you for sharing with us