c++ - Not having ability to link pthreads to resolve cmake compiling issue -


here output when compiling, 100% when linking fails, presumably due missing pthreads

cd /home/username/code/gnucash/build/src/gnc && /usr/bin/cmake -e cmake_link_script cmakefiles/cutecash.dir/link.txt --verbose=1 /usr/bin/c++       cmakefiles/cutecash.dir/moc_accountitemmodel.cxx.o cmakefiles/cutecash.dir/moc_accountselectiondelegate.cxx.o cmakefiles/cutecash.dir/moc_recentfilemenu.cxx.o cmakefiles/cutecash.dir/moc_splitlistmodel.cxx.o cmakefiles/cutecash.dir/moc_splitlistview.cxx.o cmakefiles/cutecash.dir/moc_mainwindow.cxx.o cmakefiles/cutecash.dir/moc_dashboard.cxx.o cmakefiles/cutecash.dir/fpo/moc_fpo.cxx.o cmakefiles/cutecash.dir/fpo/moc_viewletmodel.cxx.o cmakefiles/cutecash.dir/fpo/moc_viewletview.cxx.o cmakefiles/cutecash.dir/qrc_gnucash.cxx.o cmakefiles/cutecash.dir/qrc_gtk-icons.cxx.o cmakefiles/cutecash.dir/qrc_fallback-icons.cxx.o cmakefiles/cutecash.dir/qrc_stylesheets.cxx.o cmakefiles/cutecash.dir/accountitemmodel.cpp.o cmakefiles/cutecash.dir/accountselectiondelegate.cpp.o cmakefiles/cutecash.dir/cmd.cpp.o cmakefiles/cutecash.dir/qofeventwrapper.cpp.o cmakefiles/cutecash.dir/recentfilemenu.cpp.o cmakefiles/cutecash.dir/session.cpp.o cmakefiles/cutecash.dir/splitlistmodel.cpp.o cmakefiles/cutecash.dir/splitlistview.cpp.o cmakefiles/cutecash.dir/main.cpp.o cmakefiles/cutecash.dir/mainwindow.cpp.o cmakefiles/cutecash.dir/mainwindow-file.cpp.o cmakefiles/cutecash.dir/dashboard.cpp.o cmakefiles/cutecash.dir/fpo/fpo.cpp.o cmakefiles/cutecash.dir/fpo/viewletmodel.cpp.o cmakefiles/cutecash.dir/fpo/viewletview.cpp.o  -o cutecash -rdynamic ../backend/xml/libgnc-backend-xml.a ../import-export/libgnc-import.a ../app-utils/libapp-utils.a ../optional/gtkmm/liblibgncmod-gtkmm.a ../engine/libengine.a ../gnc-module/libgnc-module.a ../core-utils/libcore-utils.a ../libqof/libqof.a -lguile -lgmp -lcrypt -lm -lltdl -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lglib-2.0 -lgconf-2 -lglib-2.0 -lgthread-2.0 -lglib-2.0 -lgobject-2.0 -lglib-2.0 -lgmodule-2.0 -lglib-2.0 -lglib-2.0 -lxml2 -lqtgui -lqtcore -lgobject-2.0 -lsigc-2.0 -lgconf-2 -lgthread-2.0 -lgmodule-2.0 -lxml2 -lqtgui -lqtcore  /usr/bin/ld: cmakefiles/cutecash.dir/main.cpp.o: undefined reference symbol 'pthread_getspecific@@glibc_2.2.5' /usr/bin/ld: note: 'pthread_getspecific@@glibc_2.2.5' defined in dso /lib/x86_64-linux-gnu/libpthread.so.0 try adding linker command line /lib/x86_64-linux-gnu/libpthread.so.0: not read symbols: invalid operation collect2: error: ld returned 1 exit status make[2]: *** [src/gnc/cutecash] error 1 make[2]: leaving directory `/home/username/code/gnucash/build' make[1]: *** [src/gnc/cmakefiles/cutecash.dir/all] error 2 make[1]: leaving directory `/home/username/code/gnucash/build' make: *** [all] error 2 

i have tried messing cmakelists file lot, here of things tried:

  • adding find_package (threads)
  • adding target_link_libraries(pthread) (causes cmake error)

any appreciated, thanks.

and added main (root)cmakelists:

include_directories( ${zlib_include_dirs} ) find_package (zlib required) find_package (threads) 

there child cmakelists @ src/gnc. added it:

target_link_libraries ( cutecash ${cmake_thread_libs_init} ) target_link_libraries( cutecash ${zlib_libraries} ) 

and compiles cleanly.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -