[LLVMdev] Using LLVM on OS X 10.9.5
Geoff Shannon
geoffpshannon at gmail.com
Wed Oct 22 10:11:40 PDT 2014
Hi there,
I'm trying to get set up to build things using the LLVM libraries and I'm
running into issues with my toolchain.
Specifically, they seem to revolve around getting the correct versions of
tools, the linker not being able to find certain .a files.
So my quick specific question is, will it be problematic if I install llvm
under say /usr? Any known pitfalls?
More context follows:
Currently, I have a downloaded copy of LLVM 3.5 along with Clang,
compiler-rt, libcxx, libcxxabi all extracted to the appropriate places in
the source tree, and I'm building it using Cmake. This builds correctly,
but I'm not sure how to setup my project to use both the tools and the
libraries that are built from this source tree.
I've read through the page on creating an LLVM project, and combined with
that information and the information on building LLVM with Cmake, I decided
to put my new project in the projects subdirectory of llvm source. My
CMakeLists.txt file is attached. Using this strategy my code is included
in the LLVM build, but when I try to include LLVM support for doing command
line processing I get the output in out.txt. The output of running `env`
is in env.txt.
If anybody has any suggestions on reading I should do to prepare my
toolchain better I would be very appreciative. Also, comments and
suggestions about how to setup this new project would be greatly
appreciated.
--
Geoff
Nothing is ever easy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141022/2e609efc/attachment.html>
-------------- next part --------------
# CMake build for postfix language
project(postfix)
add_executable(postfix postfix.cpp)
# Find the libraries that correspond to the LLVM components
# that we wish to use
llvm_map_components_to_libnames(llvm_libs support core)
# Link against LLVM libraries
target_link_libraries(postfix ${llvm_libs})
-------------- next part --------------
[1/1] Linking CXX executable bin/postfix
FAILED: : && /usr/bin/c++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fcolor-diagnostics -Wl,-search_paths_first -Wl,-headerpad_max_install_names projects/postfix/CMakeFiles/postfix.dir/postfix.cpp.o -o bin/postfix lib/libLLVMSupport.a lib/libLLVMCore.a lib/libLLVMSupport.a -lcurses -lpthread -lz -Wl,-rpath, at executable_path/../lib && :
Undefined symbols for architecture x86_64:
"typeinfo for llvm::cl::GenericOptionValue", referenced from:
typeinfo for llvm::cl::OptionValueCopy<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > in postfix.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)
ninja: build stopped: subcommand failed.
-------------- next part --------------
CAML_LD_LIBRARY_PATH=/Users/geoff/.opam/4.02.0/lib/stublibs
GIT_PS1_SHOWDIRTYSTATE=1
MANPATH=/Users/geoff/.opam/4.02.0/man:
TERM_PROGRAM=iTerm.app
PIP_REQUIRE_VIRTUALENV=true
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/lc/jkyrhxvx513gss3xkx092xfw0000gn/T/
PERL5LIB=/Users/geoff/.opam/4.02.0/lib/perl5
Apple_PubSub_Socket_Render=/tmp/launch-ynp56x/Render
OCAML_TOPLEVEL_PATH=/Users/geoff/.opam/4.02.0/lib/toplevel
USER=geoff
SSH_AUTH_SOCK=/tmp/launch-0WVgEh/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PYENV_VIRTUALENV_INIT=1
MAVEN_OPTS=-Xmx2048m
__CHECKFIX1436934=1
PATH=/Users/geoff/.opam/4.02.0/bin:/Users/geoff/.pyenv/shims:/Users/geoff/.rbenv/shims:/usr/local/opt/coreutils/libexec/gnubin:/bin:/usr/local/bin:/Users/geoff/local/bin:/Users/geoff/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/texbin:/bin:/Users/geoff/local/android-sdk-linux/tools:/Users/geoff/local/android-sdk-linux/platform-tools:/Users/geoff/local/gradle-1.12/bin
PWD=/Users/geoff/prog/cpp/build
EDITOR=emacsclient -a ""
LANG=en_US.UTF-8
ITERM_PROFILE=Default
GIT_PS1_SHOWUNTRACKEDFILES=1
PYENV_SHELL=bash
M2_HOME=/usr/share/maven
SHLVL=1
COLORFGBG=7;0
HOME=/Users/geoff
GIT_PS1_SHOWSTASHSTATE=1
ITERM_SESSION_ID=w0t0p0
LOGNAME=geoff
GIT_PS1_SHOWUPSTREAM=1
DISPLAY=/tmp/launch-jicdwW/org.macosforge.xquartz:0
OLDPWD=/Users/geoff/prog/cpp/install-build
_=/usr/local/opt/coreutils/libexec/gnubin/env
More information about the llvm-dev
mailing list