<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: -mt and -lpthread on HP-UX 11.11 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976299#M95477</link>
    <description>Here's something interesting: I took out all the implied libs from the link line. I guess aCC knows best- here's the end of the ld invocation, showing just the libs that aCC added for me:&lt;BR /&gt;&lt;BR /&gt;-lm -lcl -ldld -lc -lnsl -lxti -lrt -lstd_v2 -lCsup_v2 -lpthread -lm -lcl -lc /usr/lib/libdld.sl&lt;BR /&gt;&lt;BR /&gt;It repeated libm, libcl and libc after libpthread!&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 06 Apr 2007 02:12:41 GMT</pubDate>
    <dc:creator>Jim Gallagher</dc:creator>
    <dc:date>2007-04-06T02:12:41Z</dc:date>
    <item>
      <title>-mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976295#M95473</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Can anyone explain this behavior? My first link uses -mt and +n without -lpthread, but it crashes (aCC runtime: Error 22 from shl_findsym(/usr/lib/libCsup_v2.2,_shlInit) ). My second link explicitly adds -lpthread, and it works. Same shell, same SHLIB_PATH, etc. Is this a bug, or am I missing something? &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Jim Gallagher&lt;BR /&gt;&lt;BR /&gt;First link: &lt;BR /&gt;/opt/aCC/bin/aCC -AA -mt -Wl,+n,+s,+gst,+gstsize,40387,+vshlibunsats,+vallcompatwarnings,-v -L/opt/mda_pdm/tceng101/lib -L/opt/mda_pdm/tceng101/lib/oracle -L/usr/lib -L/opt/mda_pdm/tceng101/fms/lib -L/usr/lib FMgrMain.o iman_tlogin.o report_item_acls.o FMgrMainUtils.o FMAPI_S.o FMgrAPI_S.a SQL/FMgrSQLAPI.a /users/Common/FMAPI/v10_00jim/FM_BOTH.a /users/Common/v02_12/Server.a /users/Common/v02_12/Global.a -lae -laie -laiwebservice -lappr -larchive -lbackup -lbmf -lbom -lcae -lcfm -lcollabctx -lcxpom -ldmi -lecm -leint -leintstub -lepm -lfclasses -lform -lgdis -lgrm -lics -lict -licudata32 -licui -licuuc32 -liman -limancore -limantrushape -linternal_exits -linternal_server_exits -litk -llov -lme -lmechatronics -lmgc -lobjio -love -lpcl51 -lpie -lplmxml51 -lplmxmlBusiness51 -lplmxmlClassification51 -lplmxmlDelta51 -lplmxmlMPM51 -lplmxmlMechatronics51 -lplmxmlTcEng51 -lproperty -lps -lpublication -lqry -lrdv -lres -lrwr -lsa -lsml -lss -lsub_mgr -ltceng_utils -ltcengcoreext -ltextsrv -lugmgr_im -lusage -lusagewc -luser_exits -lvis -lvispublish -lxalan -lxpk51 -larm -lxerces -lpom -luglm -lsyss -lugmath -L/opt/mda_pdm/tceng101/lib -lFPLibrary32 -lPAI_module32 -lclntsh -lm -lcl -ldld -lc -lnsl -lxti -lrt -o /tmp/FMgrMain&lt;BR /&gt;&lt;BR /&gt;/usr/ccs/bin/ld -o /tmp/FMgrMain /opt/langtools/lib/crt0.o -u___exit -umain -L/opt/aCC/lib /opt/aCC/lib/cpprt0.o +n +s +gst +gstsize 40387 +vshlibunsats +vallcompatwarnings -v -L /opt/mda_pdm/tceng101/lib -L /opt/mda_pdm/tceng101/lib/oracle -L /usr/lib -L /opt/mda_pdm/tceng101/fms/lib -L /usr/lib FMgrMain.o iman_tlogin.o report_item_acls.o FMgrMainUtils.o FMAPI_S.o FMgrAPI_S.a SQL/FMgrSQLAPI.a /users/Common/FMAPI/v10_00jim/FM_BOTH.a /users/Common/v02_12/Server.a /users/Common/v02_12/Global.a -lae -laie -laiwebservice -lappr -larchive -lbackup -lbmf -lbom -lcae -lcfm -lcollabctx -lcxpom -ldmi -lecm -leint -leintstub -lepm -lfclasses -lform -lgdis -lgrm -lics -lict -licudata32 -licui -licuuc32 -liman -limancore -limantrushape -linternal_exits -linternal_server_exits -litk -llov -lme -lmechatronics -lmgc -lobjio -love -lpcl51 -lpie -lplmxml51 -lplmxmlBusiness51 -lplmxmlClassification51 -lplmxmlDelta51 -lplmxmlMPM51 -lplmxmlMechatronics51 -lplmxmlTcEng51 -lproperty -lps -lpublication -lqry -lrdv -lres -lrwr -lsa -lsml -lss -lsub_mgr -ltceng_utils -ltcengcoreext -ltextsrv -lugmgr_im -lusage -lusagewc -luser_exits -lvis -lvispublish -lxalan -lxpk51 -larm -lxerces -lpom -luglm -lsyss -lugmath -L /opt/mda_pdm/tceng101/lib -lFPLibrary32 -lPAI_module32 -lclntsh -lm -lcl -ldld -lc -lnsl -lxti -lrt -lstd_v2 -lCsup_v2 -lpthread -lm -lcl -lc /usr/lib/libdld.sl&lt;BR /&gt;&lt;BR /&gt;--------------------------------------------------------&lt;BR /&gt;Second link:&lt;BR /&gt;/opt/aCC/bin/aCC -AA -mt -Wl,+n,+s,+gst,+gstsize,40387,+vshlibunsats,+vallcompatwarnings,-v -L/opt/mda_pdm/tceng101/lib -L/opt/mda_pdm/tceng101/lib/oracle -L/usr/lib -L/opt/mda_pdm/tceng101/fms/lib -L/usr/lib FMgrMain.o iman_tlogin.o report_item_acls.o FMgrMainUtils.o FMAPI_S.o FMgrAPI_S.a SQL/FMgrSQLAPI.a /users/Common/FMAPI/v10_00jim/FM_BOTH.a /users/Common/v02_12/Server.a /users/Common/v02_12/Global.a -lpthread -lae -laie -laiwebservice -lappr -larchive -lbackup -lbmf -lbom -lcae -lcfm -lcollabctx -lcxpom -ldmi -lecm -leint -leintstub -lepm -lfclasses -lform -lgdis -lgrm -lics -lict -licudata32 -licui -licuuc32 -liman -limancore -limantrushape -linternal_exits -linternal_server_exits -litk -llov -lme -lmechatronics -lmgc -lobjio -love -lpcl51 -lpie -lplmxml51 -lplmxmlBusiness51 -lplmxmlClassification51 -lplmxmlDelta51 -lplmxmlMPM51 -lplmxmlMechatronics51 -lplmxmlTcEng51 -lproperty -lps -lpublication -lqry -lrdv -lres -lrwr -lsa -lsml -lss -lsub_mgr -ltceng_utils -ltcengcoreext -ltextsrv -lugmgr_im -lusage -lusagewc -luser_exits -lvis -lvispublish -lxalan -lxpk51 -larm -lxerces -lpom -luglm -lsyss -lugmath -L/opt/mda_pdm/tceng101/lib -lFPLibrary32 -lPAI_module32 -lclntsh -lm -lcl -ldld -lc -lnsl -lxti -lrt -o /tmp/FMgrMain&lt;BR /&gt;&lt;BR /&gt;/usr/ccs/bin/ld -o /tmp/FMgrMain /opt/langtools/lib/crt0.o -u___exit -umain -L/opt/aCC/lib /opt/aCC/lib/cpprt0.o +n +s +gst +gstsize 40387 +vshlibunsats +vallcompatwarnings -v -L /opt/mda_pdm/tceng101/lib -L /opt/mda_pdm/tceng101/lib/oracle -L /usr/lib -L /opt/mda_pdm/tceng101/fms/lib -L /usr/lib FMgrMain.o iman_tlogin.o report_item_acls.o FMgrMainUtils.o FMAPI_S.o FMgrAPI_S.a SQL/FMgrSQLAPI.a /users/Common/FMAPI/v10_00jim/FM_BOTH.a /users/Common/v02_12/Server.a /users/Common/v02_12/Global.a -lpthread -lae -laie -laiwebservice -lappr -larchive -lbackup -lbmf -lbom -lcae -lcfm -lcollabctx -lcxpom -ldmi -lecm -leint -leintstub -lepm -lfclasses -lform -lgdis -lgrm -lics -lict -licudata32 -licui -licuuc32 -liman -limancore -limantrushape -linternal_exits -linternal_server_exits -litk -llov -lme -lmechatronics -lmgc -lobjio -love -lpcl51 -lpie -lplmxml51 -lplmxmlBusiness51 -lplmxmlClassification51 -lplmxmlDelta51 -lplmxmlMPM51 -lplmxmlMechatronics51 -lplmxmlTcEng51 -lproperty -lps -lpublication -lqry -lrdv -lres -lrwr -lsa -lsml -lss -lsub_mgr -ltceng_utils -ltcengcoreext -ltextsrv -lugmgr_im -lusage -lusagewc -luser_exits -lvis -lvispublish -lxalan -lxpk51 -larm -lxerces -lpom -luglm -lsyss -lugmath -L /opt/mda_pdm/tceng101/lib -lFPLibrary32 -lPAI_module32 -lclntsh -lm -lcl -ldld -lc -lnsl -lxti -lrt -lstd_v2 -lCsup_v2 -lpthread -lm -lcl -lc /usr/lib/libdld.sl &lt;BR /&gt;</description>
      <pubDate>Thu, 05 Apr 2007 15:36:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976295#M95473</guid>
      <dc:creator>Jim Gallagher</dc:creator>
      <dc:date>2007-04-05T15:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976296#M95474</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;If all other factors are equal, look for a bug  either in aCC or your code, or a patch thats not on the non-working system.&lt;BR /&gt;&lt;BR /&gt;Another possbility is one of the libraries it needs has become corrupt due to a file delete or a disk problem of some unknown factor.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 05 Apr 2007 15:57:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976296#M95474</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-04-05T15:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976297#M95475</link>
      <description>I'm not sure why adding -lpthread twice makes it work.&lt;BR /&gt;&lt;BR /&gt;You should remove "-lm -lcl -ldld -lc" from your link line, since these are added by default.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;but it crashes (aCC runtime: Error 22 from shl_findsym(/usr/lib/libCsup_v2.2,_shlInit)&lt;BR /&gt;&lt;BR /&gt;Is there any more info?&lt;BR /&gt;EINVAL   22   /* Invalid argument&lt;BR /&gt;&lt;BR /&gt;Rats, this rings a bell!&lt;BR /&gt;Something about Oracle? having an evil stub for one of the pthread functions!  That would explain why adding that -lpthread sooner fixed it.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h21007.www2.hp.com/dspp/ml/showArchiveMessage/1,,24!05!08!0011,00.html" target="_blank"&gt;http://h21007.www2.hp.com/dspp/ml/showArchiveMessage/1,,24!05!08!0011,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I suppose it could also fail if -lc was added as a dependent lib to any of your listed shlibs.&lt;BR /&gt;&lt;BR /&gt;If it is the same issue, link with:&lt;BR /&gt;-Wl,-ypthread_mutex_init</description>
      <pubDate>Fri, 06 Apr 2007 00:30:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976297#M95475</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-04-06T00:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976298#M95476</link>
      <description>Dennis,&lt;BR /&gt;&lt;BR /&gt;Your suggestion seems to cut to where the problem is, which I'm assuming is a bug in ld or dld. I took out the libs you suggested from the lib list; hadn't thought of that (obviously). The script that is doing the link was supplied by a vendor whose libs I'm linking against. Anyway, I removed -lpthread, along with "-lm -lcl -ldld -lc", and now it works as expected.&lt;BR /&gt;&lt;BR /&gt;To answer your question about the error, there was no other info. Also, I should have noted the error occurrs while dld is fixing stuff up; main() was not even reached.&lt;BR /&gt;&lt;BR /&gt;That was a very good suggestion about the potential problem with the Oracle lib, but that does not seem to be it.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Jim</description>
      <pubDate>Fri, 06 Apr 2007 02:01:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976298#M95476</guid>
      <dc:creator>Jim Gallagher</dc:creator>
      <dc:date>2007-04-06T02:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976299#M95477</link>
      <description>Here's something interesting: I took out all the implied libs from the link line. I guess aCC knows best- here's the end of the ld invocation, showing just the libs that aCC added for me:&lt;BR /&gt;&lt;BR /&gt;-lm -lcl -ldld -lc -lnsl -lxti -lrt -lstd_v2 -lCsup_v2 -lpthread -lm -lcl -lc /usr/lib/libdld.sl&lt;BR /&gt;&lt;BR /&gt;It repeated libm, libcl and libc after libpthread!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Apr 2007 02:12:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976299#M95477</guid>
      <dc:creator>Jim Gallagher</dc:creator>
      <dc:date>2007-04-06T02:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976300#M95478</link>
      <description>&amp;gt;Your suggestion seems to cut to where the problem is, which I'm assuming is a bug in ld or dld.&lt;BR /&gt;&lt;BR /&gt;I seriously doubt it.  I think it is an issue with a pthread stub.&lt;BR /&gt;&lt;BR /&gt;To track it down you would have to set a breakpoint to see where errno gets changed to  EINVAL 22.&lt;BR /&gt;&lt;BR /&gt;If you are in the main thread, you could just put a hardware watch point on errno.&lt;BR /&gt;&lt;BR /&gt;If in another thread, you would have to set a breakpoint on __errno and finish then see if a store or load.&lt;BR /&gt;&lt;BR /&gt;Or you could just use "rbreak pthread" just before your bad call to shl_findsym.&lt;BR /&gt;&lt;BR /&gt;(Perhaps just the command "rbreak pthread" may tell you where the bogus stub is?  You only want to see the ones in libpthread.)&lt;BR /&gt;&lt;BR /&gt;You can use "catch load" to set break points before the shlibs are loaded.</description>
      <pubDate>Fri, 06 Apr 2007 02:31:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976300#M95478</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-04-06T02:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976301#M95479</link>
      <description>Dennis,&lt;BR /&gt;&lt;BR /&gt;Using the debugger before my code even starts running is new to me. I tried what you suggested, but I think the only new information of interest was printed by gdb when I started the program without setting anything:&lt;BR /&gt;&lt;BR /&gt;(gdb) r&lt;BR /&gt;Starting program: /code/PDM/Servers/fmapi/v10_00jim/FMgrMain &lt;BR /&gt;aCC runtime: Error 22 from shl_findsym(/usr/lib/libCsup_v2.2,_shlInit)&lt;BR /&gt;&lt;BR /&gt;Program received signal SIGABRT, Aborted.&lt;BR /&gt;0x79ad55d8 in kill+0x10 () from /usr/lib/libc.2&lt;BR /&gt;(gdb) &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Remember, my code is not even reached. In fact, I don't even use threads, but the vendor libs are linked against libpthread. Also, I don't explicitly call any of the shl_ functions.&lt;BR /&gt;&lt;BR /&gt;So, you don't think it's related that aCC repeats libm, libcl and libc after libpthread on the link line? &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Jim&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Apr 2007 09:18:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976301#M95479</guid>
      <dc:creator>Jim Gallagher</dc:creator>
      <dc:date>2007-04-06T09:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976302#M95480</link>
      <description>&amp;gt;I tried what you suggested, but I think the only new information of interest was printed by gdb when I started the program without setting anything:&lt;BR /&gt;&lt;BR /&gt;Isn't this the same?&lt;BR /&gt;You need to use "catch load" then the rbreak. &lt;BR /&gt;&lt;BR /&gt;&amp;gt;you don't think it's related that aCC repeats libm, libcl and libc after libpthread on the link line?&lt;BR /&gt;&lt;BR /&gt;First of all, it isn't aCC that is duplicating them, it is you or your makefile.&lt;BR /&gt;&lt;BR /&gt;And as long as libc isn't before libpthread, you should be fine.&lt;BR /&gt;&lt;BR /&gt;Rats, that's the problem.  You can't have -lc before -lpthread:&lt;BR /&gt;-lm -lcl -ldld -lc -lnsl ... -lpthread -lc&lt;BR /&gt;&lt;BR /&gt;This only works because of the extra:&lt;BR /&gt;-lpthread -lae ...</description>
      <pubDate>Fri, 06 Apr 2007 19:25:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976302#M95480</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-04-06T19:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976303#M95481</link>
      <description>Dennis,&lt;BR /&gt;&lt;BR /&gt;&amp;gt;First of all, it isn't aCC that is duplicating them, it is you or your makefile.&lt;BR /&gt;&amp;gt;&lt;BR /&gt;You are right again.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;And as long as libc isn't before libpthread, you should be fine.&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&amp;gt;Rats, that's the problem. You can't have -lc before -lpthread:&lt;BR /&gt;&amp;gt;-lm -lcl -ldld -lc -lnsl ... -lpthread -lc&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&amp;gt;This only works because of the extra:&lt;BR /&gt;&amp;gt;-lpthread -lae ...&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Once I took all the implied libs out of the script (for real this time), aCC put the implied system libs in this order on the link line:&lt;BR /&gt;-lstd_v2 -lCsup_v2 -lpthread -lm -lcl -lc /usr/lib/libdld.sl&lt;BR /&gt;&lt;BR /&gt;Why must libpthread come before libc on the link line?&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;Jim</description>
      <pubDate>Mon, 09 Apr 2007 15:21:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976303#M95481</guid>
      <dc:creator>Jim Gallagher</dc:creator>
      <dc:date>2007-04-09T15:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: -mt and -lpthread on HP-UX 11.11</title>
      <link>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976304#M95482</link>
      <description>&amp;gt;Why must libpthread come before libc on the link line?&lt;BR /&gt;&lt;BR /&gt;Because libc has a bunch of pthread_* stubs.  And if libc comes first, the binding order will call the stubs, rather than the real functions in libpthread.</description>
      <pubDate>Mon, 09 Apr 2007 19:35:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/mt-and-lpthread-on-hp-ux-11-11/m-p/3976304#M95482</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-04-09T19:35:46Z</dc:date>
    </item>
  </channel>
</rss>

