]> git.cworth.org Git - apitrace/commitdiff
Workaround weird issue with gdb and dlopen'ed libpthread.so
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 5 Dec 2011 09:53:28 +0000 (09:53 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 5 Dec 2011 09:53:59 +0000 (09:53 +0000)
CMakeLists.txt

index 710c626ec7dbc465c626e137c2aac754038fc478..fc331b6c8b9a63faaa9e1df4562a82525c84e81b 100755 (executable)
@@ -534,14 +534,21 @@ target_link_libraries (glretrace
 )
 
 if (WIN32)
-elseif (APPLE)
-    target_link_libraries (glretrace
-        "-framework Cocoa"
-        "-framework ApplicationServices" # CGS*
-        ${OPENGL_gl_LIBRARY} # CGL*
-    )
 else ()
-    target_link_libraries (glretrace ${X11_X11_LIB})
+    if (APPLE)
+        target_link_libraries (glretrace
+            "-framework Cocoa"
+            "-framework ApplicationServices" # CGS*
+            ${OPENGL_gl_LIBRARY} # CGL*
+        )
+    else ()
+        target_link_libraries (glretrace ${X11_X11_LIB} pthread)
+    endif ()
+
+    # gdb doesn't like when pthreads is loaded through dlopen (which happens
+    # when dlopen'ing libGL), so link pthreads to avoid this issue.  See also
+    # http://stackoverflow.com/questions/2702628/gdb-cannot-find-new-threads-generic-error
+    target_link_libraries (glretrace pthread)
 endif ()
 
 install (TARGETS glretrace RUNTIME DESTINATION bin) 
@@ -562,10 +569,8 @@ if (EGL_FOUND AND NOT WIN32 AND NOT APPLE)
 
     target_link_libraries (eglretrace
         common
-    )
-
-    target_link_libraries (eglretrace
         ${X11_X11_LIB}
+        pthread
     )
 
     install (TARGETS eglretrace RUNTIME DESTINATION bin)