neuronsimulator / nrn

NEURON Simulator
http://nrn.readthedocs.io
Other
389 stars 115 forks source link

NEURON 8.2.x fails to build on MacOS 14 #3021

Open JCGoran opened 1 month ago

JCGoran commented 1 month ago

Context

NEURON branch release/8.2 fails to build from source on MacOS 14 with AppleClang 15.0.0.15000309. Tested on Python 3.9, but others may be affected as well.

Overview of the issue

The error that occurs when running build_wheels.bash osx 3.9 coreneuron is:

In file included from nrn/src/nrniv/pysecname2sec.cpp:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:2529:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:526:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/boyer_moore_searcher.h:27:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:2777:33: error: no member named 'hoc_begin' in 'std::initializer_list<bool>'
        __construct_at_end(__il.begin(), __il.end(), __n);
                           ~~~~ ^
nrn/src/oc/redef.h:32:28: note: expanded from macro 'begin'
#define begin              hoc_begin
                           ^
5 errors generated.
make[2]: *** [src/nrniv/CMakeFiles/nrniv_lib.dir/pysecname2sec.cpp.o] Error 1

It seems macro expansion is the culprit:

https://github.com/neuronsimulator/nrn/blob/078a34a9dc12dab5a339d525ba159655ed703030/src/oc/redef.h#L32

This was addressed on master in #1969, but the diff does not apply cleanly, and I'm not sure if it's compatible with 8.2.x.

alkino commented 1 month ago

Do we think that one day we can fully remove this whole redef.h file? Why is it used for?

ramcdougal commented 1 month ago

I think functionally this was intended to de facto create a namespace for "hoc" things.

Whether or not it's worth fixing here may depend on how long it takes to get NEURON 9 out if it's already fixed there.

1uc commented 1 month ago

Is begin the only clash, or other there others too, e.g. data or type. The begin is easily fixed, just remove the #define from the header. The other data and type would be a lot of tedious work.

The fix in 9.0 is to leave the renaming macros mostly intact, but the few that cause issues have been removed.