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

Compile problem on Mac OS with clang 10 #16

Open
sebjameswml opened this issue Aug 19, 2020 · 2 comments
Open

Compile problem on Mac OS with clang 10 #16

sebjameswml opened this issue Aug 19, 2020 · 2 comments

Comments

@sebjameswml
Copy link
Collaborator

This problem has been experienced by @benoit-girard with this cmake call:

cmake -DSTANDALONE_INSTALL=ON -DCOMPILE_WITH_X11=OFF \ -DLICENCE_INSTALL=OFF -DCMAKE_INSTALL_PREFIX=/Users/yourname ..

"make -j4" returned:

-- The C compiler identification is Clang 10.0.1
-- The CXX compiler identification is Clang 10.0.1
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang-10
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang-10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Operating system: Darwin-18.7.0
-- Processor: x86_64 Library arch:  Arch bits: 64
-- Compiling without X11 dependencies
-- Standalone install - choose unix style install with `cmake -DSTANDALONE_INSTALL=OFF`
-- Install location: /Users/girard/SystemML
--   (This can be changed with `cmake -DCMAKE_INSTALL_PREFIX=/some/place`
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE 
-- Found Threads with find_package :)
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11")
-- Omitting brahms-channel-mpich2
--   (Include brahms-channel-mpich2 with `cmake -DCOMPILE_WITH_MPICH2=ON`)
-- Flags for brahms-execute: -D__OSX__ -D__NOX11__
-- Omitting matlab binding (1258)
--   (Include matlab binding with `cmake -DCOMPILE_MATLAB_BINDING=ON`)
-- Omitting python binding (1262)
--   (Include python binding with `cmake -DCOMPILE_PYTHON_BINDING=ON`)
-- Flags for components: -D__OSX__ -D__NOX11__
-- Omitting WX-dependent component dev/std/image/numeric
--   (Include dev/std/image/numeric with `cmake -DCOMPILE_WX_COMPONENT=ON`)
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    LICENCE_INSTALL


-- Build files have been written to: /Users/girard/brainModel/testsSpineML/brahms/build
(base) LicorneRose:build girard$ make -j4
Scanning dependencies of target brahms-engine-base
Scanning dependencies of target brahms-compress
[  1%] Building CXX object framework/compress/CMakeFiles/brahms-compress.dir/compress.cpp.o
[  4%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/__/channel/channel-common.cpp.o
[  4%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/ipm.cpp.o
[  4%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/core.cpp.o
[  5%] Linking CXX shared library libbrahms-compress.dylib
ld: warning: -pie being ignored. It is only used when linking a main executable
[  5%] Built target brahms-compress
[  5%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/os.cpp.o
[  6%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/text.cpp.o
[  7%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/constants.cpp.o
[  8%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/brahms_error.cpp.o
[  9%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/brahms_math.cpp.o
[ 10%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/output.cpp.o
[ 11%] Building CXX object framework/engine/CMakeFiles/brahms-engine-base.dir/base/thread.cpp.o
[ 12%] Linking CXX static library libbrahms-engine-base.a
[ 12%] Built target brahms-engine-base
Scanning dependencies of target brahms-channel-sockets
Scanning dependencies of target brahms-engine
[ 15%] Building CXX object framework/channel/sockets/CMakeFiles/brahms-channel-sockets.dir/sockets.cpp.o
[ 15%] Building CXX object framework/channel/sockets/CMakeFiles/brahms-channel-sockets.dir/__/deliverer.cpp.o
[ 15%] Building CXX object framework/channel/sockets/CMakeFiles/brahms-channel-sockets.dir/__/channel.cpp.o
[ 16%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/component.cpp.o
/Users/girard/brainModel/testsSpineML/brahms/framework/channel/sockets/sockets.cpp:85:71: error: invalid operands to binary expression
      ('__bind<int &, const sockaddr *, unsigned long>' and 'int')
    if ( bind( serverListenSocket, (OS_SOCKADDR*) &con, sizeof(con) ) == OS_SOCKET_ERROR)
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
/usr/local/opt/llvm/bin/../include/c++/v1/system_error:390:1: note: candidate function not viable: no known conversion from '__bind<int
      &, const sockaddr *, unsigned long>' to 'const std::__1::error_code' for 1st argument
operator==(const error_code& __x, const error_code& __y) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/system_error:397:1: note: candidate function not viable: no known conversion from '__bind<int
      &, const sockaddr *, unsigned long>' to 'const std::__1::error_code' for 1st argument
operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/system_error:405:1: note: candidate function not viable: no known conversion from '__bind<int
      &, const sockaddr *, unsigned long>' to 'const std::__1::error_condition' for 1st argument
operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/system_error:412:1: note: candidate function not viable: no known conversion from '__bind<int
      &, const sockaddr *, unsigned long>' to 'const std::__1::error_condition' for 1st argument
operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/utility:576:1: note: candidate template ignored: could not match 'pair' against '__bind'
operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/usr/local/opt/llvm/bin/../include/c++/v1/iterator:807:1: note: candidate template ignored: could not match 'reverse_iterator' against
      '__bind'
operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/usr/local/opt/llvm/bin/../include/c++/v1/iterator:1036:1: note: candidate template ignored: could not match 'istream_iterator' against
      '__bind'
operator==(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
^
/usr/local/opt/llvm/bin/../include/c++/v1/iterator:1140:6: note: candidate template ignored: could not match 'istreambuf_iterator'
      against '__bind'
bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a,
     ^
/usr/local/opt/llvm/bin/../include/c++/v1/iterator:1243:1: note: candidate template ignored: could not match 'move_iterator' against
      '__bind'
operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
^
/usr/local/opt/llvm/bin/../include/c++/v1/iterator:1615:1: note: candidate template ignored: could not match '__wrap_iter' against
      '__bind'
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/tuple:1176:1: note: candidate template ignored: could not match 'tuple' against '__bind'
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/usr/local/opt/llvm/bin/../include/c++/v1/memory:2037:6: note: candidate template ignored: could not match 'allocator' against '__bind'
bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
     ^
/usr/local/opt/llvm/bin/../include/c++/v1/memory:2872:1: note: candidate template ignored: could not match 'unique_ptr' against
      '__bind'
operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() == __y.get();}
^
/usr/local/opt/llvm/bin/../include/c++/v1/memory:2908:1: note: candidate template ignored: could not match 'unique_ptr' against
      '__bind'
operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/memory:2916:1: note: candidate template ignored: could not match
      'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'int'
operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/memory:4421:1: note: candidate template ignored: could not match 'shared_ptr' against
      '__bind'
operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/memory:4475:1: note: candidate template ignored: could not match 'shared_ptr' against
      '__bind'
operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/memory:4483:1: note: candidate template ignored: could not match
      'shared_ptr<type-parameter-0-0>' against 'int'
operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
^
/usr/local/opt/llvm/bin/../include/c++/v1/functional:2506:1: note: candidate template ignored: could not match 'function' against
      '__bind'
operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;}
^
/usr/local/opt/llvm/bin/../include/c++/v1/functional:2511:1: note: candidate template ignored: could not match
      'function<type-parameter-0-0 (type-parameter-0-1...)>' against 'int'
operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;}
^
/usr/local/opt/llvm/bin/../include/c++/v1/string_view:614:6: note: candidate template ignored: could not match 'basic_string_view'
      against '__bind'
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
     ^
/usr/local/opt/llvm/bin/../include/c++/v1/string_view:623:6: note: candidate template ignored: could not match 'basic_string_view'
      against '__bind'
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
     ^
/usr/local/opt/llvm/bin/../include/c++/v1/string_view:632:6: note: candidate template ignored: could not match
      'basic_string_view<type-parameter-0-0, type-parameter-0-1>' against 'int'
bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
     ^
/usr/local/opt/llvm/bin/../include/c++/v1/string:563:6: note: candidate template ignored: could not match 'fpos' against '__bind'
bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
     ^
/usr/local/opt/llvm/bin/../include/c++/v1/string:3850:1: note: candidate template ignored: could not match 'basic_string' against
      '__bind'
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
^
/usr/local/opt/llvm/bin/../include/c++/v1/string:3862:1: note: candidate template ignored: could not match 'basic_string' against
      '__bind'
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
^
/usr/local/opt/llvm/bin/../include/c++/v1/string:3881:1: note: candidate template ignored: could not match 'const _CharT *' against
      '__bind<int &, const sockaddr *, unsigned long>'
operator==(const _CharT* __lhs,
^
/usr/local/opt/llvm/bin/../include/c++/v1/string:3894:1: note: candidate template ignored: could not match 'basic_string' against
      '__bind'
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
^
/usr/local/opt/llvm/bin/../include/c++/v1/vector:3335:1: note: candidate template ignored: could not match 'vector' against '__bind'
operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
^
/usr/local/opt/llvm/bin/../include/c++/v1/list:2418:1: note: candidate template ignored: could not match 'list' against '__bind'
operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
^
/usr/local/opt/llvm/bin/../include/c++/v1/deque:2967:1: note: candidate template ignored: could not match 'deque' against '__bind'
operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
^
/usr/local/opt/llvm/bin/../include/c++/v1/stack:256:1: note: candidate template ignored: could not match 'stack' against '__bind'
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
^
/usr/local/opt/llvm/bin/../include/c++/v1/queue:362:1: note: candidate template ignored: could not match 'queue' against '__bind'
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
^
1 error generated.
make[2]: *** [framework/channel/sockets/CMakeFiles/brahms-channel-sockets.dir/sockets.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 17%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/event.cpp.o
[ 18%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/interface.cpp.o
make[1]: *** [framework/channel/sockets/CMakeFiles/brahms-channel-sockets.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 19%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/loggable.cpp.o
[ 19%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/process.cpp.o
[ 20%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/system.cpp.o
[ 21%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/thread.cpp.o
[ 22%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/data.cpp.o
[ 23%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/identifier.cpp.o
[ 24%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/link.cpp.o
[ 25%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/port.cpp.o
[ 25%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/set.cpp.o
[ 26%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/systemml/utility.cpp.o
[ 27%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/environment.cpp.o
[ 28%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/execution.cpp.o
[ 30%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/os.cpp.o
[ 30%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/loader.cpp.o
[ 31%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/error.cpp.o
[ 32%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/helpers.cpp.o
[ 32%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/module.cpp.o
[ 33%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/register.cpp.o
[ 34%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/support/xml.cpp.o
[ 35%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/main/api.cpp.o
[ 36%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/main/api-engine.cpp.o
[ 37%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/main/engine.cpp.o
[ 38%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/main/engine-open.cpp.o
[ 39%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/main/engine-execute.cpp.o
[ 39%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/main/engine-close.cpp.o
[ 40%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/main/engine-walk.cpp.o
/Users/girard/brainModel/testsSpineML/brahms/framework/engine/main/engine-open.cpp:204:31: warning: object backing the pointer will be
      destroyed at the end of the full-expression [-Wdangling-gsl]
                        const char* executable_p = process_p->getClassName().c_str();
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/girard/brainModel/testsSpineML/brahms/framework/engine/main/engine-open.cpp:223:32: warning: object backing the pointer will be
      destroyed at the end of the full-expression [-Wdangling-gsl]
                                const char* executable_q = process_q->getClassName().c_str();
                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
[ 41%] Building CXX object framework/engine/CMakeFiles/brahms-engine.dir/main/engine-monitor.cpp.o
[ 42%] Linking CXX static library libbrahms-engine.a
[ 42%] Built target brahms-engine
make: *** [all] Error 2
@sebjameswml
Copy link
Collaborator Author

I think this may be bit-rot, with some tweaks required on a Mac:

This is complaining that in the call to bind() at line 85 of brahms/framework/channel/sockets/sockets.cpp it can't compare a thing called

__bind<int &, const sockaddr *, unsigned long>

with an int.

The line of code is:

if ( bind( serverListenSocket, (OS_SOCKADDR*) &con, sizeof(con) ) == OS_SOCKET_ERROR)

Now, on Linux, the call to bind() returns an int, and that can be compared with OS_SOCKET_ERROR which is a numerical definition and is interpreted as an int.

It seems that on a Mac with clang10, the call to bind is returning some sort of special __bind object, so there seems to be some bit-rot in this bit of brahms. It looks like the bind system call is being implemented in a c++ way. A check on the Apple developer website suggests that you can still use the unix/C style sockets interface and the bind(2) function call, and that it should, as is typical, return an int. There's probably some Mac-specific tweak required, or a slight change to a #include to get this to compile, but I'm afraid I don't know what it is, and I don't have access to a Mac at the moment.

Sorry I can't be more help! I'll open an issue.

@sebjameswml
Copy link
Collaborator Author

@ajc158 have you got a Mac? Does brahms build on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant