Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld: symbol(s) not found for architecture i386 #1020

Closed
mcandre opened this issue Oct 9, 2011 · 7 comments
Closed

ld: symbol(s) not found for architecture i386 #1020

mcandre opened this issue Oct 9, 2011 · 7 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries O-macos Operating system: macOS

Comments

@mcandre
Copy link

mcandre commented Oct 9, 2011

Specs:

  • LLVM 3.0 SVN

  • Mac OS X 10.7.1 Lion

    $ ./configure
    ...
    $ make
    ...
    "_LLVMWriteBitcodeToFile", referenced from:
    -exported_symbol[s_list] command line option
    "_LLVMWriteBitcodeToFileHandle", referenced from:
    -exported_symbol[s_list] command line option
    "_LLVMX86FP80Type", referenced from:
    -exported_symbol[s_list] command line option
    "_LLVMX86FP80TypeInContext", referenced from:
    -exported_symbol[s_list] command line option
    "_LLVMX86MMXType", referenced from:
    -exported_symbol[s_list] command line option
    "_LLVMX86MMXTypeInContext", referenced from:
    -exported_symbol[s_list] command line option
    "_LLVMConstNamedStruct", referenced from:
    -exported_symbol[s_list] command line option
    "_LLVMStructCreateNamed", referenced from:
    -exported_symbol[s_list] command line option
    "_LLVMStructSetBody", referenced from:
    -exported_symbol[s_list] command line option
    ld: symbol(s) not found for architecture i386
    collect2: ld returned 1 exit status
    make: *** [rustllvm/librustllvm.dylib] Error 1

@brson
Copy link
Contributor

brson commented Oct 9, 2011

Possibly LLVM isn't compiled for 32-bit, or maybe configure is picking up the wrong LLVM install.

otool -hv $CFG_LLVM_ROOT/lib/libLLVMCore.a should show the cputype as I386, not X86_64 (where $CFG_LLVM_ROOT is wherever LLVM is installed).

The getting started page on the wiki has some specific flags for configuring LLVM. You may want to confirm that LLVM is built correctly.

https://github.com/graydon/rust/wiki/Getting-started

@mcandre
Copy link
Author

mcandre commented Oct 10, 2011

Thanks, that doc helps a lot.

Homebrew can build a universal LLVM, but it will be LLVM v2.8.

brew install llvm --universal

If Rust could compile with LLVM v2.8, everything would be peachy.

@jckarter
Copy link

Use '-arch i386 -arch x86_64' in place of '-m32' when configuring llvm and it should build universally for you.

@mcandre
Copy link
Author

mcandre commented Oct 11, 2011

I tried ./configure -arch i386 -arch x86_64, but configure doesn't accept these flags. Where exactly do I specify them?

@jckarter
Copy link

@mcandre Use them in place of '-m32' in the CFLAGS etc. for the configure command from the wiki page:

CXX='g++ -arch i386 -arch x86_64' CC='gcc -arch i386 -arch x86_64' CFLAGS='-arch i386 -arch x86_64' CXXFLAGS='-arch i386 -arch x86_64' LDFLAGS='-arch i386 -arch x86_64' ./configure --disable-bindings --{build,host,target}=i686-apple-darwin --enable-targets=x86,x86_64,cbe --enable-optimized

@mcandre
Copy link
Author

mcandre commented Oct 12, 2011

$ CXX='g++ -arch i386 -arch x86_64' CC='gcc -arch i386 -arch x86_64' CFLAGS='-arch i386 -arch x86_64' CXXFLAGS='-arch i386 -arch x86_64' LDFLAGS='-arch i386 -arch x86_64' ./configure --disable-bindings --{build,host,target}=i686-apple-darwin --enable-targets=x86,x86_64,cbe --enable-optimized
checking for i686-apple-darwin-clang... gcc -arch i386 -arch x86_64
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -arch i386 -arch x86_64 accepts -g... yes
checking for gcc -arch i386 -arch x86_64 option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -arch i386 -arch x86_64 accepts -g... yes
checking how to run the C preprocessor... /lib/cpp
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.

@graydon
Copy link
Contributor

graydon commented Mar 5, 2012

We are building our own LLVM libs now, this should be obsolete (I think). Closing.

@graydon graydon closed this as completed Mar 5, 2012
bors added a commit that referenced this issue Sep 4, 2018
Update RLS and Rustfmt

RLS
* Allow project model to download crates ([#1020](rust-lang/rls#1020))
* Support simple external builds ([#988](rust-lang/rls#988))
* Support using external Rustfmt ([#990](rust-lang/rls#990))

Rustfmt (0.99.4)
* Format chains with comment ([#2899](https://github.com/rust-lang-nursery/rls/pull/2899))
* Do not show wildcard pattern in slice pattern ([#2912](https://github.com/rust-lang-nursery/rls/pull/2912))
* Impl only use ([#2951](https://github.com/rust-lang-nursery/rls/pull/2951))
* ... and [more](rust-lang/rustfmt@5c9a2b6...1c40881)

Bumped in tandem to pull a single version of `rustc-ap-*` libs.

r? @nrc
bors pushed a commit to rust-lang-ci/rust that referenced this issue Oct 26, 2020
Currently it's not possible to dump llvm-ir in release build. With this
patch we allow it with `--emit llvm-ir`. In debug build we dump clif
always as before.

Fixes rust-lang#1020
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries O-macos Operating system: macOS
Projects
None yet
Development

No branches or pull requests

4 participants