- You can check and update the version of Xcode installed on your system.You may check if you have the necessary SDKs installed in Xcode. In this case, you need to have the MacOSX SDK installed. Open Xcode, go to Preferences, select the Locations tab, and ensure that the Command Line Tools and SDKs are properly set up.
- You can also check that the include path in the MATLAB environment is correctly configured to point to the cstdlib header file you mentioned: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
- If the error still persists you may try to update or reinstall the C++ Standard Library for your Xcode installation. You can do this by using the Xcode package manager, such as Homebrew, to update the C++ Standard Library.
clibgen.generateLibraryDefinition error: the global scope has no "quick_exit" on Mac M2
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Darral Freund
am 28 Aug. 2023
Beantwortet: Adrian
am 18 Jul. 2024
The routine clibgen.generateLibraryDefiniton generates errors when trying to process one or more header files identified in the include path.
I’m running Matlab version R2023b, Prerelease Update 3 for ARM Macs. I’m using a MacBook Pro, with an Apple M2 Max running Ventura 13.4.1.
For each header file, the processor doesn’t like two lines in the file, “cstdlib”,” which on my machine is located at:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
The errors are:
Errors parsing interface generation files.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib(135):
error: the global scope has no "at_quick_exit"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib(136):
error: the global scope has no "quick_exit"
The lines of code in the cstdlib that seem to be causing the problem are:
#if !defined(_LIBCPP_CXX03_LANG)
using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;
using ::quick_exit _LIBCPP_USING_IF_EXISTS;
#endif
In this case I was attempting to build an interface for libraw, version 0.21, which I have build and used on my system in C++ code and in Mex files using the new API. But the same problem occurs no matter what library I try to process.
Any suggestions on what to do would be greatly appreciated.
0 Kommentare
Akzeptierte Antwort
Maneet Kaur Bagga
am 5 Sep. 2023
As per my understanding of the error message mentioned above:
using ::at_quick_exit _LIBCPP_USING_IF_EXISTS - This line introduces the at_quick_exit function from the global scope into the current namespace. The _LIBCPP_USING_IF_EXISTS macro is used to conditionally include this line only if the at_quick_exit function exists. Similarly it is implemented for the quick_exit function.
The error message suggests that the global scope does not have the functions at_quick_exit and quick_exit which is causing the parsing error.
Here are some of the troubleshooting steps you can follow to resolve the error:
For more information refer to the following MATLAB Documentation.
Steps to Publish a MATLAB Interface to a C++ Library
Requirements for Building Interface to C++ Libraries
Example to create a MATLAB interface to a C++ library for macOS
I hope this helps!
Thank You
Maneet Bagga
3 Kommentare
Adrian
am 9 Okt. 2023
Bearbeitet: Adrian
am 13 Okt. 2023
I don't think this should be an accepted answer - there's something weird going on.
I've been trying to build the C++ interface from the examples using MATLAB R2023a on Ventura and the exact same error appears. The only way to fix it was to install Xcode 14.2 (any newer version would cause this problem). Now that I'm on Sonoma with Xcode 15, the problem is still there and no way to go back.
Weitere Antworten (2)
J Pries
am 11 Apr. 2024
This is a problem with XCode not providing implementaitons of std::quick_exit and std::at_quick_exit, and then Matlab attempting to parse those definitions. Searching around, you can find others having similar issues outside of Matlab. This was the most succicnt issue I could find that points to the issue being a change in the header file in XCode 14.3: https://youtrack.jetbrains.com/issue/KT-57848
That issue also suggestion a solution: Add the compiler flags -Dat_quick_exit=atexit and -Dquick_exit=exit. https://github.com/jetbrains/kotlin/commit/d50f585911dedec5723213da8835707ac95e1c01
Alternatively, you might have success providing dummy implementations just before including <cstdlib>.
#ifdef __APPLE__
int at_quick_exit(void (*func)()) noexcept { return 0; };
[[noreturn]] void quick_exit( int exit_code ) noexcept;
#endif
#include <cstdlib>
Both of these allowed me to successfully generate a library interface with clibgen.generateLibraryDefinition on a minimum working example. Your mileage may vary on more complex projects. The compiler flag option seems like the better solution.
0 Kommentare
Adrian
am 18 Jul. 2024
It looks like this bug was fixed in R2024a Update 5. I've tested on my code and there's no longer a need for hacking things 🎉
https://uk.mathworks.com/support/bugreports/details/3181030
0 Kommentare
Siehe auch
Kategorien
Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!