paulsmith / gogeos

Go library for spatial data operations and geometric algorithms (Go bindings for GEOS)
http://paulsmith.github.io/gogeos/
MIT License
280 stars 79 forks source link

Linker error #16

Closed jyutzler closed 8 years ago

jyutzler commented 8 years ago

I am getting the following error when trying to build:

/usr/local/Cellar/go/1.5.3/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: library not found for -lgeos_c clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is probably user error of some sort, but I can't work out what I could have done to cause it. I'm on El Capitan.

Steps I've taken today:

Other things I have done:

Any suggestions on how I can proceed here?

jyutzler commented 8 years ago

More diagnostics: I tried to "build" gogeos. but go build ./... exits quietly. It wasn't until I tried go test that I got anywhere.

JeffYutzler$ go test ./...
# github.com/paulsmith/gogeos/geos
In file included from geos/coordseq.go:4:
./geos.h:1:10: fatal error: 'geos_c.h' file not found
#include <geos_c.h>
         ^
1 error generated.
FAIL    github.com/paulsmith/gogeos/geos [build failed]

There is geos_c.h in /usr/local/include and that is the only copy in the filesystem. There is no /usr/include directory. A call to cpp -v lists the nonexistent /usr/include and does not list /usr/local/include. When I did export CPATH=/usr/local/include that got /usr/local/include onto the cpp list and got me past the missing header error and led to the first error message in the parent post.

There is no library called geos.*. In /usr/local/lib there are a bunch of things like libgeos.a, libgeos_c.a, libgeos_c.dylib, etc.

JeffYutzler$ clang -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Naturally there is nothing relevant in the /Applications/... directory.

jyutzler commented 8 years ago

SOLUTION: export LIBRARY_PATH=/usr/local/lib

ruchit2801 commented 2 years ago

export CPATH=/opt/homebrew/Cellar/geos/3.10.2/include/ helped me solve the issue.