Neopallium / llvm-lua

Automatically exported from code.google.com/p/llvm-lua
Other
152 stars 24 forks source link

Mac OS X Framework compilation fails on Leopard #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. open a console
2. get the latest SVN sources (with the cmake fix)
3. enter the directory
4. type 'cmake .'
5. type 'make'

What is the expected output? What do you see instead?
The compilation of the Framework fails at link time, complaining about
undefined symbols (see attached file for details). 

What version of the product are you using? On what operating system?
Latest SVN sources (revision 112) on Mac OS X Leopard.

Please provide any additional information below.

Original issue reported on code.google.com by ni...@mageos.com on 16 Nov 2009 at 12:18

Attachments:

GoogleCodeExporter commented 8 years ago
please run:
make VERBOSE=1

and attach the output from that.

It looks like the link step is not finding all the LLVM libs.

also attach the output from these commands:
llvm-config --ldflags
llvm-config --libfiles core jit native linker bitreader bitwriter ipo

Original comment by rjakabo...@gmail.com on 16 Nov 2009 at 12:31

GoogleCodeExporter commented 8 years ago
For info, I've checked that I have only one copy of LLVM libs installed (in
/usr/local). Also note that I am using the precompiled package
llvm-2.6-i386-darwin9.tar.gz for simplicity : perhaps the build options are not 
the
same and I'll need to compile the source version instead...

> llvm-config --ldflags
-L/usr/local/lib  -lpthread -lffi -lm

> llvm-config --libfiles core jit native linker bitreader bitwriter ipo
/usr/local/lib/libLLVMipo.a /usr/local/lib/libLLVMBitWriter.a
/usr/local/lib/libLLVMLinker.a /usr/local/lib/libLLVMArchive.a
/usr/local/lib/libLLVMBitReader.a /usr/local/lib/libLLVMX86AsmParser.a
/usr/local/lib/libLLVMX86AsmPrinter.a /usr/local/lib/libLLVMX86CodeGen.a
/usr/local/lib/libLLVMSelectionDAG.a /usr/local/lib/libLLVMAsmPrinter.a
/usr/local/lib/libLLVMX86Info.a /usr/local/lib/libLLVMJIT.a
/usr/local/lib/libLLVMExecutionEngine.a /usr/local/lib/libLLVMCodeGen.a
/usr/local/lib/libLLVMScalarOpts.a /usr/local/lib/libLLVMTransformUtils.a
/usr/local/lib/libLLVMipa.a /usr/local/lib/libLLVMAnalysis.a
/usr/local/lib/libLLVMTarget.a /usr/local/lib/libLLVMMC.a
/usr/local/lib/libLLVMCore.a /usr/local/lib/libLLVMSupport.a
/usr/local/lib/libLLVMSystem.a

Original comment by ni...@mageos.com on 16 Nov 2009 at 12:44

Attachments:

GoogleCodeExporter commented 8 years ago
run ccmake .
and check the value of: LLVM_CONFIG_EXECUTABLE
to make sure it is pointing to the full path of your llvm-config binary.

I don't think this is an issue with how LLVM was built.

Original comment by rjakabo...@gmail.com on 16 Nov 2009 at 12:56

GoogleCodeExporter commented 8 years ago
Yes it seems to be ok for the value of LLVM_CONFIG_EXECUTABLE. 
Here are all values :

CMAKE_BACKWARDS_COMPATIBILITY    2.4
CMAKE_BUILD_TYPE
CMAKE_BUILD_WITH_INSTALL_RPATH   ON
CMAKE_DYLIB_INSTALL_NAME_DIR     /usr/local/lib
CMAKE_FRAMEWORK_INSTALL_DIR      /Library/Frameworks
CMAKE_FRAMEWORK_INSTALL_NAME_D   @executable_path/../Frameworks
CMAKE_INSTALL_PREFIX             /usr/local
CMAKE_OSX_ARCHITECTURES
CMAKE_OSX_DEPLOYMENT_TARGET      10.5
CMAKE_OSX_SYSROOT                /Developer/SDKs/MacOSX10.5.sdk
COCO_DEFAULT_CSTACKSIZE
COCO_DISABLE                     OFF
COCO_USE_SETJMP                  OFF
COCO_USE_UCONTEXT                OFF
CROSS_ARCH                       arm
CROSS_COMPILE                    OFF
CROSS_CPU                        arm1176jzf-s
CROSS_ISYSTEM
CROSS_TRIPLE                     arm-apple-darwin9
CURSES_CURSES_H_PATH             /usr/include
CURSES_FORM_LIBRARY              /usr/lib/libform.dylib
CURSES_HAVE_CURSES_H             /usr/include/curses.h
EXECUTABLE_OUTPUT_PATH
FORCE_ALIGNMENT                  4
LIBRARY_OUTPUT_PATH
LLVM_CC                          clang
LLVM_CONFIG_EXECUTABLE           /usr/local/bin/llvm-config
LUA_ANSI                         OFF
LUA_CPP_SUPPORT                  OFF
LUA_FRAMEWORK_SYMLINKS           ON
LUA_USE_APICHECK                 OFF
LUA_USE_CURSES                   ON
LUA_USE_DLOPEN                   ON
LUA_USE_ISATTY                   ON
LUA_USE_MACOSX                   OFF
LUA_USE_MKSTEMP                  ON
LUA_USE_POPEN                    ON
LUA_USE_READLINE                 OFF
LUA_USE_ULONGJMP                 ON
OSX_ARCHITECTURES                ppc;i386;ppc64;x86_64
WANT_FRAMEWORK                   ON
WANT_SHARED_LIBRARY              ON
WANT_STATIC_LIBRARY              ON

Also here are some additional checks I've made :

> /usr/local/bin/llvm-config --version
2.6

> clang --version
clang version 1.0 (https://llvm.org/svn/llvm-project/cfe/branches/release_26 
exported)
Target: i386-apple-darwin9
Thread model: posix

Original comment by ni...@mageos.com on 16 Nov 2009 at 1:19

GoogleCodeExporter commented 8 years ago
This may not fix it but try changing OSX_ARCHITECTURES to just i386.

I am not sure if the i386 LLVM release build has fat-binaries with these arch:
ppc;ppc64;x86_64

Also if you don't need llvm-lua built as a Framework, then disable 
WANT_FRAMEWORK. 
That could get it to build.

I don't have a Mac for testing so the Framework cmake build process is not well 
tested.

Original comment by rjakabo...@gmail.com on 16 Nov 2009 at 11:50

GoogleCodeExporter commented 8 years ago
To help debug the problem with the llvm libraries apply the attached patch and
attach the output from:
cmake .

The patch adds some messages that print the list of libraries linked to the 
llvm-luac
& llvm-lua binaries.

Original comment by rjakabo...@gmail.com on 17 Nov 2009 at 12:11

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

So using i386 only did not help.
After applying the patch here is the output of 'cmake .' :

llvm-luac libraries:
llvm-lua_static;/usr/local/lib/libLLVMXCoreCodeGen.a;/usr/local/lib/libLLVMXCore
AsmPrinter.a;/usr/local/lib/libLLVMXCoreInfo.a;/usr/local/lib/libLLVMSystemZCode
Gen.a;/usr/local/lib/libLLVMSystemZAsmPrinter.a;/usr/local/lib/libLLVMSystemZInf
o.a;/usr/local/lib/libLLVMSparcCodeGen.a;/usr/local/lib/libLLVMSparcAsmPrinter.a
;/usr/local/lib/libLLVMSparcInfo.a;/usr/local/lib/libLLVMPowerPCCodeGen.a;/usr/l
ocal/lib/libLLVMPowerPCAsmPrinter.a;/usr/local/lib/libLLVMPowerPCInfo.a;/usr/loc
al/lib/libLLVMPIC16AsmPrinter.a;/usr/local/lib/libLLVMPIC16CodeGen.a;/usr/local/
lib/libLLVMPIC16Info.a;/usr/local/lib/libLLVMMSP430CodeGen.a;/usr/local/lib/libL
LVMMSP430AsmPrinter.a;/usr/local/lib/libLLVMMSP430Info.a;/usr/local/lib/libLLVMM
SIL.a;/usr/local/lib/libLLVMMSILInfo.a;/usr/local/lib/libLLVMMipsAsmPrinter.a;/u
sr/local/lib/libLLVMMipsCodeGen.a;/usr/local/lib/libLLVMMipsInfo.a;/usr/local/li
b/libLLVMLinker.a;/usr/local/lib/libLLVMipo.a;/usr/local/lib/libLLVMInterpreter.
a;/usr/local/lib/libLLVMInstrumentation.a;/usr/local/lib/libLLVMJIT.a;/usr/local
/lib/libLLVMExecutionEngine.a;/usr/local/lib/libLLVMDebugger.a;/usr/local/lib/li
bLLVMCppBackend.a;/usr/local/lib/libLLVMCppBackendInfo.a;/usr/local/lib/libLLVMC
ellSPUCodeGen.a;/usr/local/lib/libLLVMCellSPUAsmPrinter.a;/usr/local/lib/libLLVM
CellSPUInfo.a;/usr/local/lib/libLLVMCBackend.a;/usr/local/lib/libLLVMCBackendInf
o.a;/usr/local/lib/libLLVMBlackfinCodeGen.a;/usr/local/lib/libLLVMBlackfinAsmPri
nter.a;/usr/local/lib/libLLVMBlackfinInfo.a;/usr/local/lib/libLLVMBitWriter.a;/u
sr/local/lib/libLLVMX86AsmParser.a;/usr/local/lib/libLLVMX86AsmPrinter.a;/usr/lo
cal/lib/libLLVMX86CodeGen.a;/usr/local/lib/libLLVMX86Info.a;/usr/local/lib/libLL
VMAsmParser.a;/usr/local/lib/libLLVMARMAsmPrinter.a;/usr/local/lib/libLLVMARMCod
eGen.a;/usr/local/lib/libLLVMARMInfo.a;/usr/local/lib/libLLVMArchive.a;/usr/loca
l/lib/libLLVMBitReader.a;/usr/local/lib/libLLVMAlphaCodeGen.a;/usr/local/lib/lib
LLVMSelectionDAG.a;/usr/local/lib/libLLVMAlphaAsmPrinter.a;/usr/local/lib/libLLV
MAsmPrinter.a;/usr/local/lib/libLLVMCodeGen.a;/usr/local/lib/libLLVMScalarOpts.a
;/usr/local/lib/libLLVMTransformUtils.a;/usr/local/lib/libLLVMipa.a;/usr/local/l
ib/libLLVMAnalysis.a;/usr/local/lib/libLLVMTarget.a;/usr/local/lib/libLLVMMC.a;/
usr/local/lib/libLLVMCore.a;/usr/local/lib/libLLVMAlphaInfo.a;/usr/local/lib/lib
LLVMSupport.a;/usr/local/lib/libLLVMSystem.a
llvm-lua libraries:
llvm-lua_dynamic;/usr/local/lib/libLLVMipo.a;/usr/local/lib/libLLVMBitWriter.a;/
usr/local/lib/libLLVMLinker.a;/usr/local/lib/libLLVMArchive.a;/usr/local/lib/lib
LLVMBitReader.a;/usr/local/lib/libLLVMX86AsmParser.a;/usr/local/lib/libLLVMX86As
mPrinter.a;/usr/local/lib/libLLVMX86CodeGen.a;/usr/local/lib/libLLVMSelectionDAG
.a;/usr/local/lib/libLLVMAsmPrinter.a;/usr/local/lib/libLLVMX86Info.a;/usr/local
/lib/libLLVMJIT.a;/usr/local/lib/libLLVMExecutionEngine.a;/usr/local/lib/libLLVM
CodeGen.a;/usr/local/lib/libLLVMScalarOpts.a;/usr/local/lib/libLLVMTransformUtil
s.a;/usr/local/lib/libLLVMipa.a;/usr/local/lib/libLLVMAnalysis.a;/usr/local/lib/
libLLVMTarget.a;/usr/local/lib/libLLVMMC.a;/usr/local/lib/libLLVMCore.a;/usr/loc
al/lib/libLLVMSupport.a;/usr/local/lib/libLLVMSystem.a
-- Configuring done
-- Generating done
-- Build files have been written to: 
/Users/NiCoX/Desktop/LUA_LLVM/llvm-lua-read-only

If I disable WANT_FRAMEWORK, I get the same error but for the dynamic library 
build :

Linking CXX shared library libllvm-lua.dylib
Undefined symbols:
  "llvm::Timer::Timer(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)", referenced from:
      LLVMCompiler::LLVMCompiler(int)in LLVMCompiler.o
      LLVMCompiler::LLVMCompiler(int)in LLVMCompiler.o
      LLVMCompiler::LLVMCompiler(int)in LLVMCompiler.o
      LLVMCompiler::LLVMCompiler(int)in LLVMCompiler.o
      LLVMCompiler::LLVMCompiler(int)in LLVMCompiler.o
      LLVMCompiler::LLVMCompiler(int)in LLVMCompiler.o
      LLVMCompiler::LLVMCompiler(int)in LLVMCompiler.o
      LLVMCompiler::LLVMCompiler(int)in LLVMCompiler.o
  "vtable for llvm::ICmpInst", referenced from:
      __ZTVN4llvm8ICmpInstE$non_lazy_ptr in LLVMCompiler.o
...
...

Original comment by ni...@mageos.com on 18 Nov 2009 at 3:27

GoogleCodeExporter commented 8 years ago
I committed a possible fix for this problem.  Please try the latest svn 
revision. 
Thanks.

Original comment by rjakabo...@gmail.com on 19 Nov 2009 at 12:27

GoogleCodeExporter commented 8 years ago
Unfortunately the problem still remains...
When I have time I'll try to search more deeply what can go wrong, and I hope 
suggest
a fix.
Thanks.

Original comment by ni...@mageos.com on 19 Nov 2009 at 4:50

GoogleCodeExporter commented 8 years ago
Hi, 

I struggled with same issue on my MAC OS X (10.5) box, like Nicox. 
Are there some more hints what i can check.

Thx in advance.

Original comment by volke...@gmail.com on 29 Nov 2009 at 6:54

GoogleCodeExporter commented 8 years ago
If Mac OSX users are still have this problem with the latest version of the 
code from git, then please re-open this issue with full details from the build 
output.

Original comment by rjakabo...@gmail.com on 3 Jun 2012 at 9:28