xcore / tool_axe

An XCore Emulator
Other
15 stars 8 forks source link

Build failure ... #28

Open g40 opened 6 years ago

g40 commented 6 years ago

Hi, any thoughts welcomed here. Not sure if the cmakefile is missing some -l flags or what.

Downloaded a source tarball onto host machine:

user@ubuntu:~/xmos/src/tool_axe-master/build$ uname -a
Linux ubuntu 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

The usual cmake dance:

user@ubuntu:~/xmos/src/tool_axe-master/build$ cmake "Unix makefiles" ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test SUPPORTS_CXX14
-- Performing Test SUPPORTS_CXX14 - Success
-- -std=c++14 is supported.
-- Found Clang: /usr/bin/clang  
-- JIT enabled
-- Found SDL2: /usr/bin/sdl2-config  
-- SDL enabled
-- Found LLVM: /usr/bin/llvm-config (found suitable version "3.8.0", minimum required is "3.3") 
-- Boost version: 1.58.0
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.3") 
-- Found LibXslt: /usr/lib/x86_64-linux-gnu/libxslt.so (found version "1.1.28") 
-- Found LibElf: /usr/lib/x86_64-linux-gnu/libelf.so  
-- Found LibRt: /usr/lib/x86_64-linux-gnu/librt.so  
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/xmos/src/tool_axe-master/build

then make ...

Scanning dependencies of target instgen
[  1%] Building CXX object utils/instgen/CMakeFiles/instgen.dir/InstructionGen.cpp.o
[  2%] Linking CXX executable ../../bin/instgen
[  2%] Built target instgen
Scanning dependencies of target not
[  3%] Building CXX object utils/not/CMakeFiles/not.dir/not.cpp.o
[  4%] Linking CXX executable ../../bin/not
[  4%] Built target not
Scanning dependencies of target genHex
[  5%] Building C object utils/genHex/CMakeFiles/genHex.dir/genHex.c.o
[  6%] Linking C executable ../../bin/genHex
[  6%] Built target genHex
Scanning dependencies of target genJitGlobalMap
[  7%] Building CXX object utils/genJitGlobalMap/CMakeFiles/genJitGlobalMap.dir/genJitGlobalMap.cpp.o
[  8%] Linking CXX executable ../../bin/genJitGlobalMap
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Mutex.cpp.o): In function `llvm::sys::MutexImpl::MutexImpl(bool)':
(.text._ZN4llvm3sys9MutexImplC2Eb+0x37): undefined reference to `pthread_mutexattr_init'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Mutex.cpp.o): In function `llvm::sys::MutexImpl::MutexImpl(bool)':
(.text._ZN4llvm3sys9MutexImplC2Eb+0x43): undefined reference to `pthread_mutexattr_settype'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Mutex.cpp.o): In function `llvm::sys::MutexImpl::MutexImpl(bool)':
(.text._ZN4llvm3sys9MutexImplC2Eb+0x56): undefined reference to `pthread_mutexattr_destroy'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Mutex.cpp.o): In function `llvm::sys::MutexImpl::tryacquire()':
(.text._ZN4llvm3sys9MutexImpl10tryacquireEv+0x8): undefined reference to `pthread_mutex_trylock'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Process.cpp.o): In function `llvm::sys::Process::SafelyCloseFileDescriptor(int)':
(.text._ZN4llvm3sys7Process25SafelyCloseFileDescriptorEi+0x41): undefined reference to `pthread_sigmask'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Process.cpp.o): In function `llvm::sys::Process::SafelyCloseFileDescriptor(int)':
(.text._ZN4llvm3sys7Process25SafelyCloseFileDescriptorEi+0x97): undefined reference to `pthread_sigmask'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Process.cpp.o): In function `llvm::sys::Process::SafelyCloseFileDescriptor(int)':
(.text._ZN4llvm3sys7Process25SafelyCloseFileDescriptorEi+0xcb): undefined reference to `pthread_sigmask'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Process.cpp.o): In function `llvm::sys::Process::FileDescriptorHasColors(int)':
(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x82): undefined reference to `setupterm'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Process.cpp.o): In function `llvm::sys::Process::FileDescriptorHasColors(int)':
(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xa8): undefined reference to `tigetnum'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Process.cpp.o): In function `llvm::sys::Process::FileDescriptorHasColors(int)':
(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xb1): undefined reference to `set_curterm'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Process.cpp.o): In function `llvm::sys::Process::FileDescriptorHasColors(int)':
(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xb9): undefined reference to `del_curterm'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(RWMutex.cpp.o): In function `llvm::sys::RWMutexImpl::RWMutexImpl()':
(.text._ZN4llvm3sys11RWMutexImplC2Ev+0x23): undefined reference to `pthread_rwlock_init'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(RWMutex.cpp.o): In function `llvm::sys::RWMutexImpl::~RWMutexImpl()':
(.text._ZN4llvm3sys11RWMutexImplD2Ev+0x8): undefined reference to `pthread_rwlock_destroy'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(RWMutex.cpp.o): In function `llvm::sys::RWMutexImpl::reader_acquire()':
(.text._ZN4llvm3sys11RWMutexImpl14reader_acquireEv+0x8): undefined reference to `pthread_rwlock_rdlock'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(RWMutex.cpp.o): In function `llvm::sys::RWMutexImpl::writer_acquire()':
(.text._ZN4llvm3sys11RWMutexImpl14writer_acquireEv+0x8): undefined reference to `pthread_rwlock_wrlock'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(RWMutex.cpp.o): In function `llvm::sys::RWMutexImpl::writer_release() [clone .localalias.0]':
(.text._ZN4llvm3sys11RWMutexImpl14writer_releaseEv+0x8): undefined reference to `pthread_rwlock_unlock'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Signals.cpp.o): In function `llvm::sys::PrintStackTrace(llvm::raw_ostream&)':
(.text._ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0xb1): undefined reference to `dladdr'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Signals.cpp.o): In function `llvm::sys::PrintStackTrace(llvm::raw_ostream&)':
(.text._ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x164): undefined reference to `dladdr'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Threading.cpp.o): In function `llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
(.text._ZN4llvm22llvm_execute_on_threadEPFvPvES0_j+0x4c): undefined reference to `pthread_create'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Threading.cpp.o): In function `llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
(.text._ZN4llvm22llvm_execute_on_threadEPFvPvES0_j+0x5c): undefined reference to `pthread_join'
/usr/lib/llvm-3.8/lib/libLLVMSupport.a(Threading.cpp.o): In function `llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
(.text._ZN4llvm22llvm_execute_on_threadEPFvPvES0_j+0x86): undefined reference to `pthread_attr_setstacksize'
collect2: error: ld returned 1 exit status
utils/genJitGlobalMap/CMakeFiles/genJitGlobalMap.dir/build.make:122: recipe for target 'bin/genJitGlobalMap' failed
make[2]: *** [bin/genJitGlobalMap] Error 1
CMakeFiles/Makefile2:282: recipe for target 'utils/genJitGlobalMap/CMakeFiles/genJitGlobalMap.dir/all' failed
make[1]: *** [utils/genJitGlobalMap/CMakeFiles/genJitGlobalMap.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
ozel commented 6 years ago

I also bumped into some of these linking errors on mac OS. In my case, the four missing references related to ncurses (*term) could be found after adding ncurses in utils/genJitGlobalMap/CMakeLists.txt:

target_link_libraries(
  genJitGlobalMap
  ncurses
  ${LLVM_LIBRARIES}
  ${LLVM_LDFLAGS}
  )

Try adding pthread and whatelse you see from the outputllvm-config --system-libs

In my case, the compilation continues but then breaks when reaching lib/JIT.cpp:

JIT.cpp:196:3: error: use of undeclared identifier 'LLVMLinkInJIT'; did you mean 'LLVMLinkInMCJIT'?
JIT.cpp:238:3: error: use of undeclared identifier 'LLVMAddTargetData'

This seems because I tried compilation with too recent versions of LLVM (5.0 and 6.0). The function LLVMAddTargetData() was dropped with LLVM 3.9 and I have troubles installing an older version than 5 using homebrew on macOS. So far I end up with post-fixed llvm-*-3.7 commands which are ignored by cmake. Anyone knows how update AXE to make it compatible with never LLVM versions? @rlsosborne @arp2600