Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #74 osx clang problems #732

Merged
merged 8 commits into from
May 24, 2017

Conversation

heplesser
Copy link
Contributor

This PR fixes problems that made NEST fails when built with Clang under OSX. I have tested with everything (except MPI) enabled under OSX 10.12.5 with Clang 4.0.0 from brew as described here (but with Python).

Problems where of several kinds:

  • When building static libraries, duplicate definitions of Name objects in nestkernel and topology prevented linking; the duplicates are removed from topology_names.*.
  • The ctermid() system function call from sli/processes.cc was called with an incorrectly sized output buffer.
  • Output file buffers in recording_device.* were not set up properly.
  • Explicit template instantiations of lockPTRDatum types are required to make these Datum types visible to PyNEST; clang and gcc seem to have different rules on symbol visibility.

I have tested with clang and gcc 7.1.0.

@heplesser heplesser added ZC: Kernel DO NOT USE THIS LABEL I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) ZP: PR Created DO NOT USE THIS LABEL S: High Should be handled next T: Bug Wrong statements in the code or documentation labels May 23, 2017
@heplesser heplesser self-assigned this May 23, 2017
@heplesser heplesser requested review from seeholza and tammoippen May 23, 2017 19:31
Copy link
Contributor

@seeholza seeholza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Tested locally in XCode clang version 3.6.2 & Apple LLVM version 8.0.0 (clang-800.0.42.1), all tests seem to pass now.

@tammoippen
Copy link
Contributor

Working on macOS 10.12.5 (16F73)

I test some compilers for the default configurations. Seems good so far - all are building and tests are passing.

There are some compiler warnings, though:

/Users/tammoippen/Desktop/nest-simulator/models/noise_generator.cpp:182:5: warning: field 'S_' will be initialized after field 'B_' [-Wreorder]
  , S_()
    ^
/Users/tammoippen/Desktop/nest-simulator/models/noise_generator.cpp:196:5: warning: field 'S_' will be initialized after field 'B_' [-Wreorder]
  , S_( n.S_ )
    ^

and

/Users/tammoippen/Desktop/nest-simulator/nest/sli_neuron.cpp:128:8: warning: unused variable 'terminate' [-Wunused-variable]
  bool terminate = false;
       ^

Apple-clang:

» clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Configuration:

heads/origin/fix-74-osx-clang-problems@e09a686a

--------------------------------------------------------------------------------
NEST Configuration Summary
--------------------------------------------------------------------------------

Build type          :
Target System       : Darwin
Cross Compiling     : FALSE
C compiler          : /Library/Developer/CommandLineTools/usr/bin/cc
C compiler flags    :  -O2 -Wall
C++ compiler        : /Library/Developer/CommandLineTools/usr/bin/c++
C++ compiler flags  :  -O2 -Wall
Build dynamic       : ON

Built-in modules    : models;precise;topology
User modules        : None
Python bindings     : No
Use threading       : No
Use GSL             : Yes (GSL 2.3)
    Includes        : /usr/local/Cellar/gsl/2.3/include
    Libraries       : /usr/local/Cellar/gsl/2.3/lib/libgsl.dylib;/usr/local/Cellar/gsl/2.3/lib/libgslcblas.dylib

Use Readline        : Yes (GNU Readline 4.2)
    Includes        : /usr/include
    Libraries       : /usr/lib/libreadline.dylib;/usr/lib/libncurses.dylib

Use libltdl         : Yes (LTDL 2.4.6)
    Includes        : /usr/local/include
    Libraries       : /usr/local/lib/libltdl.dylib

Use doxygen         : Yes (/usr/local/bin/doxygen)
                    : target `doc` available
    `dot` available : Yes (/usr/local/bin/dot)
                    : target `fulldoc` available
Use MPI             : No
Use MUSIC           : No
Use libneurosim     : No

--------------------------------------------------------------------------------

Builds and all tests are passing. 👍.

GCC

» gcc-7 --version
gcc-7 (Homebrew GCC 7.1.0) 7.1.0

Configuration:

