{"id":989,"date":"2022-08-30T15:10:32","date_gmt":"2022-08-30T15:10:32","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/undefined-symbol-_zl22__gthrw_pthread_cancelm-error-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:10:32","modified_gmt":"2022-08-30T15:10:32","slug":"undefined-symbol-_zl22__gthrw_pthread_cancelm-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/undefined-symbol-_zl22__gthrw_pthread_cancelm-error-collection-of-common-programming-errors\/","title":{"rendered":"undefined symbol: _ZL22__gthrw_pthread_cancelm error-Collection of common programming errors"},"content":{"rendered":"<p>I have a C++\/C application which needs to be compiled as a 32 bit application (as there are certain third-party libraries only available for 32 bit). However, the compilation as well as the execution will happen on CentOS 6.4 x86_64 machine.<\/p>\n<p>I am using gnu autotools for building. After doing a lot of googling, finally figured a sets of options to give to <code>.\/configure<\/code> to create 32 bit executables\/shared objects. Set the <code>LD_LIBRARY_PATH<\/code> to search in <code>\/lib, \/usr\/lib\/, \/usr\/lib\/gcc\/...<\/code> instead of <code>\/lib64, ...<\/code> Verified that all the generated .so and executable are 32 bit by using <code>file<\/code> command.<\/p>\n<p>But I get the error: &#8220;<code>undefined symbol: _ZL22__gthrw_pthread_cancelm<\/code>&#8221; if I run the executable.<\/p>\n<p>Any clues?<\/p>\n<ol>\n<li>\n<p>It seems you forgot to link to pthreads with <code>-lpthread<\/code>.<\/p>\n<p>GCC adds a layer of abstraction over pthreads and this abstraction use weak symbols, so you can build your executable without link error but fail at runtime.<\/p>\n<\/li>\n<li>\n<p>Is there a 32bits pthread library on your target host? If not, I guess you need to get one installed. Also inspect the output of <code>ldd<\/code> on your target host, this might help you find out what is missing.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:11:31. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have a C++\/C application which needs to be compiled as a 32 bit application (as there are certain third-party libraries only available for 32 bit). However, the compilation as well as the execution will happen on CentOS 6.4 x86_64 machine. I am using gnu autotools for building. After doing a lot of googling, finally [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-989","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=989"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/989\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}