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

Undefined reference to glut #5

Open
ttsesm opened this issue Mar 9, 2022 · 3 comments
Open

Undefined reference to glut #5

ttsesm opened this issue Mar 9, 2022 · 3 comments

Comments

@ttsesm
Copy link

ttsesm commented Mar 9, 2022

FYI if anyone gets the following error:

[  1%] Building C object CMakeFiles/Medit3D.dir/src/animat.c.o
[  5%] Building C object CMakeFiles/Medit3D.dir/src/bbfile.c.o
[  5%] Building C object CMakeFiles/Medit3D.dir/src/camera.c.o
[  7%] Building C object CMakeFiles/Medit3D.dir/src/cenrad.c.o
[  9%] Building C object CMakeFiles/Medit3D.dir/src/chrono.c.o
[ 12%] Building C object CMakeFiles/Medit3D.dir/src/clipvol.c.o
[ 12%] Building C object CMakeFiles/Medit3D.dir/src/clip.c.o
[ 14%] Building C object CMakeFiles/Medit3D.dir/src/critip.c.o
[ 16%] Building C object CMakeFiles/Medit3D.dir/src/cube.c.o
[ 18%] Building C object CMakeFiles/Medit3D.dir/src/dlists.c.o
[ 20%] Building C object CMakeFiles/Medit3D.dir/src/eigenv.c.o
[ 21%] Building C object CMakeFiles/Medit3D.dir/src/ellipse.c.o
[ 23%] Building C object CMakeFiles/Medit3D.dir/src/geometry.c.o
[ 25%] Building C object CMakeFiles/Medit3D.dir/src/gisfil.c.o
[ 27%] Building C object CMakeFiles/Medit3D.dir/src/hash.c.o
[ 29%] Building C object CMakeFiles/Medit3D.dir/src/ilists.c.o
[ 30%] Building C object CMakeFiles/Medit3D.dir/src/image.c.o
[ 32%] Building C object CMakeFiles/Medit3D.dir/src/inmsh2.c.o
[ 34%] Building C object CMakeFiles/Medit3D.dir/src/inout.c.o
[ 38%] Building C object CMakeFiles/Medit3D.dir/src/keyboard.c.o
[ 38%] Building C object CMakeFiles/Medit3D.dir/src/items.c.o
[ 40%] Building C object CMakeFiles/Medit3D.dir/src/libmesh5.c.o
[ 41%] Building C object CMakeFiles/Medit3D.dir/src/listnum.c.o
[ 43%] Building C object CMakeFiles/Medit3D.dir/src/material.c.o
[ 45%] Building C object CMakeFiles/Medit3D.dir/src/medit.c.o
[ 47%] Building C object CMakeFiles/Medit3D.dir/src/memory.c.o
[ 49%] Building C object CMakeFiles/Medit3D.dir/src/menus.c.o
[ 50%] Building C object CMakeFiles/Medit3D.dir/src/mesh.c.o
[ 52%] Building C object CMakeFiles/Medit3D.dir/src/mlists.c.o
[ 54%] Building C object CMakeFiles/Medit3D.dir/src/morphing.c.o
[ 56%] Building C object CMakeFiles/Medit3D.dir/src/mouse.c.o
[ 58%] Building C object CMakeFiles/Medit3D.dir/src/normal.c.o
[ 60%] Building C object CMakeFiles/Medit3D.dir/src/param.c.o
[ 61%] Building C object CMakeFiles/Medit3D.dir/src/parsar.c.o
[ 63%] Building C object CMakeFiles/Medit3D.dir/src/parsop.c.o
[ 65%] Building C object CMakeFiles/Medit3D.dir/src/particle.c.o
[ 67%] Building C object CMakeFiles/Medit3D.dir/src/path.c.o
[ 69%] Building C object CMakeFiles/Medit3D.dir/src/persp.c.o
[ 70%] Building C object CMakeFiles/Medit3D.dir/src/picking.c.o
[ 72%] Building C object CMakeFiles/Medit3D.dir/src/psfile.c.o
[ 74%] Building C object CMakeFiles/Medit3D.dir/src/scene.c.o
[ 76%] Building C object CMakeFiles/Medit3D.dir/src/scissor.c.o
[ 78%] Building C object CMakeFiles/Medit3D.dir/src/sftcpy.c.o
[ 80%] Building C object CMakeFiles/Medit3D.dir/src/status.c.o
[ 81%] Building C object CMakeFiles/Medit3D.dir/src/stream.c.o
[ 83%] Building C object CMakeFiles/Medit3D.dir/src/tiles.c.o
[ 85%] Building C object CMakeFiles/Medit3D.dir/src/transform.c.o
[ 87%] Building C object CMakeFiles/Medit3D.dir/src/util.c.o
[ 89%] Building C object CMakeFiles/Medit3D.dir/src/vector.c.o
[ 90%] Building C object CMakeFiles/Medit3D.dir/src/view.c.o
[ 92%] Building C object CMakeFiles/Medit3D.dir/src/zaldy1.c.o
[ 94%] Building C object CMakeFiles/Medit3D.dir/src/zaldy2.c.o
[ 96%] Linking C shared library libMedit3D.so
[ 96%] Built target Medit3D
[ 98%] Building C object CMakeFiles/medit.dir/src/medit.c.o
[100%] Linking C executable medit
/usr/bin/ld: CMakeFiles/medit.dir/src/medit.c.o: in function `main':
medit.c:(.text.startup+0x17b): undefined reference to `glutInit'
/usr/bin/ld: medit.c:(.text.startup+0x19f): undefined reference to `glutInitDisplayMode'
/usr/bin/ld: medit.c:(.text.startup+0x20f): undefined reference to `glutMainLoop'
/usr/bin/ld: medit.c:(.text.startup+0x2c5): undefined reference to `glutCreateWindow'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutAddSubMenu'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutSwapBuffers'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutAttachMenu'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutBitmapHelvetica18'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutBitmapHelvetica10'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutSetIconTitle'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutGet'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutPostRedisplay'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutBitmapCharacter'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutReshapeFunc'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutHideWindow'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutCreateSubWindow'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutCreateMenu'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutGetModifiers'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutSolidSphere'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutKeyboardFunc'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutFullScreen'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutMouseFunc'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutSpecialFunc'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutIdleFunc'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutMotionFunc'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutAddMenuEntry'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutWireCube'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutGetWindow'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutInitWindowSize'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutReshapeWindow'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutBitmapHelvetica12'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutSetCursor'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutSetWindowTitle'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutSetWindow'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutDisplayFunc'
/usr/bin/ld: libMedit3D.so: undefined reference to `glutWireSphere'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/medit.dir/build.make:102: medit] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/medit.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Then change ${GLUT_LIBRARY} to ${GLUT_LIBRARIES} in this line

@tomichec
Copy link

Got the same issue. It would be nice to include the required change into the main branch.

@FengZecheng-zj
Copy link

Got the similar issue, thank u

@ngrigri
Copy link

ngrigri commented Oct 11, 2024

Got the similar issue!

To solve the problem I changed in the CMakeLists.txt file the line:
set(GL_LIBS ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} )
to
set(GL_LIBS ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} )

Install Medit using a script!

cd /tmp 
git clone https://github.com/ISCDtoolbox/Medit.git
cd Medit 
sed -i 's/GLUT_LIBRARY}/GLUT_LIBRARIES}/g' CMakeLists.txt
mkdir build 
cd build 
cmake ..
make
make install

I found this solution by consulting the cmake findGLUT document.

Is it possible to modify the CMakefilelists.txt in this way?

Thank you.

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

4 participants