Newest version failing to install on Mac OS X (El Capitan)

This section contains questions related to the compilation of Auryn on different platforms.
Post Reply
haffi
Posts: 2
Joined: Thu Feb 11, 2016 1:45 pm

Newest version failing to install on Mac OS X (El Capitan)

Post by haffi »

Hi, the newest version of Auryn does not compile on Mac OS X (with neither clang/clang++ nor gcc/g++). Here is the output I receive

Code: Select all

>> make
-- Boost version: 1.61.0
-- Found the following Boost libraries:
--   mpi
--   serialization
--   program_options
--   date_time
--   unit_test_framework
--   system
--   filesystem
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/felix/Work/auryn/build/release
[  1%] Building CXX object src/CMakeFiles/auryn.dir/ABSConnection.cpp.o
In file included from /Users/felix/Work/auryn/src/ABSConnection.h:34:0,
                 from /Users/felix/Work/auryn/src/ABSConnection.cpp:26:
/Users/felix/Work/auryn/src/AurynVector.h: In member function 'void auryn::AurynVector<T, IndexType>::allocate(auryn::NeuronID)':
/Users/felix/Work/auryn/src/AurynVector.h:88:92: error: there are no arguments to 'aligned_alloc' that depend on a template parameter, so a declaration of 'aligned_alloc' must be available [-fpermissiv]
     T * ptr = (T*)aligned_alloc(sizeof(T)*SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS,sizeof(T)*n);
                                                                                            ^
/Users/felix/Work/auryn/src/AurynVector.h:88:92: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/Users/felix/Work/auryn/src/AurynVector.h: In instantiation of 'void auryn::AurynVector<T, IndexType>::allocate(auryn::NeuronID) [with T = float; IndexType = long unsigned int; auryn::NeuronID = unsigned int]':
/Users/felix/Work/auryn/src/AurynVector.h:159:14:   required from 'void auryn::AurynVector<T, IndexType>::resize(IndexType) [with T = float; IndexType = long unsigned int]'
/Users/felix/Work/auryn/src/ComplexMatrix.h:518:3:   required from 'void auryn::ComplexMatrix<T>::resize_buffers(auryn::AurynLong) [with T = float; auryn::AurynLong = long unsigned int]'
/Users/felix/Work/auryn/src/ComplexMatrix.h:123:18:   required from 'void auryn::ComplexMatrix<T>::load(Archive&, unsigned int) [with Archive = boost::archive::binary_iarchive; T = float]'
/usr/local/include/boost/serialization/access.hpp:99:9:   required from 'static void boost::serialization::access::member_load(Archive&, T&, unsigned int) [with Archive = boost::archive::binary_iarchive; T = auryn::ComplexMatrix<float>]'
/usr/local/include/boost/serialization/split_member.hpp:54:32:   required from 'static void boost::serialization::detail::member_loader<Archive, T>::invoke(Archive&, T&, unsigned int) [with Archive = boost::archive::binary_iarchive; T = auryn::ComplexMatrix<float>]'
/usr/local/include/boost/serialization/split_member.hpp:69:18:   [ skipping 10 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/local/include/boost/archive/detail/common_iarchive.hpp:66:22:   required from 'void boost::archive::detail::common_iarchive<Archive>::load_override(T&) [with T = auryn::ComplexMatrix<float>; Archive = boost::archive::binary_iarchive]'
/usr/local/include/boost/archive/basic_binary_iarchive.hpp:75:7:   required from 'void boost::archive::basic_binary_iarchive<Archive>::load_override(T&) [with T = auryn::ComplexMatrix<float>; Archive = boost::archive::binary_iarchive]'
/usr/local/include/boost/archive/binary_iarchive_impl.hpp:58:9:   required from 'void boost::archive::binary_iarchive_impl<Archive, Elem, Tr>::load_override(T&) [with T = auryn::ComplexMatrix<float>; Archive = boost::archive::binary_iarchive; Elem = char; Tr = std::char_traits<char>]'
/usr/local/include/boost/archive/detail/interface_iarchive.hpp:68:9:   required from 'Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = auryn::ComplexMatrix<float>; Archive = boost::archive::binary_iarchive]'
/usr/local/include/boost/archive/detail/interface_iarchive.hpp:75:32:   required from 'Archive& boost::archive::detail::interface_iarchive<Archive>::operator&(T&) [with T = auryn::ComplexMatrix<float>; Archive = boost::archive::binary_iarchive]'
/Users/felix/Work/auryn/src/SparseConnection.h:87:9:   required from here
/Users/felix/Work/auryn/src/AurynVector.h:88:32: error: 'aligned_alloc' was not declared in this scope
     T * ptr = (T*)aligned_alloc(sizeof(T)*SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS,sizeof(T)*n);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/auryn.dir/ABSConnection.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/auryn.dir/all] Error 2
make: *** [all] Error 2
Do you know what the problem could be? I've been trying to search around but could not find a solution.
User avatar
zenke
Site Admin
Posts: 156
Joined: Tue Oct 14, 2014 11:34 am
Location: Basel, CH
Contact:

