Eos: link failed in mac os.

Created on 27 Jul 2017  路  11Comments  路  Source: EOSIO/eos

I am writing a article about how to compile eos in mac os.
http://www.jianshu.com/p/f26ee4cf1d4a

but i still meet a issue in below:
could some one help me? thanks.

[ 55%] Built target WASM
[ 58%] Built target WAST
[ 59%] Linking CXX executable wavm
Undefined symbols for architecture x86_64:
"typeinfo for llvm::Instruction", referenced from:
typeinfo for llvm::SelectInst in libRuntime.a(LLVMEmitIR.cpp.o)
"typeinfo for llvm::RuntimeDyld::MemoryManager", referenced from:
typeinfo for llvm::MCJITMemoryManager in libRuntime.a(LLVMJIT.cpp.o)
"typeinfo for llvm::raw_ostream", referenced from:
typeinfo for llvm::raw_pwrite_stream in libRuntime.a(LLVMJIT.cpp.o)
"typeinfo for llvm::MemoryBuffer", referenced from:
typeinfo for llvm::ObjectMemoryBuffer in libRuntime.a(LLVMJIT.cpp.o)
"typeinfo for llvm::ErrorInfoBase", referenced from:
typeinfo for llvm::ErrorInfo in libRuntime.a(LLVMJIT.cpp.o)
"typeinfo for llvm::JITSymbolResolver", referenced from:
typeinfo for LLVMJIT::NullResolver in libRuntime.a(LLVMJIT.cpp.o)
"typeinfo for llvm::RTDyldMemoryManager", referenced from:
typeinfo for LLVMJIT::UnitMemoryManager in libRuntime.a(LLVMJIT.cpp.o)
"typeinfo for llvm::CmpInst", referenced from:
typeinfo for llvm::FCmpInst in libRuntime.a(LLVMEmitIR.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]: * [libraries/wasm-jit/Source/Programs/wavm] Error 1
make[1]:
[libraries/wasm-jit/Source/Programs/CMakeFiles/wavm.dir/all] Error 2
make: *
* [all] Error 2

Most helpful comment

Tweaking the environment variables doesn't fix the issue for me.

I tried building LLVM from source, installing llvm (v4 and v5) with brew and modifying relevant environment variables to ensure the build script finds the right LLVM, LLC, clang binaries. Neither works.

All 11 comments

Have you tried with llvm from homebrew rather than installing it manually?

new issue:
In file included from /Users/phil/work/X-work/eos/libraries/chain/include/eos/chain/types.hpp:41:
/Users/phil/work/X-work/eos/libraries/fc/include/fc/static_variant.hpp:388:34: error: class template partial specialization is not more specialized than the primary template
[-Winvalid-partial-specialization]
template struct get_typename ^
/Users/phil/work/X-work/eos/libraries/fc/include/fc/reflect/typename.hpp:18:30: note: template is declared here
template class get_typename{};
^
In file included from /Users/phil/work/X-work/eos/libraries/chain/chain_controller.cpp:33:
/Users/phil/work/X-work/eos/libraries/chain/include/eos/chain/producer_object.hpp:52:2: warning: using ordered_non_unique is not deterministic [-W#warnings]

warning using ordered_non_unique is not deterministic

^
/Users/phil/work/X-work/eos/libraries/chain/chain_controller.cpp:340:2: warning: TODO: Populate generated blocks with generated transactions [-W#warnings]

warning TODO: Populate generated blocks with generated transactions

^
/Users/phil/work/X-work/eos/libraries/chain/chain_controller.cpp:447:2: warning: TODO: Process generated transaction [-W#warnings]

warning TODO: Process generated transaction

^
/Users/phil/work/X-work/eos/libraries/chain/chain_controller.cpp:446:26: warning: unused variable 'trx' [-Wunused-variable]
for(const auto& trx : thread.generated_input ) {
^
/Users/phil/work/X-work/eos/libraries/chain/chain_controller.cpp:429:13: warning: unused variable 'next_block_num' [-Wunused-variable]
uint32_t next_block_num = next_block.block_num();
^
/Users/phil/work/X-work/eos/libraries/chain/chain_controller.cpp:495:2: warning: TODO: Use a real chain_id here (where is this stored? Do we still need it?) [-W#warnings]

warning TODO: Use a real chain_id here (where is this stored? Do we still need it?)

^
/Users/phil/work/X-work/eos/libraries/chain/chain_controller.cpp:1137:30: warning: unused variable 'outputs' [-Wunused-variable]
const vector& outputs = vo["output"].get_array();
^
7 warnings and 1 error generated.
make[2]: * [libraries/chain/CMakeFiles/eos_chain.dir/chain_controller.cpp.o] Error 1
make[1]:
[libraries/chain/CMakeFiles/eos_chain.dir/all] Error 2
make: *
* [all] Error 2

Same problem here,I install the llvm manually instead of using brew install llvm

with the following cmake command:

export WASM_LLVM_CONFIG=~/develop/eos/environment/wasm-compiler/llvm/bin/llvm-config
## using manually installed llvm
export LLVM_DIR=~/develop/eos/environment/llvm/clang-llvm-4.0.0-x86_64-apple-darwin/lib/cmake/llvm
cmake -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2l -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl/1.0.2l/lib ..

if i didn't use the manually install llvm,I got the following error when cmake:

- Configuring ChainBase on OS X

CMake Error at libraries/wasm-jit/Source/Runtime/CMakeLists.txt:26 (find_package):

Could not find a package configuration file provided by "LLVM" (requested

version 4.0) with any of the following names:

LLVMConfig.cmake

llvm-config.cmake

Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set

"LLVM_DIR" to a directory containing one of the above files.聽 If "LLVM"

provides a separate development package or SDK, be sure it has been

installed.

-- Configuring incomplete, errors occurred!

and then cmake succeed, but when make -j4,I will got another error,any help will be appreciated,thanks.

[ 70%] Building CXX object libraries/fc/CMakeFiles/fc.dir/src/network/url.cpp.o
[ 70%] Building CXX object libraries/fc/CMakeFiles/fc.dir/src/compress/smaz.cpp.o
[ 70%] Linking CXX executable Test
[ 71%] Building CXX object libraries/fc/CMakeFiles/fc.dir/src/compress/zlib.cpp.o
[ 71%] Linking CXX static library libfc.a
[ 72%] Building CXX object libraries/wasm-jit/Source/Programs/CMakeFiles/Disassemble.dir/Disassemble.cpp.o
Undefined symbols for architecture x86_64:
Undefined symbols for architecture x86_64:
  "typeinfo for llvm::Instruction", referenced from:
  "typeinfo for llvm::Instruction", referenced from:
      typeinfo for llvm::SelectInst in libRuntime.a(LLVMEmitIR.cpp.o)
      typeinfo for llvm::SelectInst in libRuntime.a(LLVMEmitIR.cpp.o)
  "typeinfo for llvm::RuntimeDyld::MemoryManager", referenced from:
  "typeinfo for llvm::RuntimeDyld::MemoryManager", referenced from:
      typeinfo for llvm::MCJITMemoryManager in libRuntime.a(LLVMJIT.cpp.o)
      typeinfo for llvm::MCJITMemoryManager in libRuntime.a(LLVMJIT.cpp.o)
  "typeinfo for llvm::raw_ostream", referenced from:
  "typeinfo for llvm::raw_ostream", referenced from:
      typeinfo for llvm::raw_pwrite_stream in libRuntime.a(LLVMJIT.cpp.o)
      typeinfo for llvm::raw_pwrite_stream in libRuntime.a(LLVMJIT.cpp.o)
  "typeinfo for llvm::MemoryBuffer", referenced from:
  "typeinfo for llvm::MemoryBuffer", referenced from:
      typeinfo for llvm::ObjectMemoryBuffer in libRuntime.a(LLVMJIT.cpp.o)
      typeinfo for llvm::ObjectMemoryBuffer in libRuntime.a(LLVMJIT.cpp.o)
  "typeinfo for llvm::ErrorInfoBase", referenced from:
      typeinfo for llvm::ErrorInfo<llvm::ErrorList, llvm::ErrorInfoBase> in libRuntime.a(LLVMJIT.cpp.o)
  "typeinfo for llvm::ErrorInfoBase", referenced from:
      typeinfo for llvm::ErrorInfo<llvm::ErrorList, llvm::ErrorInfoBase> in libRuntime.a(LLVMJIT.cpp.o)
  "typeinfo for llvm::JITSymbolResolver", referenced from:
  "typeinfo for llvm::JITSymbolResolver", referenced from:
      typeinfo for LLVMJIT::NullResolver in libRuntime.a(LLVMJIT.cpp.o)
      typeinfo for LLVMJIT::NullResolver in libRuntime.a(LLVMJIT.cpp.o)
  "typeinfo for llvm::RTDyldMemoryManager", referenced from:
      typeinfo for LLVMJIT::UnitMemoryManager in libRuntime.a(LLVMJIT.cpp.o)
  "typeinfo for llvm::RTDyldMemoryManager", referenced from:
      typeinfo for LLVMJIT::UnitMemoryManager in libRuntime.a(LLVMJIT.cpp.o)
  "typeinfo for llvm::CmpInst", referenced from:
  "typeinfo for llvm::CmpInst", referenced from:
      typeinfo for llvm::FCmpInst in libRuntime.a(LLVMEmitIR.cpp.o)
      typeinfo for llvm::FCmpInst in libRuntime.a(LLVMEmitIR.cpp.o)
ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clangclang: : error: errorlinker command failed with exit code 1 (use -v to see invocation): linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [libraries/wasm-jit/Source/Programs/Test] Error 1make[2]: *** [libraries/wasm-jit/Source/Programs/wavm] Error 1

make[1]: *** [libraries/wasm-jit/Source/Programs/CMakeFiles/Test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [libraries/wasm-jit/Source/Programs/CMakeFiles/wavm.dir/all] Error 2
[ 72%] Linking CXX executable Disassemble
[ 72%] Built target Disassemble
[ 72%] Built target fc
make: *** [all] Error 2

@hh3755 Which Xcode version do you use? I am not sure if it's related with the XCode. When I tried to compile, I have many problems. And upgrade the Xcode >=8.3.3 solve that.

resolved:
see my update:
http://www.jianshu.com/p/f26ee4cf1d4a

the core change:

echo "export WASM_LLVM_CONFIG=~/wasm-compiler/llvm/build/bin/llvm-config" >> ~/.zshrc

echo "export LLVM_DIR=/usr/local/Cellar/llvm/4.0.1/lib/cmake/llvm" >> ~/.zshrc

@skenan I'm using brew, not install xcode directly. And @philsong 's method worked.

After using:

brew install llvm

brew install the version of [email protected] for me,changed the coresponding LLVM_DIR ,run the cmd like following:

export WASM_LLVM_CONFIG=~/develop/eos/environment/wasm-compiler/llvm/bin/llvm-config
export LLVM_DIR=/usr/local/Cellar/llvm/4.0.1/lib/cmake/llvm
cmake -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2l -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl/1.0.2l/lib ..

Then everything went ok. Thanks everybody.

cmake .. error when build eos

-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- 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: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using custom FindBoost.cmake
-- Boost version: 1.64.0
-- Found the following Boost libraries:
-- thread
-- date_time
-- system
-- filesystem
-- program_options
-- signals
-- serialization
-- chrono
-- unit_test_framework
-- context
-- locale
-- Using custom FindBoost.cmake
-- Boost version: 1.64.0
-- Found the following Boost libraries:
-- coroutine
-- Configuring Eos on OS X
-- Using WASM clang => /Users/lijincheng/wasm-compiler/llvm/bin/clang
-- Using WASM llc => /Users/lijincheng/wasm-compiler/llvm/bin/llc
-- Using WASM llvm-link => /Users/lijincheng/wasm-compiler/llvm/bin/llvm-link
-- Found Secp256k1: /usr/local/lib/libsecp256k1.a
CMake Error at /usr/local/Cellar/cmake/3.9.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GMP (missing: GMP_LIBRARIES GMP_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.9.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
libraries/fc/CMakeModules/FindGMP.cmake:50 (find_package_handle_standard_args)
libraries/fc/CMakeLists.txt:20 (find_package)

solved by: brew install gmp

This issue has tracked several different errors at this point, I think, and I'm not sure if any of them are still outstanding, so I'm closing it. Open a new issue if some problems persist.

This should be closed. Looks like it was reopened on accident. Closing.

Tweaking the environment variables doesn't fix the issue for me.

I tried building LLVM from source, installing llvm (v4 and v5) with brew and modifying relevant environment variables to ensure the build script finds the right LLVM, LLC, clang binaries. Neither works.

Was this page helpful?
0 / 5 - 0 ratings