heads/origin/fix-74-osx-clang-problems@e09a686a

--------------------------------------------------------------------------------
NEST Configuration Summary
--------------------------------------------------------------------------------

Build type          :
Target System       : Darwin
Cross Compiling     : FALSE
C compiler          : /usr/local/bin/gcc-7
C compiler flags    :  -O2 -Wall -fopenmp -fdiagnostics-color=auto
C++ compiler        : /usr/local/bin/g++-7
C++ compiler flags  :  -O2 -Wall -fopenmp -fdiagnostics-color=auto
Build dynamic       : ON

Built-in modules    : models;precise;topology
User modules        : None
Python bindings     : No
Use threading       : Yes (OpenMP: -fopenmp)
Use GSL             : Yes (GSL 2.3)
    Includes        : /usr/local/Cellar/gsl/2.3/include
    Libraries       : /usr/local/Cellar/gsl/2.3/lib/libgsl.dylib;/usr/local/Cellar/gsl/2.3/lib/libgslcblas.dylib

Use Readline        : Yes (GNU Readline 4.2)
    Includes        : /usr/include
    Libraries       : /usr/lib/libreadline.dylib;/usr/lib/libncurses.dylib

Use libltdl         : Yes (LTDL 2.4.6)
    Includes        : /usr/local/include
    Libraries       : /usr/local/lib/libltdl.dylib

Use doxygen         : Yes (/usr/local/bin/doxygen)
                    : target `doc` available
    `dot` available : Yes (/usr/local/bin/dot)
                    : target `fulldoc` available
Use MPI             : No
Use MUSIC           : No
Use libneurosim     : No

--------------------------------------------------------------------------------

Builds and all tests are passing. 👍

Homebrew Clang

» /usr/local/opt/llvm/bin/clang --version
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

Configuration

heads/origin/fix-74-osx-clang-problems@e09a686a

--------------------------------------------------------------------------------
NEST Configuration Summary
--------------------------------------------------------------------------------

Build type          :
Target System       : Darwin
Cross Compiling     : FALSE
C compiler          : /usr/local/opt/llvm/bin/clang
C compiler flags    :  -O2 -Wall -fopenmp=libomp
C++ compiler        : /usr/local/opt/llvm/bin/clang++
C++ compiler flags  :  -O2 -Wall -fopenmp=libomp
Build dynamic       : ON

Built-in modules    : models;precise;topology
User modules        : None
Python bindings     : No
Use threading       : Yes (OpenMP: -fopenmp=libomp)
Use GSL             : Yes (GSL 2.3)
    Includes        : /usr/local/Cellar/gsl/2.3/include
    Libraries       : /usr/local/Cellar/gsl/2.3/lib/libgsl.dylib;/usr/local/Cellar/gsl/2.3/lib/libgslcblas.dylib

Use Readline        : Yes (GNU Readline 4.2)
    Includes        : /usr/include
    Libraries       : /usr/lib/libreadline.dylib;/usr/lib/libncurses.dylib

Use libltdl         : Yes (LTDL 2.4.6)
    Includes        : /usr/local/include
    Libraries       : /usr/local/lib/libltdl.dylib

Use doxygen         : Yes (/usr/local/bin/doxygen)
                    : target `doc` available
    `dot` available : Yes (/usr/local/bin/dot)
                    : target `fulldoc` available
Use MPI             : No
Use MUSIC           : No
Use libneurosim     : No

--------------------------------------------------------------------------------

Builds and all tests are passing. 👍

Copy link
Contributor

@tammoippen tammoippen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done! 👍

@heplesser
Copy link
Contributor Author

@tammoippen The compiler warnings are addressed by #729 --- feel free to approve :)!

@heplesser heplesser merged commit 7638572 into nest:master May 24, 2017
@heplesser heplesser deleted the fix-74-osx-clang-problems branch May 26, 2017 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: High Should be handled next T: Bug Wrong statements in the code or documentation ZC: Kernel DO NOT USE THIS LABEL ZP: PR Created DO NOT USE THIS LABEL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants