STK: Cannot build as shared library on OSX
Created by: jrood-nrel
When building with STK enabled on OSX (Sierra) as a shared library using Clang v9.0.0-apple and GCC 7.3.0, I get this error:
Undefined symbols for architecture x86_64:
"stk::handle_assert(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)", referenced from:
sierra::MPI::AllReduce(ompi_communicator_t*, sierra::MPI::ReduceSet const&) in MPI.cpp.o
sierra::MPI::(anonymous namespace)::ReduceCheck::copyout(void*&) const in MPI.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]: *** [packages/stk/stk_util/stk_util/parallel/libstk_util_parallel.12.13.dylib] Error 1
make[1]: *** [packages/stk/stk_util/stk_util/parallel/CMakeFiles/stk_util_parallel.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
When building as a static library on OSX, everything works fine. Also when building either shared or static with STK enabled on Linux works fine. I used Spack to investigate this, so I install with either trilinos+shared
or trilinos~shared
when testing this. The easiest way to see this I think would be to use spack install nalu-wind
on OSX Sierra to see Trilinos fail with this error. (Update: I developed a workaround for this in Spack, so it won't build as a shared library on OSX)
@trilinos/stk