tinygo-org/go-llvm

Not linking llvm

Nv7-GitHub opened this issue · 3 comments

I did

go get github.com/tinygo-org/go-llvm

But it can't seem to link LLVM.

# runtime/cgo
ld: library not found for -lLLVM-12.0.0
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

I installed LLVM through homebrew:

brew install llvm
brew info llvm

gives me

llvm: stable 12.0.0 (bottled), HEAD [keg-only]
Next-gen compiler infrastructure
https://llvm.org/
/usr/local/Cellar/llvm/12.0.0_1 (9,789 files, 1.5GB)
  Poured from bottle on 2021-05-17 at 18:19:34
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/llvm.rb
License: Apache-2.0 with LLVM-exception
==> Dependencies
Build: cmake ✔, swig ✔
Required: python@3.9 ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
To use the bundled libc++ please add the following LDFLAGS:
  LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"

llvm is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have llvm first in your PATH, run:
  echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/nishant/.bash_profile

For compilers to find llvm you may need to set:
  export LDFLAGS="-L/usr/local/opt/llvm/lib"
  export CPPFLAGS="-I/usr/local/opt/llvm/include"

==> Analytics
install: 25,459 (30 days), 71,165 (90 days), 235,541 (365 days)
install-on-request: 20,777 (30 days), 57,293 (90 days), 188,131 (365 days)
build-error: 0 (30 days)

I'm going to try getting LLVM 9, maybe that will work

By using

brew install llvm@9

with my fork: https://github.com/Nv7-GitHub/go-llvm I was able to get it to compile!

fgsch commented

I think this can be closed as well now.