2023-11-17 08:09 AM - last edited on 2024-09-17 01:22 PM by Doreena Deng
Hi,
I'm getting a compile error on Mac:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/locale:2827:22: no member named 'GS_realloc' in namespace 'std'; did you mean simply 'GS_realloc'?
_Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
The same code compiles fine with MSVC on windows.
Anyone faced this error?
Thanks.
2023-11-23 09:00 PM
Hi,
That's a weird error and I haven't experienced it myself.
But a different thing I noticed is, that you are using the MacOSx14.0 devkit. I would try to use the same as the recommended deployment target. So that's 10.15 for AC25+.
It's a bit tough to get older macOS devkits installed. I think I got them from here: https://github.com/phracker/MacOSX-SDKs
but proceed at your own risk ^^
Hope that helps,
Bernd
2023-11-24 06:27 AM - edited 2023-11-24 06:28 AM
Hi Bernd,
Thanks for your reply. I'm building for AC27. Where do you find which version no. is the recommended for it?
2023-11-24 07:03 AM
I thought there was a mention of it somewhere in the API docu or at the site of the SDK downloads. But now I can't find it anymore.
But you can find the LSMinimumSystemVersion for the libraries in the AC API SDK or also for the Archicad main app on macOS. This is one entry in the Info.plist files. For AC27 all of these say "10.15.0". Here's the main one on my machine:
/Applications/GRAPHISOFT/Archicad 27/Archicad 27.app/Contents/Info.plist
2023-11-24 09:08 AM
Okay, that's the same for me (10.15.0). I tried with MacOSX10.15.sdk and the project failed to configure.
-- The CXX compiler identification is unknown
In CMakeLists.txt: set(CMAKE_OSX_SYSROOT "/path/to/MacOSX-SDKs/MacOSX10.15.sdk")
Btw, could this lead to compatibility issues with higher versions of MacOS when distributed?
2023-11-24 11:03 AM
I think the main issue could be, that your XCode version is not compatible with the SDK.
You could try changing the MinimumSDKVersion
version to 10.15 there as well:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist
This fixed it for me IIRC and I'm running XCode 14.1. For editing the plist file you can use e.g. the command line utility "plutil" and convert to xml first and then back to binary. Also make a backup of this Info.plist in case anything goes wrong.
Sorry if all of this is vague. It's been a while since I've last done this and my notes on it are a bit scattered.
Also you might need to adapt the Info.plist in your builds of the Add-On itself to match.
About compatibility: I can't say for sure, but I'm not too worried about it myself, since GS distributes AC with this exact same MinimumSystemVersion.
Best,
Bernd
2023-11-25 08:01 AM - edited 2023-11-25 08:17 AM
Hi,
I changed the MinimumSDKVersion to 10.15 in XCode's Info.plist.
I moved the MacOSX10.15.sdk dir to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
passed the option to CMake to use MacOSX10.15.sdk, but it doesn't seem to look there for it.
Are you working in the XCode IDE itself? How do you set it to use any particular SDK? Do you use CMake?
Update: I made CMake to use the specific SDK but it fails to generate the project with it..
2023-11-26 12:12 PM
OK, so good news and bad news:
#define realloc(p, s) GS_realloc(p, s)
And the combination explains the issue, since GS_realloc really isn't in the std namespace. And switching the MacOSX SDK to an older version should really help.What's your error in cmake during the build generation now?
2023-11-26 01:49 PM
Hi,
Thanks for the info.
I discovered that the error occurs when I include <iostream> library. So it could be related to the std namespace somehow (though I don't have any components in use from the library, and I could disable it).
I tried:
#define realloc(p, s) GS_realloc(p, s)
That didn't help.
CMake just fails to identify the manually supplied MacOSX SDK as a valid one. I tried with a custom path and also by placing the SDK in the same place as the main SDK in XCode: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
It fails in both cases. I removed the SDKs so I don't have the actual error messages to quote.
How do you supply the custom SDK to your CMake? Are you using CMake within the XCode IDE?
Anyway it seems I can get around this error by just avoiding the iostream library and use the latest SDK (v14) from XCode.
Thanks for the help and the info.
2023-11-30 08:26 AM
Good to hear that you found a way to get around the error!
Supplying another line of
#define realloc(p, s) GS_realloc(p, s)
won't help, since it's already defined like this anyway.
I suggested to try the following (note the extra std:: in front of realloc😞
#define std::realloc(p, s) GS_realloc(p, s)
On Mac I'm using CMake sometimes with XCode and sometimes with Visual Studio Code.
About switching the macOS SDK, there are some hints in the readme on the github repo I provided above: https://github.com/phracker/MacOSX-SDKs
But I haven't tested it.