Closed joeblew99 closed 7 years ago
Ok i found cgogen :)
Now have a more helpful erro i hope
x-MacBook-Pro:nuklear apple$ pwd
/Users/apple/workspace/go/src/github.com/golang-ui/nuklear
x-MacBook-Pro:nuklear apple$ make
cgogen nk.yml
processing nk.yml ⠹[ERR] /usr/local/include/GLFW/glfw3.h:140:12: include file not found: OpenGL/gl.h
make: *** [all] Error 1
Hmm, so lets see whats over there:
x-MacBook-Pro:nuklear apple$ cd /usr/local/include/GLFW
x-MacBook-Pro:GLFW apple$ ls
glfw3.h glfw3native.h
x-MacBook-Pro:GLFW apple$
@joeblew99 Hi!
1) You don't need to run cgogen, it's a developer's tool, used to generate a Go <-> C wrapper for Nuklear.
2) You need to follow OS X installation instructions as in here https://github.com/golang-ui/nuklear#os-x
$ brew install glfw3
To install GLFW3 into your system.
3) Successful compilation of $GOPATH/src/github.com/go-gl/glfw/v3.2/glfw
is irrelevant here, because they distribute the sources within and compile them on the fly for their package only.
Nuklear C sources themselves need access to GLFW3 shared libs too, those should be installed in system.
I hope this helps.
hey @xlab i already had it installed.
x-MacBook-Pro:GLFW apple$ brew install glfw3
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (dart-lang/dart, homebrew/core).
==> New Formulae
gst-rtsp-server
==> Updated Formulae
heroku
Warning: glfw-3.2.1 already installed
x-MacBook-Pro:GLFW apple$
trying the example again:
x-MacBook-Pro:gu-x apple$ cd /Users/apple/workspace/go/src/github.com/golang-ui/nuklear/cmd/nk-example
x-MacBook-Pro:nk-example apple$ go build
# github.com/golang-ui/nuklear/nk
ld: library not found for -lglfw3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
go version
go version go1.7.4 darwin/amd64
@joeblew99 this is strange, the brew libs should be accessible by the linker in default configuration.. By the way, you can avoid this issue by running it that way:
$ CGO_LDFLAGS="-L/usr/local/Cellar/glfw3/3.2.1/lib" go build
Check the correctness of the path. This will tell linker where to search GFLW libs explicitly.
P.S.
$ pkg-config --libs glfw3
-L/usr/local/Cellar/glfw3/3.2.1/lib -lglfw3
suggests correct ldflags
@xlab thanks for the tip...
ok so where does it live ?
x-MacBook-Pro:nuklear apple$ pkg-config --libs glfw3
-L/usr/local/Cellar/glfw/3.2.1/lib -lglfw
so, I try to run the example again hinting the location, but same error:
x-MacBook-Pro:nk-example apple$ pwd
/Users/apple/workspace/go/src/github.com/golang-ui/nuklear/cmd/nk-example
x-MacBook-Pro:nk-example apple$ CGO_LDFLAGS="-L/usr/local/Cellar/glfw/3.2.1/lib" go build
# github.com/golang-ui/nuklear/nk
ld: library not found for -lglfw3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So, go check the folder for glfw:
x-MacBook-Pro:lib apple$ pwd
/usr/local/Cellar/glfw/3.2.1/lib
x-MacBook-Pro:lib apple$ ls
cmake libglfw.3.2.dylib libglfw.3.dylib libglfw.dylib pkgconfig
What about building from root ?
x-MacBook-Pro:nuklear apple$ pwd
/Users/apple/workspace/go/src/github.com/golang-ui/nuklear
x-MacBook-Pro:nuklear apple$ make
cgogen nk.yml
processing nk.yml ⠹[ERR] /usr/local/include/GLFW/glfw3.h:140:12: include file not found: OpenGL/gl.h
make: *** [all] Error 1
SO, it cant find the gl.h file it seems. Lets see if its there:
x-MacBook-Pro:nuklear apple$ cd /usr/local/include/GLFW/
x-MacBook-Pro:GLFW apple$ ls -al
total 336
drwxr-xr-x 4 apple admin 136 Aug 18 13:32 .
drwxr-xr-x 3 apple admin 102 Aug 18 13:32 ..
-rw-r--r-- 1 apple admin 152470 Aug 18 13:32 glfw3.h
-rw-r--r-- 1 apple admin 13594 Aug 18 13:32 glfw3native.h
x-MacBook-Pro:GLFW apple$
This is a long shot but, I remember a few months ago with OSX update that brew permissions went a bit weird. If there a way to check permissions are correct inside /usr/local/Cellar/glfw/3.2.1/lib ?
@joeblew99 please don't try to run make
in this context, it simply starts cgogen which have nothing to do with installation & usage of this package. This is a cool tool though, but let's handle a single problem at a time.
The problem we have is with linker and GLFW shared library.
On my machine:
$ ls -la /usr/local/Cellar/glfw/3.2.1/lib
ls: /usr/local/Cellar/glfw/3.2.1/lib: No such file or directory
$ ls -la /usr/local/Cellar/glfw3/3.2.1/lib
total 232
drwxr-xr-x 7 xlab wheel 238 Nov 30 23:51 ./
drwxr-xr-x 8 xlab wheel 272 Dec 6 16:04 ../
drwxr-xr-x 3 xlab wheel 102 Nov 30 23:51 cmake/
-r--r--r-- 1 xlab wheel 107492 Nov 30 23:51 libglfw3.3.2.dylib
lrwxr-xr-x 1 xlab wheel 18 Nov 30 23:51 libglfw3.3.dylib@ -> libglfw3.3.2.dylib
lrwxr-xr-x 1 xlab wheel 16 Nov 30 23:51 libglfw3.dylib@ -> libglfw3.3.dylib
drwxr-xr-x 3 xlab wheel 102 Nov 30 23:51 pkgconfig/
I think you could reinstall the lib, making sure that no residual files remain. Sorry for such inconvenience, managing shared C dependencies could be painful sometimes (if not always).
Sorry about garbage last message. I deleted it.
i am looking into it.
I uninstalled brew and reinstalled it then did a "brew install glfw3", but it puts it in: ls -la /usr/local/Cellar/glfw/3.2.1/lib
Cant work out why, but i saw it happening on a few other gists on github.
Just not sure whats going on right now...
I reinstalled GLFW3 via brew again and now I have /usr/local/Cellar/glfw/3.2.1/lib
too.
Also:
$ ls -la /usr/local/lib/libglfw*
lrwxr-xr-x 1 xlab wheel 42 Dec 8 16:58 /usr/local/lib/libglfw.3.2.dylib@ -> ../Cellar/glfw/3.2.1/lib/libglfw.3.2.dylib
lrwxr-xr-x 1 xlab wheel 40 Dec 8 16:58 /usr/local/lib/libglfw.3.dylib@ -> ../Cellar/glfw/3.2.1/lib/libglfw.3.dylib
lrwxr-xr-x 1 xlab wheel 38 Dec 8 16:58 /usr/local/lib/libglfw.dylib@ -> ../Cellar/glfw/3.2.1/lib/libglfw.dylib
-rw-r--r-- 1 xlab wheel 190944 Nov 6 23:26 /usr/local/lib/libglfw3.a
And nuklear installs fine... :/
Try
go build -v --ldflags '-extldflags "-L/usr/local/lib"'
On so we now have the same location of the libs. But i dont have the "/usr/local/lib/libglfw3.a". Not sure why:
x-MacBook-Pro:nk-example apple$ pwd
/Users/apple/workspace/go/src/github.com/golang-ui/nuklear/cmd/nk-example
x-MacBook-Pro:nk-example apple$ ls -la /usr/local/lib/libglfw*
lrwxr-xr-x 1 apple admin 42 Dec 8 14:03 /usr/local/lib/libglfw.3.2.dylib -> ../Cellar/glfw/3.2.1/lib/libglfw.3.2.dylib
lrwxr-xr-x 1 apple admin 40 Dec 8 14:03 /usr/local/lib/libglfw.3.dylib -> ../Cellar/glfw/3.2.1/lib/libglfw.3.dylib
lrwxr-xr-x 1 apple admin 38 Dec 8 14:03 /usr/local/lib/libglfw.dylib -> ../Cellar/glfw/3.2.1/lib/libglfw.dylib
when i try to build, it fails:
x-MacBook-Pro:nk-example apple$ go build -v --ldflags '-extldflags "-L/usr/local/lib"'
github.com/golang-ui/nuklear/nk
# github.com/golang-ui/nuklear/nk
ld: library not found for -lglfw3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Because i dont have the "/usr/local/lib/libglfw3.a", its failing ?
I removed it and now my build fails with the same error. Apparently they broke GLFW 6 days ago https://github.com/Homebrew/homebrew-core/commit/283671e26449a6261bda080253229e2bd13b3099
GJ WP -___-
The solution is to install GLFW this way:
$ brew install --without-shared-library glfw3
Now it's ok for me, please check @joeblew99
works for me too, using both ways of building.
go build -v --ldflags '-extldflags "-L/usr/local/lib"'
go build
thanks for adding the brew install instructions to the readme until they fix it, and persisting with me to sort this out. I learnt allot about shared libs just going through this with you.
Shall we close this ?
Might be worth adding the brew install instructions to the readme until they fix it.
Yes, I've added to both READMEs (see commits above). Thanks for your reports, that was tough stuff.
I am trying to do a build of the example, but got a small issue
so, i tried to do a build form root, but make fails because it cant find cgogen. where can i get cgogen ?
__
Also i checked that glfw works so we knows that good.