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

Fixed Linking error for libglut. #691

Open
mark-bchoi opened this issue Nov 1, 2024 · 0 comments
Open

Fixed Linking error for libglut. #691

mark-bchoi opened this issue Nov 1, 2024 · 0 comments

Comments

@mark-bchoi
Copy link

Hi,

I try to build libfreenect-0.5.2 and found link error.

Affer some googling, this error is caused by find_package(GLUT) which would be applicable for Apple. linux would have used freeglut.

| /home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/libfreenect/0.5.2/recipe-sysroot-native/usr/bin/aarch64-oe4t-linux/../../libexec/aarch64-oe4t-linux/gcc/aarch64-oe4t-linux/13.3.0/ld: examples/CMakeFiles/freenect-regview.dir/regview.c.o: in function `DrawGLScene':
| /usr/src/debug/libfreenect/0.5.2/examples/regview.c:134:(.text+0x20c): undefined reference to `glutSwapBuffers'
| /home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/libfreenect/0.5.2/recipe-sysroot-native/usr/bin/aarch64-oe4t-linux/../../libexec/aarch64-oe4t-linux/gcc/aarch64-oe4t-linux/13.3.0/ld: /usr/src/debug/libfreenect/0.5.2/examples/regview.c:138:(.text+0x254): undefined reference to `glutGet'
| /home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/libfreenect/0.5.2/recipe-sysroot-native/usr/bin/aarch64-oe4t-linux/../../libexec/aarch64-oe4t-linux/gcc/aarch64-oe4t-linux/13.3.0/ld: examples/CMakeFiles/freenect-regview.dir/regview.c.o: in function `idle':
| /usr/src/debug/libfreenect/0.5.2/examples/regview.c:91:(.text+0x6e8): undefined reference to `glutPostRedisplay'
| /home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/libfreenect/0.5.2/recipe-sysroot-native/usr/bin/aarch64-oe4t-linux/../../libexec/aarch64-oe4t-linux/gcc/aarch64-oe4t-linux/13.3.0/ld: examples/CMakeFiles/freenect-regview.dir/regview.c.o: in function `keyPressed':
| /usr/src/debug/libfreenect/0.5.2/examples/regview.c:150:(.text+0x740): undefined reference to `glutDestroyWindow'
| /home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/libfreenect/0.5.2/recipe-sysroot-native/usr/bin/aarch64-oe4t-linux/../../libexec/aarch64-oe4t-linux/gcc/aarch64-oe4t-linux/13.3.0/ld: examples/CMakeFiles/freenect-regview.dir/regview.c.o: in function `gl_threadfunc':
| /usr/src/debug/libfreenect/0.5.2/examples/regview.c:200:(.text+0x950): undefined reference to `glutInit'

I fixed this error with following patch.

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index c37b61a..1336d78 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -14,7 +14,12 @@ install(TARGETS freenect-camtest freenect-wavrecord
 set(THREADS_USE_PTHREADS_WIN32 true)
 find_package(Threads)
 find_package(OpenGL)
-find_package(GLUT)
+if(APPLE)
+  find_package(GLUT)
+else ()
+  set(GLUT_FOUND true)
+  find_library(GLUT_LIBRARY NAMES glut glut32 freeglut)
+endif ()

 if (Threads_FOUND AND OPENGL_FOUND AND GLUT_FOUND)
   include_directories(${THREADS_PTHREADS_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})

BR,
Mark

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

1 participant