2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2023-11-17 08:09 AM
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-30 08:59 AM
Hi,
#define std::realloc(p, s) GS_realloc(p, s) <--- is not defining a valid macro name, because of the '::'.
Sorry, missed out the notes on the github repo page.
Thanks again for the suggestions and help!
2023-11-30 09:36 AM
Ah yeah, you're right, that won't work then.
I just thought maybe also the include order might make a difference.
So maybe including iostream before any Archicad API include could work (also make sure it's before the includes you have in associated header files of .cpp files).
But I'm not sure if there would be an effect if parts of the code use different memory allocators then.
2023-11-30 10:04 AM
Maybe including iostream before AC headers could have a different behaviour.
Anyway, I don't really need iostream here. So it's no problem for now 🙂
2024-03-24
10:08 PM
- last edited on
2024-03-26
03:11 AM
by
Laszlo Nagy
Hi,
I may have found a workaround for the issue. I am new to Macs and a beginner at C++ so take it with a grain of salt.
As usual, all works fine on Windows.
What I did was #undefine the malloc functions right before #include-ing an std libraries. This seems to solve the issue of duplicated / overwritten defines, like in the example bellow:
// Archicad 27 API Includes
#include "ACAPinc.h"
#include "APICommon.hpp"
#include "APIEnvir.h"
#include "DGModule.hpp"
#include "DGBrowser.hpp"
// these define the GS_realloc and so on
// Undefine macros that cause issues (potential fix)
#undef calloc
#undef malloc
#undef free
#undef realloc
// Include standard or third-party headers that need the original memory functions
#include <string>
#include <cstring>
#include <vector>
#include <ctime>
#include <unordered_map>
I don't know if it's correct, but at least it compiled with no error.
For now I'm using the 14.2 sdk, that comes with Xcode.
Regarding the minimum 10.15 version, I managed to set it up via CMake, using the base template from GitHub, but I don't think it had any effect on the issue above.
In BuilAddOn.py:
def GetProjectGenerationParams (workspaceRootFolder, buildPath, addOnName, platformName, devKitFolder, version, languageCode, additionalParams):
...
if platformName == 'WIN':
...
elif platformName == 'MAC':
projGenParams.extend (['-G', 'Xcode'])
# Ensure the deployment target is macOS 10.15
projGenParams.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15')
If you find an actual fix, please let me know!
Thanks!
2024-03-25 07:42 AM - edited 2024-03-25 08:30 AM
This issue occurs because there was a change in the latest Xcode SDK that is not compatible with the Development Kit. Although earlier it was possible to always use the latest Xcode, unfortunately it's not the case anymore.
Hopefully there will be a solution for this in the future, but in the meantime please make sure that you are using Xcode 14.2 for compilation. The tricky part here is that it's not very straightforward to install an earlier version of Xcode, but it's possible by following the steps below.
sudo xcode-select -s /Applications/Xcode_14.2.app
After this change everything should compile without any issues.
2024-04-04 03:49 PM
I figured out a very dumb solution that worked for me.
I noticed that the MacOSX14.sdk is just a shortcut that points to MacOSX.sdk
I simply duplicated and renamed the shortcut to MacOSX14.0.sdk (with the explicit) .0 so the compiler sees the path and the build works.
2024-05-13 12:40 PM
Hi Victor! Any news on an update? Xcode 14.2 is not compatible with macOS Sonoma thus this workaround won't work with new Macs.
2024-05-14 01:58 PM
There is a name clash between the STL and the Archicad SDK, but it can be avoided. The compiler is currently seeing the GS version first, which is shadowing std::realloc - hence the compiler suggestion that this is what you mean.
I recommend ordering your header file includes so all STL headers are read first, followed by any Archicad SDK header includes.
2024-05-17 02:29 PM
I had a new update on my (old) mac and reordering seems to have done the trick this time. If I find any more details I will let you know.
By the way, I have Xcode 15.2 on Ventura 13.6.7.
2024-07-10 12:28 PM - edited 2024-07-10 12:46 PM
I faced the same issue on MacOS (Intel chip) Ventura 13.5