Skip to content

MacOS Fixes, master branch (2017.10.27.)

This is a slightly special MR, as it will raise some philosophical questions. (Since it introduces a "new language" into the Gaudi source code.)

When trying to revive my test code on top of the master branch on MacOS, I came across this crash during the build:

[<unknown binary>] (no debug info)
[/Users/krasznaa/ATLAS/sw/projects/gaudi/build_gaudi/lib/libGaudiExamples.so] GaudiTesting::DestructorCheckAlg::~DestructorCheckAlg() /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/vector:442
[/Users/krasznaa/ATLAS/sw/projects/gaudi/build_gaudi/lib/libGaudiExamples.so] GaudiTesting::DestructorCheckAlg::~DestructorCheckAlg() /Users/krasznaa/ATLAS/sw/projects/gaudi/GaudiGaudi/GaudiExamples/src/testing/TestingAlgs.cpp:27
[/Users/krasznaa/ATLAS/sw/projects/gaudi/build_gaudi/lib/libGaudiExamples.so] implements<IAlgTool, IDataHandleHolder, IProperty, IStateful>::release() /Users/krasznaa/ATLAS/sw/projects/gaudi/GaudiGaudi/GaudiKernel/GaudiKernel/implements.h:48
[/Users/krasznaa/ATLAS/sw/projects/gaudi/build_gaudi/bin/genconf.exe] configGenerator::genConfig(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /Users/krasznaa/ATLAS/sw/projects/gaudi/GaudiGaudi/GaudiKernel/GaudiKernel/SmartIF.h:96
[/Users/krasznaa/ATLAS/sw/projects/gaudi/build_gaudi/bin/genconf.exe] main /Users/krasznaa/ATLAS/sw/projects/gaudi/GaudiGaudi/GaudiKernel/src/Util/genconf.cpp:414
[/usr/lib/system/libdyld.dylib] start (no debug info)
[<unknown binary>] (no debug info)
[ 96%] Built target GaudiPartPropConf
make[2]: *** [GaudiExamples/genConf/GaudiExamples/GaudiExamplesConf.py] Error 139
make[1]: *** [GaudiExamples/CMakeFiles/GaudiExamplesConf.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

After digging around for a bit, I found that System::cmdLineArgs() was just not working on MacOS at all. (The /proc directory just doesn't exist on MacOS. It may have at one point in the past, but not anymore.)

After some further Google-ing, the best way I could find to implement the functionality promised by System::cmdLineArgs() was to make use of Apple's Foundation framework. More precisely, the NSProcessInfo object.

But as you can see (and probably guess from the names), this is an Objective-C object. So the only way to make use of it in GaudiKernel is to write an Objective-C++ call around that object. So this is what I've done.

While at it, I also finally fixed the behaviour of System::typeinfoName(...) on MacOS as well. So that it would do the proper std::string replacements now. (Unfortunately to do this, I had to complicate that function's implementation even further... 😦)

So... Thoughts? How freaked out are people about adding Objective-C(++) code to the Gaudi project?

Edited by Attila Krasznahorkay

Merge request reports