Re: Newest version failing to install on Mac OS X (El Capitan)

Post by zenke »

Hi Haffi,

this seems to be caused by the fact that "aligned_alloc" is a C++11 function. As a first workaround I suggest you pull the most recent version of "master" from github to which I just added a patch which allows you to turn off memory alignment. Then, in the file "src/auryn_definitions.h" comment out the line "#define CODE_ALIGNED_SIMD_INSTRUCTIONS" -> "// #define CODE_ALIGNED_SIMD_INSTRUCTIONS" and try compiling again. Alternatively you could try using C++11.

This should work for the moment, and gives me some time to find a more portable way to implement memory alignment without having to rely on newer C++ standards. Probably, I will end up settling for Boost Align, but that's only included in relatively recent Boost versions which will break building on many Ubuntu systems using the stock library... I'll need to think about it.

Please let me know if you are successful with this workaround.

Cheers,

Friedemann
User avatar
zenke
Site Admin
Posts: 156
Joined: Tue Oct 14, 2014 11:34 am
Location: Basel, CH
Contact:

Re: Newest version failing to install on Mac OS X (El Capitan)

Post by zenke »

Hi Haffi,
I just looked into the problem. It seems the code segment can be redone quite easily using Boost align. I am attaching a patch. If you have time it would be great to know if that solves the issue on your mac. In that case it might be worth including this into the final v0.8 release version.

Cheers, Friedemann
fix_memory_alignment.patch
(2.9 KiB) Downloaded 554 times
haffi
Posts: 2
Joined: Thu Feb 11, 2016 1:45 pm

Re: Newest version failing to install on Mac OS X (El Capitan)

Post by haffi »

Hi, thanks for the quick response! Yesterday I also tried compiling using C++11 flags without success. The function align_alloc is it seems a C11 (not C++11) function, at least if you try to run the code on the example site here it does not compile with several different C++ compilers.

First I tried compiling with clang but this turned out not to be successful, it also found a couple of errors which gcc ignores. I did manage to compile it with gcc in the end (after recompiling boost with gcc) but then it turned out that in my project there are details which depend on specifics in version 0.7.0 which seem to have changed in version 0.8.0 (at least I can't compile my new files anymore and the output is not revealing at all what the issue is). I think I'll stick with version 0.7.0 for now but at least I could compile 0.8.0 and run the examples...

The errors clang found were the following:

Code: Select all

/auryn/src/StateMonitor.cpp:82:13: error: use of undeclared identifier 'setiosflags'; did you mean 'std::setiosflags'?
        outfile << setiosflags(std::ios::fixed) << std::setprecision(6);
                   ^~~~~~~~~~~
                   std::setiosflags

Code: Select all

auryn/src/System.cpp:342:36: error: use of undeclared identifier 'setiosflags'; did you mean 'std::setiosflags'?
        std::cout<< percent << "%     "<< setiosflags(std::ios::fixed) << " t=" << time ;
                                          ^~~~~~~~~~~
                                          std::setiosflags

Code: Select all

auryn/src/WeightPatternMonitor.cpp:49:13: error: use of undeclared identifier 'setiosflags'; did you mean 'std::setiosflags'?
        outfile << setiosflags(std::ios::fixed) << std::setprecision(6);
                   ^~~~~~~~~~~
                   std::setiosflags
By the way I also have this warning which was also around in older versions:

Code: Select all

/auryn/src/IafPscDeltaGroup.h:26:9: warning: 'IAFPSCDELTAGROUP' is used as a header guard here, followed by #define of a different macro
      [-Wheader-guard]
#ifndef IAFPSCDELTAGROUP
        ^~~~~~~~~~~~~~~~
Finally, clang (Apple LLVM version 7.3.0 (clang-703.0.31)) halts the installation with the following error:

Code: Select all

[ 61%] Linking CXX executable sim_poisson
Undefined symbols for architecture x86_64:
  "___cpu_model", referenced from:
      auryn::System::init() in libauryn.a(System.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [examples/sim_poisson] Error 1
make[1]: *** [examples/CMakeFiles/sim_poisson.dir/all] Error 2
make: *** [all] Error 2
User avatar
zenke
Site Admin
Posts: 156
Joined: Tue Oct 14, 2014 11:34 am
Location: Basel, CH
Contact:

Re: Newest version failing to install on Mac OS X (El Capitan)

Post by zenke »

Hi Haffi,
thanks for reporting those issues, they will be fixed for the final v0.8 release. Sorry, to hear the interface changes broke your code. Out of curiosity, where did it break? I took great care in trying to keep the synaptic features compatible, but with the extensive refactoring that went on for v0.8 i'd be curious to know, what it was in the end.
You are right about aligned_alloc. it is C11 -- my bad. Being used to using gcc makes it easy to mix the two dialects and forget about that. The issue should be resolved in the current development version and the changes will be merged either in the 0.8 release or in a later release.
Thanks again for the feedback! I really appreciate it.

Best,
Friedemann
Post Reply