Mercury Bugs - mercury
View Issue Details
0000275mercuryBugpublic2013-02-18 11:472013-02-20 11:58
Reporterwangp 
Assigned Towangp 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000275: hidden symbol pthread_atfork
DescriptionOn Ubuntu 12.04 (at least) the linker spits out an error message when you try to build most programs in a parallel grade, e.g. hlc.par.gc.

/usr/bin/ld: test: hidden symbol `pthread_atfork' in /usr/lib/i386-linux-gnu/libpthread_nonshared.a(pthread_atfork.oS) is referenced by DSO

The solution appears to be to pass -pthread at the link step, either in addition to or replacing -lpthread. Actually we should probably pass -pthread for compilation steps as well.
TagsNo tags attached.
Attached Files

Notes
(0000496)
juliensf   
2013-02-18 13:05   
You should only pass -pthread for C compilers that actually support that
option. The (Mercury) compiler should have enough version information about the
C compiler available in order to determine this.
(0000497)
wangp   
2013-02-18 14:36   
I'm thinking we just need to update configure.ac near line 2962 for $host = *linux*. The compilers in use there seem to all support -pthread (gcc, clang, icc, does lcc even work?).
(0000498)
juliensf   
2013-02-18 16:02   
Older versions of gcc (e.g. 4.2 etc) only seem to support it for things
like IA64, PowerPC and SPARC. (Presumably, it has no effect on other
things?) So, it should be ok to enable it for all versions of GCC.

It should be ok to always enable it for clang.

AFAIK, we don't support icc.

If some uses lcc and it doesn't work then we'll do something about that.
(Otherwise, I don't care about it for the time being.)

Yes, you need to pass -pthread for all compilation steps since on some
platforms it apparently affects the preprocessor as well.
(0000499)
wangp   
2013-02-20 11:58   
Fixed the underlying issue.

Issue History
2013-02-18 11:47wangpNew Issue
2013-02-18 13:05juliensfNote Added: 0000496
2013-02-18 14:36wangpNote Added: 0000497
2013-02-18 16:02juliensfNote Added: 0000498
2013-02-20 11:58wangpNote Added: 0000499
2013-02-20 11:58wangpStatusnew => resolved
2013-02-20 11:58wangpResolutionopen => fixed
2013-02-20 11:58wangpAssigned To => wangp