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

Building from git-source throws errors on OS X Yosemite #47

Closed
ghost opened this issue Jun 14, 2015 · 22 comments
Closed

Building from git-source throws errors on OS X Yosemite #47

ghost opened this issue Jun 14, 2015 · 22 comments

Comments

@ghost
Copy link

ghost commented Jun 14, 2015

I downloaded the code using git and try to build glew from it. The commands used were

export GLEW_DEST=/usr/local/glew
make extensions
make

and the resulting error is

ld: dylib lib/libGLEW.dylib missing LC_ID_DYLIB load command file 'lib/libGLEW.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

am I doing something wrong during the compilation?

@nigels-com
Copy link
Owner

Do you mind checking if 1.12.0 has the same problem. I'm still on OSX 10.9...

@nigels-com
Copy link
Owner

See also: http://sourceforge.net/p/glew/bugs/270/

@nigels-com
Copy link
Owner

Some more of the failing build log might also help shed some light.

@ghost
Copy link
Author

ghost commented Jun 17, 2015

Sorry to ask but, where/how can I see the build log?

@nigels-com
Copy link
Owner

Everything on the console following the make command, would be helpful.

@ghost
Copy link
Author

ghost commented Aug 25, 2015

I downloaded today the latest commit cbd0dce and run the same commands as when opened the issue in OS X 10.10.5. The resulting output is the following

$ make
mkdir lib
cc -DGLEW_NO_GLU -DGLEW_BUILD -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC  -o tmp/darwin/default/shared/glew.o -c src/glew.c
cc -dynamiclib -install_name /usr/local/glew/lib/libGLEW.1.13.0.dylib -current_version 1.13.0 -compatibility_version 1.13 -o lib/libGLEW.1.13.0.dylib tmp/darwin/default/shared/glew.o  -framework OpenGL 
ln -sf libGLEW.1.13.0.dylib lib/libGLEW.1.13.dylib
ln -sf libGLEW.1.13.0.dylib lib/libGLEW.dylib
strip -x lib/libGLEW.1.13.0.dylib
cc -DGLEW_NO_GLU -DGLEW_STATIC -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC  -o tmp/darwin/default/static/glew.o -c src/glew.c
ar rv lib/libGLEW.a tmp/darwin/default/static/glew.o
ar: creating lib/libGLEW.a
a - tmp/darwin/default/static/glew.o
strip -x lib/libGLEW.a
sed \
        -e "s|@prefix@|/usr|g" \
        -e "s|@libdir@|/usr/local/glew/lib|g" \
        -e "s|@exec_prefix@|/usr/local/glew/bin|g" \
        -e "s|@includedir@|/usr/local/glew/include/GL|g" \
        -e "s|@version@|1.13.0|g" \
        -e "s|@cflags@||g" \
        -e "s|@libname@|GLEW|g" \
        -e "s|@requireslib@|glu|g" \
        < glew.pc.in > glew.pc
cc -DGLEW_NO_GLU -DGLEW_MX -DGLEW_BUILD -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC  -o tmp/darwin/mx/shared/glew.o -c src/glew.c
cc -dynamiclib -install_name /usr/local/glew/lib/libGLEWmx.1.13.0.dylib -current_version 1.13.0 -compatibility_version 1.13 -o lib/libGLEWmx.1.13.0.dylib tmp/darwin/mx/shared/glew.o  -framework OpenGL 
ln -sf libGLEWmx.1.13.0.dylib lib/libGLEWmx.1.13.dylib
ln -sf libGLEWmx.1.13.0.dylib lib/libGLEWmx.dylib
strip -x lib/libGLEWmx.1.13.0.dylib
cc -DGLEW_NO_GLU -DGLEW_MX -DGLEW_STATIC -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC  -o tmp/darwin/mx/static/glew.o -c src/glew.c
ar rv lib/libGLEWmx.a tmp/darwin/mx/static/glew.o
ar: creating lib/libGLEWmx.a
a - tmp/darwin/mx/static/glew.o
strip -x lib/libGLEWmx.a
sed \
        -e "s|@prefix@|/usr|g" \
        -e "s|@libdir@|/usr/local/glew/lib|g" \
        -e "s|@exec_prefix@|/usr/local/glew/bin|g" \
        -e "s|@includedir@|/usr/local/glew/include/GL|g" \
        -e "s|@version@|1.13.0|g" \
        -e "s|@cflags@|-DGLEW_MX|g" \
        -e "s|@libname@|GLEWmx|g" \
        -e "s|@requireslib@|glu|g" \
        < glew.pc.in > glewmx.pc
mkdir bin
cc -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC  -o tmp/darwin/default/shared/glewinfo.o -c src/glewinfo.c
cc -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC -o bin/glewinfo tmp/darwin/default/shared/glewinfo.o -Llib  -lGLEW  -framework OpenGL
clang: warning: argument unused during compilation: '-ansi'
ld: dylib lib/libGLEW.dylib missing LC_ID_DYLIB load command file 'lib/libGLEW.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/glewinfo] Error 1

@tamaskenez
Copy link
Contributor

On my 10.10.5 the same commit builds fine. Could be some local issue.

$ cc --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

@ghost
Copy link
Author

ghost commented Aug 26, 2015

This is my configuration

$ cc --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Looks pretty much the same. Could you post the commands you are executing?

@ghost
Copy link
Author

ghost commented Aug 26, 2015

I tried to debug the makefile to see what is missing. Using make -n the following lines are the ones to be executed

cc -O2 -Wall -W -Iinclude -dynamic -fno-common -ansi -pedantic -fPIC -o bin/glewinfo tmp/darwin/default/shared/glewinfo.o -Llib  -lGLEW  -framework OpenGL

and that line is the one that's breaking the make. Any clue?

@ghost
Copy link
Author

ghost commented Aug 26, 2015

Ok, somehow the strip commands are causing the error of ld: dylib lib/libGLEW.dylib missing LC_ID_DYLIB load command file 'lib/libGLEW.dylib' for architecture x86_64 I commented out all the lines calling the strip command and I was able to build glew, haven't tried it yet though.

@nigels-com
Copy link
Owner

Oh! Specify STRIP= on the command line, to disable that step.

@ghost
Copy link
Author

ghost commented Aug 26, 2015

But should I actually disable the strip command or should it work even with it?

@nigels-com
Copy link
Owner

Sounds like a bug or incompatibility between the compiler and strip. Stripping is optional, so use STRIP= to skip it.

@ghost
Copy link
Author

ghost commented Aug 26, 2015

Hope @tamaskenez share the building commands, because apparently it worked for him smoothly. I'll try the STRIP= and try to build a simple program.

@ghost
Copy link
Author

ghost commented Aug 26, 2015

Find a solution to building and linking to my app in the issue #13

@tamaskenez
Copy link
Contributor

@BRabbit27 I used the exact 3 command from your first post

@ghost
Copy link
Author

ghost commented Aug 28, 2015

@nigels-com @tamaskenez do you have any idea on what could be the problem? I haven't made any major configuration change on my system.
Is there a way to compare some of your configuration with mine and try to narrow the problem?

@tamaskenez
Copy link
Contributor

I'm not familiar with the LC_ID_DYLIB setting but let me know what I should check on my system and I'll post it here.
Also you can try to build it with CMake. You need the CMake tool in your path (the macports version is fine) and simply launch cmake-testbuild.sh

@ghost
Copy link
Author

ghost commented Aug 28, 2015

@tamaskenez yes, as I commented already, using cmake builds correctly the library. I guess is the same kind of building between Makefile and Cmake, so I don't understand why one works and the other don't.

@nigels-com
Copy link
Owner

I just might have to dust off my busted up old MacBook Pro and see if it can cope with Yosemite.

@nigels-com
Copy link
Owner

(I'm still holding out for a new MacBook Pro, even though Santa failed to deliver on that)

@nigels-com
Copy link
Owner

These worked for me on 10.12.1, closing.
Thanks for the report.

$ make extensions clean all SYSTEM=darwin
$ make extensions clean all SYSTEM=darwin-universal
...
$ file lib/libGLEW.dylib 
lib/libGLEW.dylib: Mach-O universal binary with 2 architectures: [i386: Mach-O dynamically linked shared library i386] [x86_64: Mach-O 64-bit dynamically linked shared library x86_64]
lib/libGLEW.dylib (for architecture i386):  Mach-O dynamically linked shared library i386
lib/libGLEW.dylib (for architecture x86_64):    Mach-O 64-bit dynamically linked shared library x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants