Results 1 to 6 of 6

Thread: problems linking with mesa

  1. #1
    Guest

    problems linking with mesa

    Hi
    Iīve installed Mesa 3.2 inmy RedHat 6.0 system, but i cant link my programs, when i compile these gcc canīt found the referecnces to the GL and GLUT functions, the mesa libraries are in /usr/lib, so itīs suposed that gcc can found them, the path /usr/lib is in /etc/ld.conf, but it cant.
    Why this problem? How can i compile opengl programs in Linux, i`ve never compile any opengl program.
    the program that i im trying to compile is a simpliest Sierpinsky Gasket, thr syntax is perfect, but, like i said, it doesnīt link, i tried to compile with -l/usr/lib/libGL.so too but nothing.
    Please could somebody help me.
    Thanks

  2. #2
    Member Contributor
    Join Date
    Feb 2000
    Location
    Breda, Netherlands
    Posts
    57

    Re: problems linking with mesa

    maybe you should try running /sbin/ldconfig to update /etc/ld.conf. maybe then it will link?

    John

  3. #3

    Re: problems linking with mesa

    This link line should include everything you might need for a GLUT program:

    -L/usr/X11R6/lib -lGL -lGLU -lglut -lXi -lXmu -lXext -lX11 -lm

    [This message has been edited by mallan (edited 07-02-2000).]

  4. #4
    Guest

    Re: problems linking with mesa

    Hi,

    I should probably not answer because I know
    almost nothing about linking, but last night
    I was trying to compile a small OpenGL program and was having the same sorts of problems. It happened that I had printed out
    an OpenGL program from the O'Reilly site
    and I copied the Makefile exactly, substituting only my source file name. It
    worked. I have no idea what the make file
    did that I didn't do with the command line.

    Mark

  5. #5
    Junior Member Newbie
    Join Date
    May 2000
    Posts
    18

    Re: problems linking with mesa

    Send me your command line stuff and send me the makefile and i'll tell ya what it does different.

  6. #6

    Re: problems linking with mesa

    I have wrote a bash script to increase the development of openGL. The script helps people to compile and link Mesa 3D library save the text to a file cc.sh and change it to executable by chmod a+x cc.sh Then type ./cc.sh --help to see how to use it to include OpenGL library properly. It supports OpenGL 3.5, 4.0.
    If you are interested in 3D Math visualization , visit my projects : http://sourceforge.net/projects/mathdev/

    #!/bin/bash
    # The shell script was created to compile the c++ source file *.cpp, *.c, *.cxx
    # , and debug using the GNU debuggin tools such as gdb and gprof
    if [ -z "$1" ];
    then
    echo -e "Missing argument 1\nusage: $0 [ filename without .cpp ] [ OPTIONS ]
    Type $0 --help for command line options"
    exit
    fi

    # message of --help
    helpMsg="usage: $0 [ filename without .cpp ] [ OPTIONS ]\n
    The bash script accepts the following options :\n
    \t -lFilename\n
    \t\t include the library while linking.\n
    \t\t This -l option is different from the -l in gcc compiler.\n
    \t\t It does not search standard system directories but only\n
    \t\t the full filename specified explicitly. For example,\n
    \t\t cc.sh -lmy.o includes my.o while linking. -lmy does not\n
    \t\t search the file libmy.a\n
    \t -p\n
    \t\t include the PLIB library, http://plib.sourceforge.net/\n
    \n
    \t --Mesa4Dir=DIR\n
    \t\t change the default directory of Mesa 3D 4.0 from\n
    \t\t /usr/local/Mesa-4.0 to DIR\n
    \n
    \t -m4\n
    \t\t compile and link using the gcc options for Mesa 3D 4.0\n
    \n
    \t --Mesa35Dir=DIR\n
    \t\t change the default directory of Mesa 3D 3.5 from\n
    \t\t /usr/local/Mesa35 to DIR\n
    \n
    \t -m35\n
    \t\t compile and link using the gcc options for Mesa 3D 3.5\n
    \n
    \t -glui\n
    \t\t include the GLUI library, http://www.cs.unc.edu/~rademach/glui/\n
    \n
    \t -d\n
    \t\t add debugging options for gcc compiler"

    compile=
    # command to compile
    cc="c++"
    # compile options
    cflags="-W -Wall"
    link=
    # command to link
    ccld="$cc"
    # libraries to include
    libs=
    # link options
    ldflags="-W -Wall"

    # start the specific options
    # debugging options
    db="-a -g -pg"

    # directories of Mesa 3D library
    Mesa4Dir="/usr/local/Mesa-4.0"
    Mesa35Dir="/usr/local/Mesa35"

    # loop through all the arguments to determine the directory of Library
    for arg in $@ ;
    do
    case $arg in
    # print help message and quit
    --help)
    echo -e $helpMsg
    exit
    ;;
    # find the directory of Mesa 3D 4.0
    --Mesa4Dir=*)
    Mesa4Dir="`echo $arg | sed -e 's/--Mesa4Dir=//'`"
    ;;
    # find the directory of Mesa 3D 3.5
    --Mesa35Dir=*)
    Mesa35Dir="`echo $arg | sed -e 's/--Mesa35Dir=//'`"
    ;;
    esac
    done

    # options for Mesa 3D 4.0
    # options to compile source code using Mesa 3D 4.0
    cflagsM4="-DHAVE_CONFIG_H -I. -I$Mesa4Dir -I$Mesa4Dir/include -DNDEBUG -g -Wall -fomit-frame-pointer -ffast-math -fstrict-aliasing -malign-loops=2 -malign-jumps=2 -malign-functions=2 -D_REENTRANT -DPTHREADS -c"
    # options to link Mesa 3D 4.0 library
    ldflagsM4="-g -Wall -fomit-frame-pointer -ffast-math -fstrict-aliasing -malign-loops=2 -malign-jumps=2 -malign-functions=2 -D_REENTRANT -DPTHREADS"
    # options to include Mesa 3D 4.0 library
    libsM4="$Mesa4Dir/src-glut/libglut.la $Mesa4Dir/si-glu/libGLU.la $Mesa4Dir/src/libGL.la -lm"

    # command to link Mesa 3D library
    ldM="/bin/sh $Mesa4Dir/libtool --mode=link c++"

    # options for GLUI
    GLuiDir="/usr/local/Mesa-4.0/src-glui/lib/"
    # options to include the GLUI library
    libsGLUI="-L$GLuiDir -lglui"

    # options to include PLIB library
    libsPLIB="-lglut -lGLU -lGL -L/usr/X11/lib -lX11 -lXext -lXmu -lm -lplibssg -lplibsl -lplibpu -lplibfnt -lplibsg -lplibul -lplibnet"

    # options for Mesa 3D 3.5
    # options to compile source code using Mesa 3D 3.5
    cflagsM35="-DHAVE_CONFIG_H -I. -I$Mesa35Dir -I$Mesa35Dir/include -DNDEBUG -I$Mesa35Dir/util -I$Mesa35Dir/src/X86 -g -Wall -ffast-math -fexpensive-optimizations -fstrict-aliasing -malign-loops=2 -malign-jumps=2 -malign-functions=2 -D_REENTRANT -DPTHREADS -c"
    # options to link Mesa 3D 3.5 library
    ldflagsM35="-g -Wall -ffast-math -fstrict-aliasing -malign-loops=2 -malign-jumps=2 -malign-functions=2 -D_REENTRANT -DPTHREADS"
    libsM35="$Mesa35Dir/si-glu/.libs/libGLU.so -L$Mesa35Dir/src $Mesa35Dir/src/.libs/libGL.so -L/usr/X11R6/lib $Mesa35Dir/src-glut/.libs/libglut.so -L$Mesa35Dir/si-glu $Mesa35Dir/src/.libs/libGL.so $Mesa35Dir/src/OSmesa/.libs/libMesaOS.so -lSM -lICE -lXmu -lXext -lXi -lX11 -lpthread -lm -Wl,--rpath -Wl,$Mesa35Dir/si-glu/.libs -Wl,--rpath -Wl,$Mesa35Dir/src/.libs -Wl,--rpath -Wl,$Mesa35Dir/src-glut/.libs -Wl,--rpath -Wl,$Mesa35Dir/src/OSmesa/.libs"

    # loop through all the arguments
    for arg in $@ ;
    do
    case $arg in
    # case of debugging option
    -d)
    cflags="$cflags $db"
    ldflags="$ldflags $db"
    ;;
    # case for Mesa 3D 4.0
    -m4)
    cflags="$cflags $cflagsM4"
    ldflags="$ldflags $ldflagsM4"
    libs="$libs $libsM4"
    ccld="$ldM"
    ;;
    # case for inclusion of PLIB
    -p)
    libs="$libs $libsPLIB"
    ;;
    # case for inclusion of GLUI library
    -glui)
    libs="$libs $libsGLUI"
    ;;
    # case for Mesa 3D 3.5
    -m35)
    cflags="$cflags $cflagsM35"
    ldflags="$ldflags $ldflagsM35"
    libs="$libs $libsM35"
    ccld="$ldM"
    ;;
    # case for inclusion of addition library files
    -l*)
    libs="$libs `echo $arg | sed -e 's/-l//'`"
    ;;
    esac
    done

    # check if the $1.o exists to prevent it from being overwritten
    if [ -f $1.o ];
    then
    echo -e "Attempted to overwrite $1.o\nScript exits"
    exit
    fi

    # start to compile
    compile="$cc $cflags -c"
    link="$ccld $ldflags $libs"
    if [ -f $1.cpp ];
    then
    $compile $1.cpp
    # case of the .c file
    elif [ -f $1.c ];
    then
    $compile $1.c
    # case of the .cxx file
    elif [ -f $1.cxx ];
    then
    $compile $1.cxx
    else
    echo -e "$1.c, $1.cpp, or $1.cxx file not found"
    fi

    # start to link
    if [ -f $1.o ];
    then
    $link -o $1 $1.o
    # move or remove the object file after linking
    if [ -d ./.libs ]
    then
    mv --force $1.o ./.libs/
    else
    rm --force $1.o
    fi
    fi

Similar Threads

  1. having problems linking
    By codecrank in forum OpenGL: Linux
    Replies: 3
    Last Post: 01-31-2004, 02:31 PM
  2. Linking problems or GLX?
    By sglo in forum OpenGL: Linux
    Replies: 28
    Last Post: 01-26-2004, 03:39 PM
  3. Problems with linking
    By markowitch in forum OpenGL: Windows
    Replies: 3
    Last Post: 01-09-2004, 06:33 PM
  4. glx linking problems... please help !
    By Monseigneur in forum OpenGL: Linux
    Replies: 2
    Last Post: 04-09-2002, 12:42 AM
  5. linking problems
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-01-2002, 01:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean