[GRASS-user] Problems with OpenGL when compiling grass-6.4.0 on Mac OS X 10.5.4

William Kyngesburye woklist at kyngchaos.com
Sun Sep 21 14:20:41 EDT 2008


On Sep 21, 2008, at 12:20 PM, Elvis Dowson wrote:

> Hi William,
>                       Upon looking more closely at the config.log
>
> configure:11340: gcc -o conftest -g -O2      conftest.c    -lGL   1>&5
> ld: library not found for -lGL
> collect2: ld returned 1 exit status
> configure: failed program was:
>
>
> I see that ld could not find the GL libraries for some reason.
>
One thing to watch out for is the -g flag.  This causes configure  
errors with the latest Xcode.  export CFLAGS and CXXFLAGS with -Os  
before configuring.

export CFLAGS=-Os
export CXXFLAGS=-Os

If you need debug symbols, add -g back into platform.make after  
configuration (to CFLAGS1 & CXXFLAGS1).

> However, I have put this in my .profile. The location I have put is  
> usr/X11/lib . Is this the correct location?
>
> # environment variables
> export QTROOT=/usr/local/qt-4.4.1
> export GRASS_TCLSH=/usr/X11R6/bin/tclsh
> export GRASS_WISH=/usr/X11R6/bin/wish
> export VTK_DIR=/Users/elvis/Tool/vtk-5.2.0/src
> export VTK_LIB_DIR=/usr/local/lib/vtk-5.2
> export X11_LIB_DIR=/usr/X11/lib
> #export OPENGL_LIB_DIR=/Developer/SDKs/MacOSX10.5.sdk/System/Library/ 
> Frameworks/OpenGL.framework/Versions/A/Libraries
>
> # the path is initially set to "/usr/bin:/bin:/usr/sbin:/sbin:/usr/ 
> local/bin:/usr/X11/bin"
> export PATH=$PATH:$QTROOT/bin
> export LD_LIBRARY_PATH=$VTK_LIB_DIR:$X11_LIB_DIR:$LD_LIBRARY_PATH
> export DYLD_LIBRARY_PATH=$VTK_LIB_DIR:$X11_LIB_DIR:$DYLD_LIBRARY_PATH
>
Setting DYLD_LIBRARY_PATH is unnecessary on OSX.  If you have to do it  
for VTK, then the VTK build is broken.  LD_LIBRARY_PATH is the linux  
version of this and is not needed on OSX.

DYLD_LIBRARY_PATH only affects the finding of libraries at runtime,  
not linking as in configure tests.  And properly built libraries on  
OSX should have the path built into them so they're found at runtime  
without DYLD_LIBRARY_PATH.  Though GRASS does use this as a neat trick  
(as a side effect) to make the binaries relocatable.

>


> Here is my configure command
>
> ./configure --with-cxx --prefix=/Applications/GRASS --enable-macosx- 
> app --with-x --with-cxx --with-opengl=aqua --without-readline --x- 
> includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --with- 
> opengl-includes=/usr/X11R6/include
>
This is probably what is confusing the build - you set --with- 
opengl=aqua, yet set the opengl includes and libs to X11.  These  
options can't be used together.  Configure should force the includes  
and libs based on the opengl value, but to be sure just use --with- 
opengl, which defaults to X11, and you probably won't need the  
includes/libs options.

Also note that you need to compile your own tcltk for X11, and set  
those options for the GRASS configure.  See the grass source osx  
readme for details.


> If I use the -with-opengl=x11 option, I get the following  
> configuration error
>
> checking for location of OpenGL library...
> checking for glBegin in -lGL... yes
> checking for gluBeginCurve in -lGLU... yes
> checking for glXCreatePbuffer... no
> configure: error: *** Unable to locate .
>

> configure:10998: checking for location of OpenGL library
> configure:11027: checking for glBegin in -lGL
> configure:11044: gcc -o conftest -g -O2      conftest.c -lGL  -L/usr/ 
> X11R6/lib  -lSM -lICE -lX11     1>&5
> configure:11214: checking for gluBeginCurve in -lGLU
> configure:11231: gcc -o conftest -g -O2      conftest.c -lGLU  - 
> lGL   -L/usr/X11R6/lib  -lSM -lICE -lX11     1>&5
> configure:11314: checking for glXCreatePbuffer
> configure:11340: gcc -o conftest -g -O2      conftest.c    -lGL   1>&5
> ld: library not found for -lGL
> collect2: ld returned 1 exit status
>

This is strange - configure is inserting the X11 lib path for the  
glBegin and gluBeginCurve tests, but not for the glXCreatePbuffer  
test.  Oh, I'm getting that also, but it's not keeping compilation  
from working.  This is just testing for the availability of pbuffers,  
and GRASS has a fallback if that's not available.

So, your make error log doesn't have the needed info.  You need to  
look way back in the shell scrollback to see what the actual error  
is.  You may need to change your Terminal window settings to unlimited  
scrollback.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy




More information about the grass-user mailing list