From: José Fonseca Date: Mon, 5 Dec 2011 09:53:28 +0000 (+0000) Subject: Workaround weird issue with gdb and dlopen'ed libpthread.so X-Git-Tag: 2.0_alpha^2~429 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e08f33622bcb9e9da2e994da311fd44eeb62e6d;p=tools%2Fapitrace.git Workaround weird issue with gdb and dlopen'ed libpthread.so --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 710c626..fc331b6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)