Opened 9 years ago

Closed 9 years ago

#4973 closed bug (fixed)

building ghc7.0.1.20110217 under x86 solaris fails

Reported by: maeder Owned by:
Priority: highest Milestone: 7.2.1
Component: Compiler Version: 7.0.2
Keywords: Cc: kgardas, viskovatoff@…
Operating System: Solaris Architecture: x86
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

creating libHSrts-ghc7.0.1.20110217.so with inplace/bin/ghc-stage1 fails with the solaris linker.

===--- finished updating makefiles
gmake -r --no-print-directory -f ghc.mk all
/bin/sh: cygpath: not found
"rm" -f rts/dist/build/libHSrts-ghc7.0.1.20110217.so
"inplace/bin/ghc-stage1" -package-name rts -shared -dynamic -dynload deploy -no-auto-link-packages `cat rts/libs.depend` rts/dist/build/STM.dyn_o rts/dist/build/Printer.dyn_o rts/dist/build/ThreadPaused.dyn_o rts/dist/build/Ticky.dyn_o rts/dist/build/RtsMain.dyn_o rts/dist/build/ThreadLabels.dyn_o rts/dist/build/Hpc.dyn_o rts/dist/build/HsFFI.dyn_o rts/dist/build/Timer.dyn_o rts/dist/build/RtsDllMain.dyn_o rts/dist/build/RtsMessages.dyn_o rts/dist/build/Proftimer.dyn_o rts/dist/build/Schedule.dyn_o rts/dist/build/Hash.dyn_o rts/dist/build/Threads.dyn_o rts/dist/build/Trace.dyn_o rts/dist/build/RaiseAsync.dyn_o rts/dist/build/Weak.dyn_o rts/dist/build/Task.dyn_o rts/dist/build/StgCRun.dyn_o rts/dist/build/LdvProfile.dyn_o rts/dist/build/ClosureFlags.dyn_o rts/dist/build/RetainerProfile.dyn_o rts/dist/build/Stats.dyn_o rts/dist/build/Interpreter.dyn_o rts/dist/build/FrontPanel.dyn_o rts/dist/build/Messages.dyn_o rts/dist/build/RtsUtils.dyn_o rts/dist/build/Capability.dyn_o rts/dist/build/Globals.dyn_o rts/dist/build/Adjustor.dyn_o rts/dist/build/RtsAPI.dyn_o rts/dist/build/Inlines.dyn_o rts/dist/build/WSDeque.dyn_o rts/dist/build/Linker.dyn_o rts/dist/build/Disassembler.dyn_o rts/dist/build/Profiling.dyn_o rts/dist/build/Papi.dyn_o rts/dist/build/StgPrimFloat.dyn_o rts/dist/build/RtsStartup.dyn_o rts/dist/build/RetainerSet.dyn_o rts/dist/build/Sparks.dyn_o rts/dist/build/RtsFlags.dyn_o rts/dist/build/Stable.dyn_o rts/dist/build/Arena.dyn_o rts/dist/build/ProfHeap.dyn_o rts/dist/build/hooks/RtsOpts.dyn_o rts/dist/build/hooks/StackOverflow.dyn_o rts/dist/build/hooks/RtsOptsEnabled.dyn_o rts/dist/build/hooks/OnExit.dyn_o rts/dist/build/hooks/FlagDefaults.dyn_o rts/dist/build/hooks/MallocFail.dyn_o rts/dist/build/hooks/OutOfHeap.dyn_o rts/dist/build/parallel/ParInit.dyn_o rts/dist/build/parallel/HLComms.dyn_o rts/dist/build/parallel/0Unpack.dyn_o rts/dist/build/parallel/LLComms.dyn_o rts/dist/build/parallel/GranSim.dyn_o rts/dist/build/parallel/Dist.dyn_o rts/dist/build/parallel/Global.dyn_o rts/dist/build/parallel/Parallel.dyn_o rts/dist/build/parallel/ParTicky.dyn_o rts/dist/build/parallel/0Hash.dyn_o rts/dist/build/parallel/ParallelDebug.dyn_o rts/dist/build/parallel/RBH.dyn_o rts/dist/build/parallel/Pack.dyn_o rts/dist/build/sm/Storage.dyn_o rts/dist/build/sm/Evac.dyn_o rts/dist/build/sm/Sanity.dyn_o rts/dist/build/sm/GC.dyn_o rts/dist/build/sm/MarkWeak.dyn_o rts/dist/build/sm/BlockAlloc.dyn_o rts/dist/build/sm/GCUtils.dyn_o rts/dist/build/sm/GCAux.dyn_o rts/dist/build/sm/Sweep.dyn_o rts/dist/build/sm/Compact.dyn_o rts/dist/build/sm/Scav.dyn_o rts/dist/build/sm/MBlock.dyn_o rts/dist/build/eventlog/EventLog.dyn_o rts/dist/build/posix/Select.dyn_o rts/dist/build/posix/Signals.dyn_o rts/dist/build/posix/TTY.dyn_o rts/dist/build/posix/Itimer.dyn_o rts/dist/build/posix/FileLock.dyn_o rts/dist/build/posix/OSThreads.dyn_o rts/dist/build/posix/GetTime.dyn_o rts/dist/build/posix/OSMem.dyn_o   rts/dist/build/StgMiscClosures.dyn_o rts/dist/build/HeapStackCheck.dyn_o rts/dist/build/StgStdThunks.dyn_o rts/dist/build/Exception.dyn_o rts/dist/build/Apply.dyn_o rts/dist/build/Updates.dyn_o rts/dist/build/PrimOps.dyn_o rts/dist/build/StgStartup.dyn_o rts/dist/build/AutoApply.dyn_o  -o rts/dist/build/libHSrts-ghc7.0.1.20110217.so
ld: warning: option -o appears more than once, first setting taken
ld: fatal: file libHSrts-ghc7.0.1.20110217.so: open failed: No such file or directory
ld: fatal: File processing errors. No output written to rts/dist/build/libHSrts-ghc7.0.1.20110217.so
gmake[1]: *** [rts/dist/build/libHSrts-ghc7.0.1.20110217.so] Error 1
gmake: *** [all] Error 2

The actual linker call looks as follows:

 /usr/ccs/bin/ld -V -G -dy -z text -Y P,/usr/ccs/lib:/usr/lib -Qy -o rts/dist/build/libHSrts-ghc7.0.1.20110217.so /usr/lib/crti.o /usr/lib/values-Xa.o /export/local/csw/gcc4/bin/../lib/gcc/i386-pc-solaris2.10/4.3.3/crtbegin.o -L/export/local/csw/gcc4/bin/../lib/gcc/i386-pc-solaris2.10/4.3.3 -L/export/local/csw/gcc4/bin/../lib/gcc -L/export/local/csw/gcc4/bin/../lib/gcc/i386-pc-solaris2.10/4.3.3/../../.. -soname libHSrts-ghc7.0.1.20110217.so rts/dist/build/STM.dyn_o rts/dist/build/Printer.dyn_o rts/dist/build/ThreadPaused.dyn_o rts/dist/build/Ticky.dyn_o rts/dist/build/RtsMain.dyn_o rts/dist/build/ThreadLabels.dyn_o rts/dist/build/Hpc.dyn_o rts/dist/build/HsFFI.dyn_o rts/dist/build/Timer.dyn_o rts/dist/build/RtsDllMain.dyn_o rts/dist/build/RtsMessages.dyn_o rts/dist/build/Proftimer.dyn_o rts/dist/build/Schedule.dyn_o rts/dist/build/Hash.dyn_o rts/dist/build/Threads.dyn_o rts/dist/build/Trace.dyn_o rts/dist/build/RaiseAsync.dyn_o rts/dist/build/Weak.dyn_o rts/dist/build/Task.dyn_o rts/dist/build/StgCRun.dyn_o rts/dist/build/LdvProfile.dyn_o rts/dist/build/ClosureFlags.dyn_o rts/dist/build/RetainerProfile.dyn_o rts/dist/build/Stats.dyn_o rts/dist/build/Interpreter.dyn_o rts/dist/build/FrontPanel.dyn_o rts/dist/build/Messages.dyn_o rts/dist/build/RtsUtils.dyn_o rts/dist/build/Capability.dyn_o rts/dist/build/Globals.dyn_o rts/dist/build/Adjustor.dyn_o rts/dist/build/RtsAPI.dyn_o rts/dist/build/Inlines.dyn_o rts/dist/build/WSDeque.dyn_o rts/dist/build/Linker.dyn_o rts/dist/build/Disassembler.dyn_o rts/dist/build/Profiling.dyn_o rts/dist/build/Papi.dyn_o rts/dist/build/StgPrimFloat.dyn_o rts/dist/build/RtsStartup.dyn_o rts/dist/build/RetainerSet.dyn_o rts/dist/build/Sparks.dyn_o rts/dist/build/RtsFlags.dyn_o rts/dist/build/Stable.dyn_o rts/dist/build/Arena.dyn_o rts/dist/build/ProfHeap.dyn_o rts/dist/build/hooks/RtsOpts.dyn_o rts/dist/build/hooks/StackOverflow.dyn_o rts/dist/build/hooks/RtsOptsEnabled.dyn_o rts/dist/build/hooks/OnExit.dyn_o rts/dist/build/hooks/FlagDefaults.dyn_o rts/dist/build/hooks/MallocFail.dyn_o rts/dist/build/hooks/OutOfHeap.dyn_o rts/dist/build/parallel/ParInit.dyn_o rts/dist/build/parallel/HLComms.dyn_o rts/dist/build/parallel/0Unpack.dyn_o rts/dist/build/parallel/LLComms.dyn_o rts/dist/build/parallel/GranSim.dyn_o rts/dist/build/parallel/Dist.dyn_o rts/dist/build/parallel/Global.dyn_o rts/dist/build/parallel/Parallel.dyn_o rts/dist/build/parallel/ParTicky.dyn_o rts/dist/build/parallel/0Hash.dyn_o rts/dist/build/parallel/ParallelDebug.dyn_o rts/dist/build/parallel/RBH.dyn_o rts/dist/build/parallel/Pack.dyn_o rts/dist/build/sm/Storage.dyn_o rts/dist/build/sm/Evac.dyn_o rts/dist/build/sm/Sanity.dyn_o rts/dist/build/sm/GC.dyn_o rts/dist/build/sm/MarkWeak.dyn_o rts/dist/build/sm/BlockAlloc.dyn_o rts/dist/build/sm/GCUtils.dyn_o rts/dist/build/sm/GCAux.dyn_o rts/dist/build/sm/Sweep.dyn_o rts/dist/build/sm/Compact.dyn_o rts/dist/build/sm/Scav.dyn_o rts/dist/build/sm/MBlock.dyn_o rts/dist/build/eventlog/EventLog.dyn_o rts/dist/build/posix/Select.dyn_o rts/dist/build/posix/Signals.dyn_o rts/dist/build/posix/TTY.dyn_o rts/dist/build/posix/Itimer.dyn_o rts/dist/build/posix/FileLock.dyn_o rts/dist/build/posix/OSThreads.dyn_o rts/dist/build/posix/GetTime.dyn_o rts/dist/build/posix/OSMem.dyn_o rts/dist/build/StgMiscClosures.dyn_o rts/dist/build/HeapStackCheck.dyn_o rts/dist/build/StgStdThunks.dyn_o rts/dist/build/Exception.dyn_o rts/dist/build/Apply.dyn_o rts/dist/build/Updates.dyn_o rts/dist/build/PrimOps.dyn_o rts/dist/build/StgStartup.dyn_o rts/dist/build/AutoApply.dyn_o -lm -lrt -ldl -lgcc_s -lgcc_s /export/local/csw/gcc4/bin/../lib/gcc/i386-pc-solaris2.10/4.3.3/crtend.o /usr/lib/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.500
ld: warning: option -o appears more than once, first setting taken
ld: fatal: file libHSrts-ghc7.0.1.20110217.so: open failed: No such file or directory
ld: fatal: File processing errors. No output written to rts/dist/build/libHSrts-ghc7.0.1.20110217.so

Attachments (3)

driver.dpatch (99.4 KB) - added by kgardas 9 years ago.
Fix for the issue
disable-sharedlibs-ghc-70x.diff (423 bytes) - added by kgardas 9 years ago.
This patch disables solaris shared libs support in GHC 7.0.3 release (fixes compilation failure on Solaris)
0001-disable-shared-lib-support-on-Solaris-10-and-older-f.patch (2.6 KB) - added by kgardas 9 years ago.
Fix: disable shared libs on Solaris older than Solaris 11

Download all attachments as: .zip

Change History (73)

comment:1 Changed 9 years ago by igloo

Component: Build SystemCompiler
Milestone: 7.0.3

Looks like it is parsing -soname libHSrts-ghc7.0.1.20110217.so as -s -o name libHSrts-ghc7.0.1.20110217.so.

I assume this didn't work with 7.0.1 either?

comment:2 Changed 9 years ago by maeder

I've got a working (though basically unused) ghc-7.0.1 (below). Was dynamic linking switched on? -soname is no legal option for solaris' ld. If I omit this part I get:

ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.500
ld: fatal: relocation error: R_386_GOTOFF: file rts/dist/build/STM.dyn_o: symbol capabilities: relocation must bind locally

ld-usage:

usage: ld [-6:abc:d:e:f:h:il:mo:p:rstu:z:B:CD:F:GI:L:M:N:P:Q:R:S:VY:?] file(s)
        [-64]           enforce a 64-bit link-edit
        [-a]            create an absolute file
        [-b]            do not do special PIC relocations in a.out
        [-B direct | nodirect]
                        establish direct bindings, or inhibit direct binding
                        to, the object being created
        [-B dynamic | static]
                        search for shared libraries|archives
        [-B eliminate]  eliminate unqualified global symbols from the
                        symbol table
        [-B group]      relocate object from within group
        [-B local]      reduce unqualified global symbols to local
        [-B reduce]     process symbol reductions
        [-B symbolic]   bind external references to definitions when creating
                        shared objects
        [-c name]       record configuration file `name'
        [-C]            demangle C++ symbol name diagnostics
        [-d y | n]      operate in dynamic|static mode
        [-D token,...]  print diagnostic messages
        [-e epsym]      use `epsym' as entry point address
        [-f name]       specify library for which this file is an auxiliary
                        filter
        [-F name]       specify library for which this file is a filter
        [-G]            create a shared object
        [-h name]       use `name' as internal shared object identifier
        [-i]            ignore LD_LIBRARY_PATH setting
        [-I name]       use `name' as path of interpreter
        [-l x]          search for libx.so or libx.a
        [-L path]       search for libraries in directory `path'
        [-m]            print memory map
        [-M mapfile]    use processing directives contained in `mapfile'
        [-N string]     create a dynamic dependency for `string'
        [-o outfile]    name the output file `outfile'
        [-p auditlib]   identify audit library to accompany this object
        [-P auditlib]   identify audit library for processing the dependencies
                        of this object
        [-Q y | n]      do|do not place version information in output file
        [-r]            create a relocatable object
        [-R path]       specify a library search path to be used at run time
        [-s]            strip any symbol and debugging information
        [-S supportlib]
                        specify a link-edit support library
        [-t]            do not warn of multiply-defined symbols that have
                        different sizes or alignments
        [-u symname]    create an undefined symbol `symname'
        [-V]            print version information
        [-Y P,dirlist]  use `dirlist' as a default path when searching for
                        libraries
        [-z absexec]    when building an executable absolute symbols
                        referenced in dynamic objects are promoted to
                        the executable
        [-z allextract | defaultextract | weakextract]
                        extract all member files, only members that resolve
                        undefined tor tentative symbols, or allow extraction of
                        archive members to resolvetweak references from 
                        archive files
        [-z altexec64]  execute the 64-bit link-editor
        [-z combreloc]  combine multiple relocation sections
        [-z defs]       disallow undefined symbol references
        [-z direct | nodirect]
                        enable|disable direct binding to shared object
                        dependencies
        [-z endfiltee]  marks a filtee such that it will terminate a filters
                        search
        [-z finiarray=function]
                        name of function to be appended to the .finiarray
        [-z groupperm | nogroupperm]
                        enable|disable setting of group permissions
                        on dynamic dependencies
        [-z help ]      print this usage message
        [-z ignore | record]
                        ignore|record unused dynamic dependencies
        [-z initarray=function]
                        name of function to be appended to the .initarray
        [-z initfirst]  mark object to indicate that its .init section should
                        be executed before the .init section of any other
                        objects
        [-z interpose]  dynamic object is to be an `interposer' on direct
                        bindings
        [-z lazyload | nolazyload]
                        enable|disable delayed loading of shared object
                        dependencies
        [-z ld32=arg1,arg2,...]
                        define arguments applicable to the 32-bit class of ld(1)
        [-z ld64=arg1,arg2,...]
                        define arguments applicable to the 64-bit class of ld(1)
        [-z loadfltr]   mark filter as requiring immediate loading of its
                        filtees at runtime
        [-z muldefs]    allow multiply-defined symbols
        [-z nocompstrtab]
                        disable compression of string tables
        [-z nodefs]     allow undefined symbol references
        [-z nodefaultlib]
                        mark object to ignore any default library search path
        [-z nodelete]   mark object as non-deletable
        [-z nodlopen]   mark object as non-dlopen()'able
        [-z nodump]     mark object as non-dldump()'able
        [-z now]        mark object as requiring non-lazy binding
        [-z nopartial]  expand any partially initialized symbols
        [-z noversion]  don't record any version sections
        [-z origin]     mark object as requiring $ORIGIN processing
        [-z preinitarray=function]
                        name of function to be appended to the .preinitarray
        [-z redlocsym]  reduce local syms in .symtab to a minimum
        [-z rescan]     rescan archive list until no further member
                        extraction occurs
        [-z text]       disallow output relocations against text
        [-z textoff]    allow output relocations against text
        [-z textwarn]   warn if there are relocations against text
        [-z verbose]    generate warnings for suspicious processings

ghc-7.0.1

-bash-3.00$ ghc --info
 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("Project version","7.0.1")
 ,("Booter version","6.12.3")
 ,("Stage","2")
 ,("Build platform","i386-unknown-solaris2")
 ,("Host platform","i386-unknown-solaris2")
 ,("Target platform","i386-unknown-solaris2")
 ,("Have interpreter","YES")
 ,("Object splitting","YES")
 ,("Have native code generator","YES")
 ,("Have llvm code generator","YES")
 ,("Use archives for ghci","False")
 ,("Support SMP","YES")
 ,("Unregisterised","NO")
 ,("Tables next to code","YES")
 ,("RTS ways","l debug  thr thr_debug thr_l thr_p ")
 ,("Leading underscore","NO")
 ,("Debug on","False")
 ,("LibDir","/home/pub-bkb/pc-solaris/ghc/ghc-7.0.1/lib/ghc-7.0.1")
 ,("Global Package DB","/home/pub-bkb/pc-solaris/ghc/ghc-7.0.1/lib/ghc-7.0.1/package.conf.d")
 ]

comment:3 Changed 9 years ago by igloo

Cc: kgardas added
Milestone: 7.0.37.0.2
Priority: normalhighest

Ah, you are right, it was enabled by this patch in 7.0.2, but wasn't in 7.0.1:

Fri Dec 17 08:46:17 GMT 2010  Karel Gardas <karel.gardas@centrum.cz>
  * provide shared libraries support on i386-unknown-solaris2 platform

Karel, do you know why this works for you? Do you use the GNU ld or something?

comment:4 in reply to:  3 Changed 9 years ago by kgardas

Replying to igloo:

Karel, do you know why this works for you? Do you use the GNU ld or something?

I'm using Solaris 11 Express here, it provides more modern ld:

$ which ld
/usr/bin/ld
$ ld --version
ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1726
$ gcc -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs
Configured with: /builds2/sfwnv-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++,f77,objc --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-20050802)
$ ls -la /usr/ccs/bin/ld
lrwxrwxrwx   1 root     root          12 Nov 26 12:12 /usr/ccs/bin/ld -> ../../bin/ld
$ ld --help
usage: ld [-3:6:abc:d:e:f:h:il:mo:p:rstu:z:B:CD:F:GI:L:M:N:P:Q:R:S:VW:Y:?] file(s)
	[-32]		enforce a 32-bit link-edit
	[-64]		enforce a 64-bit link-edit
	[-a]		create an absolute file
	[-b]		do not do special PIC relocations in a.out
	[-B direct | nodirect]
			establish direct bindings, or inhibit direct binding
			to, the object being created
	[-B dynamic | static]
			search for shared libraries|archives
	[-B eliminate]	eliminate unqualified global symbols from the
			symbol table
	[-B group]	relocate object from within group
	[-B local]	reduce unqualified global symbols to local
	[-B reduce]	process symbol reductions
	[-B symbolic]	bind external references to definitions when creating
			shared objects
	[-c name]	record configuration file 'name'
	[-C]		demangle C++ symbol name diagnostics
	[-d y | n]	operate in dynamic|static mode
	[-D token,...]	print diagnostic messages
	[-e epsym], [--entry epsym]
			use 'epsym' as entry point address
	[-f name], [--auxiliary name]
			specify library for which this file is an auxiliary
			filter
	[-F name], [--filter name]
			specify library for which this file is a filter
	[-G], [-shared]
			create a shared object
	[-h name], [--soname name]
			use 'name' as internal shared object identifier
	[-i]		ignore LD_LIBRARY_PATH setting
	[-I name]	use 'name' as path of interpreter
	[-l x], [--library x]
			search for libx.so or libx.a
	[-L path], [--library-path path]
			search for libraries in directory 'path'
	[-m]		print memory map
	[-M mapfile]	use processing directives contained in 'mapfile'
	[-N string]	create a dynamic dependency for 'string'
	[-o outfile], [--output outfile]
			name the output file 'outfile'
	[-p auditlib]	identify audit library to accompany this object
	[-P auditlib]	identify audit library for processing the dependencies
			of this object
	[-Q y | n]	do|do not place version information in output file
	[-r], [--relocatable]
			create a relocatable object
	[-R path], [-rpath path]
			specify a library search path to be used at run time
	[-s], [--strip-all]
			strip any symbol and debugging information
	[-S supportlib]
			specify a link-edit support library
	[-t]		do not warn of multiply-defined symbols that have
			different sizes or alignments
	[-u symname], [--undefined symname]
			create an undefined symbol 'symname'
	[-V], [--version]
			print version information
	[-Y P,dirlist]	use 'dirlist' as a default path when searching for
			libraries
	[-z absexec]	when building an executable absolute symbols
 			referenced in dynamic objects are promoted to
 			the executable
	[-z allextract | defaultextract | weakextract],
	[--whole-archive | --no-whole-archive]
			extract all member files, only members that resolve
			undefined or tentative symbols, or allow extraction of
			archive members to resolve weak references from 
			archive files
	[-z altexec64]	execute the 64-bit link-editor
	[-z combreloc | nocombreloc]
			combine|do not combine multiple relocation sections
	[-z deferred | nodeferred]
			enable|disable deferred identification of shared object
			dependencies
	[-z defs], [--no-undefined]
			disallow undefined symbol references
	[-z direct | nodirect]
			enable|disable direct binding to shared object
			dependencies
	[-z endfiltee]	marks a filtee such that it will terminate a filters
			search
	[-z fatal-warnings | nofatal-warnings],
	[--fatal-warnings | --no-fatal-warnings]
		enable|disable treatment of warnings as fatal
	[-z finiarray=function]
			name of function to be appended to the .fini_array
	[-z groupperm | nogroupperm]
			enable|disable setting of group permissions
			on dynamic dependencies
	[-z guidance | -z guidance=item1,item2,...]
			enable guidance warnings. items: noall, nodefs,
			nodirect, nolazyload, nomapfile, notext, nounused
	[-z help], [--help]
			print this usage message
	[-z ignore | record]
			ignore|record unused dynamic dependencies
	[-z initarray=function]
			name of function to be appended to the .init_array
	[-z initfirst]	mark object to indicate that its .init section should
			be executed before the .init section of any other
			objects
	[-z interpose]	dynamic object is to be an 'interposer' on direct
			bindings
	[-z lazyload | nolazyload]
			enable|disable delayed loading of shared object
			dependencies
	[-z ld32=arg1,arg2,...]
			define arguments applicable to the 32-bit class of ld(1)
	[-z ld64=arg1,arg2,...]
			define arguments applicable to the 64-bit class of ld(1)
	[-z loadfltr]	mark filter as requiring immediate loading of its
			filtees at runtime
	[-z muldefs], [--allow-multiple-definition]
			allow multiply-defined symbols
	[-z nocompstrtab]
			disable compression of string tables
	[-z nodefs]	allow undefined symbol references
	[-z nodefaultlib]
			mark object to ignore any default library search path
	[-z nodelete]	mark object as non-deletable
	[-z nodlopen]	mark object as non-dlopen()'able
	[-z nodump]	mark object as non-dldump()'able
	[-z noldynsym]	do not add a .SUNW_ldynsym section
	[-z now]	mark object as requiring non-lazy binding
	[-z nopartial]	expand any partially initialized symbols
	[-z noversion]	do not record any version sections
	[-z origin]	mark object as requiring $ORIGIN processing
	[-z preinitarray=function]
			name of function to be appended to the .preinit_array
	[-z redlocsym]	reduce local syms in .symtab to a minimum
	[-z relaxreloc]	relax rules used for relocations against COMDAT sections
	[-z rescan]	after processing all arguments, rescan archive list
			until no further member extraction occurs
	[-z rescan-now]	immediately rescan archive list until
			no further member extraction occurs
	[-z rescan-start archives... -z rescan-end],
	[--start-group archives... --end-group], [-( archives... -)]
			rescan specified archive group upon reaching
			the end of the group, until no further
			member extraction occurs
	[-z symbolcap]	convert object capabilities to symbol capabilities
	[-z target=platform]
			target machine for cross linking
	[-z text]	disallow output relocations against text
	[-z textoff]	allow output relocations against text
	[-z textwarn]	warn if there are relocations against text
	[-z wrap=symbol], [-wrap=symbol], [--wrap=symbol]
			wrap symbol references
	[-z verbose]	generate warnings for suspicious processings
$ 

As you can see in my patch I've not tinkered with soname machinery and yet it works for me. My wild guess is that either ghc is using soname functionality by using gcc and gcc is used to use --soname or ghc does it on its own, and then we shall hack ghc to use -h' instead of --soname' on solaris. See my ld's --help output cut:

$ ld --help 2>&1|ggrep -C 1 soname
			create a shared object
	[-h name], [--soname name]
			use 'name' as internal shared object identifier

and compare this with Christian 5.10:

        [-h name]       use `name' as internal shared object identifier

Please let me know if I shall attempt to do this or you will do it yourself. I would done this in configure.ac machinery if done by myself.

comment:5 Changed 9 years ago by igloo

Owner: set to igloo

Actually, according to my manpage, gnu ld supports both:

`-h NAME'
`-soname=NAME'

and we don't use this code path on OS X or Windows, so I'll just change it to always use -h.

I'm surprised -soname works for you when --soname is what's in the help output, though. Perhaps they also accept that for GNU compatibility.

comment:6 Changed 9 years ago by kgardas

FYI: Yes, Solaris 11 Express' ld accepts also `-soname' (crude test):

$ ld -soname test
ld: fatal: soname option (-h, --soname) is incompatible with building a dynamic executable
ld: fatal: no files on input command line

comment:7 Changed 9 years ago by igloo

Resolution: fixed
Status: newclosed

Fixed in HEAD and 7.0 by:

Tue Feb 22 15:26:56 GMT 2011  Ian Lynagh <igloo@earth.li>
  * Use -h rather than -soname; fixes dynlibs on Solaris 10; trac #4973

comment:8 Changed 9 years ago by maeder

Owner: igloo deleted
Resolution: fixed
Status: closednew

The flag correction does not fix the relocation error:

ld: Schwerer Fehler: Verschiebungsfehler: R_386_GOTOFF: Datei rts/dist/build/STM.dyn_o: Symbol capabilities: Verschiebung muss lokal gebunden sein
gmake[1]: *** [rts/dist/build/libHSrts-ghc7.0.1.20110224.so] Fehler 1
gmake: *** [all] Fehler 2

comment:9 Changed 9 years ago by maeder

Here's the error in English

-bash-3.00$ "inplace/bin/ghc-stage1" -package-name rts -shared -dynamic -dynload deploy -no-auto-link-packages `cat rts/libs.depend` rts/dist/build/STM.dyn_o rts/dist/build/Timer.dyn_o rts/dist/build/ThreadPaused.dyn_o rts/dist/build/Ticky.dyn_o rts/dist/build/RtsMain.dyn_o rts/dist/build/ThreadLabels.dyn_o rts/dist/build/Hpc.dyn_o rts/dist/build/HsFFI.dyn_o rts/dist/build/Linker.dyn_o rts/dist/build/Printer.dyn_o rts/dist/build/RaiseAsync.dyn_o rts/dist/build/RtsMessages.dyn_o rts/dist/build/Proftimer.dyn_o rts/dist/build/Schedule.dyn_o rts/dist/build/Hash.dyn_o rts/dist/build/Trace.dyn_o rts/dist/build/Weak.dyn_o rts/dist/build/Task.dyn_o rts/dist/build/StgCRun.dyn_o rts/dist/build/LdvProfile.dyn_o rts/dist/build/ClosureFlags.dyn_o rts/dist/build/RetainerProfile.dyn_o rts/dist/build/Stats.dyn_o rts/dist/build/Interpreter.dyn_o rts/dist/build/FrontPanel.dyn_o rts/dist/build/Messages.dyn_o rts/dist/build/RtsUtils.dyn_o rts/dist/build/Threads.dyn_o rts/dist/build/Capability.dyn_o rts/dist/build/Globals.dyn_o rts/dist/build/Adjustor.dyn_o rts/dist/build/RtsStartup.dyn_o rts/dist/build/RtsAPI.dyn_o rts/dist/build/Inlines.dyn_o rts/dist/build/RtsDllMain.dyn_o rts/dist/build/WSDeque.dyn_o rts/dist/build/Disassembler.dyn_o rts/dist/build/Profiling.dyn_o rts/dist/build/Papi.dyn_o rts/dist/build/StgPrimFloat.dyn_o rts/dist/build/RetainerSet.dyn_o rts/dist/build/Sparks.dyn_o rts/dist/build/RtsFlags.dyn_o rts/dist/build/Stable.dyn_o rts/dist/build/Arena.dyn_o rts/dist/build/ProfHeap.dyn_o rts/dist/build/hooks/RtsOpts.dyn_o rts/dist/build/hooks/StackOverflow.dyn_o rts/dist/build/hooks/RtsOptsEnabled.dyn_o rts/dist/build/hooks/OnExit.dyn_o rts/dist/build/hooks/FlagDefaults.dyn_o rts/dist/build/hooks/MallocFail.dyn_o rts/dist/build/hooks/OutOfHeap.dyn_o rts/dist/build/parallel/ParInit.dyn_o rts/dist/build/parallel/LLComms.dyn_o rts/dist/build/parallel/0Unpack.dyn_o rts/dist/build/parallel/GranSim.dyn_o rts/dist/build/parallel/Dist.dyn_o rts/dist/build/parallel/Global.dyn_o rts/dist/build/parallel/Parallel.dyn_o rts/dist/build/parallel/ParTicky.dyn_o rts/dist/build/parallel/0Hash.dyn_o rts/dist/build/parallel/ParallelDebug.dyn_o rts/dist/build/parallel/HLComms.dyn_o rts/dist/build/parallel/RBH.dyn_o rts/dist/build/parallel/Pack.dyn_o rts/dist/build/sm/Storage.dyn_o rts/dist/build/sm/Evac.dyn_o rts/dist/build/sm/Sanity.dyn_o rts/dist/build/sm/GC.dyn_o rts/dist/build/sm/MarkWeak.dyn_o rts/dist/build/sm/BlockAlloc.dyn_o rts/dist/build/sm/GCUtils.dyn_o rts/dist/build/sm/GCAux.dyn_o rts/dist/build/sm/Sweep.dyn_o rts/dist/build/sm/Compact.dyn_o rts/dist/build/sm/Scav.dyn_o rts/dist/build/sm/MBlock.dyn_o rts/dist/build/eventlog/EventLog.dyn_o rts/dist/build/posix/Select.dyn_o rts/dist/build/posix/Signals.dyn_o rts/dist/build/posix/TTY.dyn_o rts/dist/build/posix/Itimer.dyn_o rts/dist/build/posix/FileLock.dyn_o rts/dist/build/posix/OSThreads.dyn_o rts/dist/build/posix/GetTime.dyn_o rts/dist/build/posix/OSMem.dyn_o   rts/dist/build/HeapStackCheck.dyn_o rts/dist/build/StgStdThunks.dyn_o rts/dist/build/Exception.dyn_o rts/dist/build/Apply.dyn_o rts/dist/build/StgMiscClosures.dyn_o rts/dist/build/Updates.dyn_o rts/dist/build/PrimOps.dyn_o rts/dist/build/StgStartup.dyn_o rts/dist/build/AutoApply.dyn_o  -o rts/dist/build/libHSrts-ghc7.0.1.20110224.so
ld: fatal: relocation error: R_386_GOTOFF: file rts/dist/build/STM.dyn_o: symbol capabilities: relocation must bind locally

comment:10 Changed 9 years ago by maeder

Omitting the "-shared" flag results in "ld: fatal: library -lHSrtsmain: not found", but for the 7.0.2 release I would suggest to switch off the recently added shared library support.

comment:11 Changed 9 years ago by kgardas

Unfortunately if you disable shared libs, then neither DTrace is working which is kind of pity, isn't it? Could you be so kind and test that the build does not break if you remove i386-unknown-solaris2 from PlatformSupportsSharedLibs in mk/config.mk ? If not, then this might be the easiest way how to disable the support, yet describe in Wiki how to enable it for SunOS 5.11 by user... And we can later investigate this failure for 7.2.1 release.

comment:12 Changed 9 years ago by maeder

I've never used DTrace and now I try to build with the changed mk/config.mk (it gets further). For the documentation I don't feel responsible.

comment:13 Changed 9 years ago by maeder

I could create a binary dist, but "make install" failed as follows:

/opt/csw/bin/ginstall -c -m 755 -d "/local/home/maeder/lib/ghc-7.0.1.20110224"
for i in utils/haddock/dist/build/tmp/haddock utils/hsc2hs/dist-install/build/tmp/hsc2hs utils/ghc-pkg/dist-install/build/tmp/ghc-pkg utils/runghc/dist/build/tmp/runghc ghc/stage2/build/tmp/ghc-stage2; do \
        /opt/csw/bin/ginstall -c -s -m 755; \
done
/opt/csw/bin/ginstall: missing file operand
Try `/opt/csw/bin/ginstall --help' for more information.
/opt/csw/bin/ginstall: missing file operand
Try `/opt/csw/bin/ginstall --help' for more information.
/opt/csw/bin/ginstall: missing file operand
Try `/opt/csw/bin/ginstall --help' for more information.
/opt/csw/bin/ginstall: missing file operand
Try `/opt/csw/bin/ginstall --help' for more information.
/opt/csw/bin/ginstall: missing file operand
Try `/opt/csw/bin/ginstall --help' for more information.
gmake[1]: *** [install_libexecs] Error 1
gmake: *** [install] Error 2

There seems to be a "$i" missing.

comment:14 Changed 9 years ago by maeder

Btw, during building I get 5313 "ignored" warnings, the firsts are:

"inplace/bin/ghc-stage1" -optc-Wall -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-Wredundant-decls -optc-includes -optc-Irts -optc-DCOMPILING_RTS -optc-fno-strict-aliasing -optc-fno-common -optc-Ilibffi/build/include -optc-fomit-frame-pointer -optc-DRtsWay=\"rts_v\"   -H32m -O -Iincludes -Irts -DCOMPILING_RTS -package-name rts  -dcmm-lint  -Ilibffi/build/include     -i -irts -irts/dist/build -irts/dist/build/autogen -Irts/dist/build -Irts/dist/build/autogen      -optc-O2   -c rts/STM.c -o rts/dist/build/STM.o
rts/STM.c: In function 'stmPreGCHook':

rts/STM.c:894:0:
     warning: visibility attribute not supported in this configuration; ignored
rts/STM.c: In function 'stmFreeAbortedTRec':

rts/STM.c:1002:0:
     warning: visibility attribute not supported in this configuration; ignored
rts/STM.c: In function 'stmCondemnTransaction':
...

comment:15 in reply to:  14 Changed 9 years ago by kgardas

Replying to maeder:

Btw, during building I get 5313 "ignored" warnings, the firsts are:

"inplace/bin/ghc-stage1" -optc-Wall -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-Wredundant-decls -optc-includes -optc-Irts -optc-DCOMPILING_RTS -optc-fno-strict-aliasing -optc-fno-common -optc-Ilibffi/build/include -optc-fomit-frame-pointer -optc-DRtsWay=\"rts_v\"   -H32m -O -Iincludes -Irts -DCOMPILING_RTS -package-name rts  -dcmm-lint  -Ilibffi/build/include     -i -irts -irts/dist/build -irts/dist/build/autogen -Irts/dist/build -Irts/dist/build/autogen      -optc-O2   -c rts/STM.c -o rts/dist/build/STM.o
rts/STM.c: In function 'stmPreGCHook':

rts/STM.c:894:0:
     warning: visibility attribute not supported in this configuration; ignored
rts/STM.c: In function 'stmFreeAbortedTRec':

rts/STM.c:1002:0:
     warning: visibility attribute not supported in this configuration; ignored
rts/STM.c: In function 'stmCondemnTransaction':
...

What GCC are you using? Here with GCC 3.4.3 (csl-sol210-3_4-20050802) as bundled with Solaris 11 Express I don't see those warnings since it's too old (the compiler) to support any visibility functionality. My guess is you are using some newer GCC probably...

comment:16 Changed 9 years ago by maeder

"gcc -v" says:

Using built-in specs.
Target: i386-pc-solaris2.10
Configured with: ../gcc-4.3.3/configure --prefix=/opt/csw/gcc4 --exec-prefix=/opt/csw/gcc4 --with-gnu-as --with-as=/opt/csw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-nls --with-included-gettext --with-libiconv-prefix=/opt/csw --with-x --with-mpfr=/opt/csw --with-gmp=/opt/csw --enable-java-awt=xlib --enable-libada --enable-libssp --enable-objc-gc --enable-threads=posix --enable-stage1-languages=c --enable-languages=ada,c,c++,fortran,java,objc
Thread model: posix
gcc version 4.3.3 (GCC) 

comment:17 Changed 9 years ago by kgardas

Ah, this looks like 4.3.3 provided by Blastwave. If you consider those visibility warnings ugly, then you can try bundled 3.4.3. It is stable on x86, test results on head including all the build warnings for your reference are here: http://darcs.haskell.org/ghcBuilder/builders/kgardas-opensolaris-x86-head/145.html

comment:18 in reply to:  13 Changed 9 years ago by igloo

Replying to maeder:

I could create a binary dist, but "make install" failed as follows:

There seems to be a "$i" missing.

This is with GNU make, I assume? What version do you have?

comment:19 Changed 9 years ago by maeder

GNU Make 3.82

comment:20 Changed 9 years ago by maeder

The variant without "call" in ghc.mk as used before (in ghc-7.0.1) works:

-               $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)"; \
+               $(call INSTALL_SCRIPT,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibexecdir)"); \

But there are many places where this would need to be changed.

comment:21 Changed 9 years ago by igloo

Hmm, I've just validated (which includes installing a bindist) with 3.82 with no problems on amd64/Linux.

comment:22 Changed 9 years ago by maeder

Maybe it is a problem with "sh" versus "bash" via make's "$(call ..)"?

comment:23 in reply to:  13 ; Changed 9 years ago by kgardas

Replying to maeder:

I could create a binary dist, but "make install" failed as follows:

I've installed "entire group" Solaris 10 update 8 into VirtualBox for verification and while I'm able to verify that shared libs are not working well, I'm certainly able to compile whole GHC 7.0.2 snapshot including its installation. However, I have to point out that this is really stock Solaris 10 as provided by Oracle/Sun and I have not installed any Blastwave package. The only one package I've installed was GNU Make 3.82 and of course ghc 6.10.4 to bootstrap 7.0.1 which was used to bootstrap 7.0.2 snapshot.

comment:24 in reply to:  23 Changed 9 years ago by kgardas

Replying to kgardas:

Replying to maeder:

I could create a binary dist, but "make install" failed as follows:

I've installed "entire group" Solaris 10 update 8 into VirtualBox for verification and while I'm able to verify that shared libs are not working well, I'm certainly able to compile whole GHC 7.0.2 snapshot including its installation. However, I have to point out that this is really stock Solaris 10 as provided by Oracle/Sun and I have not installed any Blastwave package. The only one package I've installed was GNU Make 3.82 and of course ghc 6.10.4 to bootstrap 7.0.1 which was used to bootstrap 7.0.2 snapshot.

Also my PATH looks like: /usr/xpg4/bin:/usr/ccs/bin:/usr/local/bin:/opt/ghc-7.0.1/bin:/usr/bin:.

comment:25 in reply to:  13 Changed 9 years ago by maeder

Replying to maeder:

I've no explanation for the failure. I've reinstalled GNU Make 3.82 and GNU Make 3.81 with the same failure. Within the "for" loop, all parameters following "$(call INSTALL_PROGRAM" are simply ignored. The shell used by make is indeed /bin/sh, which is different from /bin/bash.

comment:26 Changed 9 years ago by igloo

$(call ..) doesn't use the shell. It calls a user-defined makefile function.

comment:27 Changed 9 years ago by maeder

Right, setting SHELL to /bin/bash did also not help, but why are the parameters ignored (just for me)?

comment:28 Changed 9 years ago by maeder

I've found the error, it was a setting in my build.mk!

INSTALL_PROGRAM = $(INSTALL) -s -m 755

that overwrote

INSTALL_PROGRAM = $(INSTALL) -m 755 $1 $2 $(call MK_INSTALL_DEST,$3)

in install.mk

Please make a release.

comment:29 in reply to:  9 Changed 9 years ago by maeder

The error of maeder is still present in ghc-7.0.2. In order to build ghc-7.0.2 for SunOS 5.10 the "i386-unknown-solaris2 \" entry must be removed from PlatformSupportsSharedLibs in config.mk.in, otherwise config.mk will be wrongly generated for the installation, too (and fail).

comment:30 Changed 9 years ago by igloo

Milestone: 7.0.27.2.1

comment:31 in reply to:  23 ; Changed 9 years ago by maeder

Version: 7.0.17.0.2

Replying to kgardas: ...

I've installed "entire group" Solaris 10 update 8 into VirtualBox for verification and while I'm able to verify that shared libs are not working well, ...

Did you get the same relocation error as shown above? Do you have an idea how to fix it? Without fix I would recommend to disable dynamic linking in config.mk.in for ghc-7.0.3

comment:32 in reply to:  31 Changed 9 years ago by kgardas

Replying to maeder:

Replying to kgardas: ...

I've installed "entire group" Solaris 10 update 8 into VirtualBox for verification and while I'm able to verify that shared libs are not working well, ...

Did you get the same relocation error as shown above? Do you have an idea how to fix it? Without fix I would recommend to disable dynamic linking in config.mk.in for ghc-7.0.3

IIRC I've got different relocation error. IMHO since Oracle plans to release Solaris 11 in 2011 it would be unfortunate to have 7.0.3 not supporting shared libs and DTrace on this new Solaris. What about to disable shared libs on 5.8/5.9/5.10 (i.e. Solaris 8/9/10) and leave it enabled for other (i.e. 5.11 == Solaris 11 and future 5.12/Solaris 12)? I may come with this patch for HEAD. Do you think you will be able to also apply it to STABLE?

comment:33 Changed 9 years ago by kgardas

I'm currently investigating a possible simple fix of using -mimpure-text as a gcc argument on solaris. This will force gcc not to pass -z text argument to linker which causes the issue. On the other hand -z text provides nice error output, which might not be error if we use -z textwarn. Unfortunately -z textwarn does not switch -z text off, but gcc fails with a complain that both options are in conflict. So the best for us would to use use -mimpure-text -W,-z -W,textwarn as a gcc parameters on Solaris -- at least on x86 to get the best of both worlds: linking not failing on relocations yet providing warnings about them. Anyway, I'm still testing the idea...

comment:34 Changed 9 years ago by kgardas

Owner: set to kgardas

Changed 9 years ago by kgardas

Attachment: driver.dpatch added

Fix for the issue

comment:35 Changed 9 years ago by kgardas

Owner: changed from kgardas to igloo

comment:36 Changed 9 years ago by kgardas

Status: newpatch

comment:37 Changed 9 years ago by kgardas

Attached patch changes DriverPipeline to also use -mimpure-text -Wl,-ztextwarn in case where -shared is used. This is done just for Solaris/x86. It runs fine on Solaris 11 (testsuite run) and it at least compiles RTS shared libs on Solaris 10 (the build is still running) so I hope this is ok. This means Solaris 10 should be now fully supported as Solaris 11 including shared libs, DTrace etc.

comment:38 Changed 9 years ago by simonmar

If we have to use -mimpure-text I think that indicates a bug somewhere else. It means we have relocations that would modify the text section, i.e. code that is not position-independent. Instead of working around the bug with -mimpure-text we should fix the bug in -fPIC. Using the workaround will affect performance (shared libs will not really be shared).

At the very least, if fixing -fPIC is not practical right now, we could apply the workaround with a big comment explaining why it is a workaround, and file a separate ticket for the real bug.

comment:39 Changed 9 years ago by kgardas

Simon, perhaps it's not clear, but we do have a situation where current HEAD is working well on Solaris 11, but is not working at all due to relocations errors on Solaris 10. IMHO all the source code of GHC is the same for both OSes. Yes, I know that such issue might be solved by -fPIC. In fact I've done this before for Solaris 11. Please see rts/ghc.mk and search for On Solaris we get errors like: Unfortunately now on Solaris 10 when everything is working well on Solaris 11 I don't see any -fPIC missing anywhere. I may reinvestigate this issue again in next two weeks, but IMHO this might as well be some bug either in gcc or as on Solaris 10 which is already fixed on Solaris 11. If this is the case, then we do have two possibilities: either (a) disable shared libs support on Solaris 10 and leave it enabled on Solaris 11 or (b) workaround issue by using -mimpure-text -Wl,-ztextwarn on both platforms. Currently I'm slightly inclined to (a) since (b) is still not the best on Solaris 10. The issue is: I'm able to build whole GHC, but I'm not able to build executable which would use shared libs due to conflicting -dn and -P options going to linker from GCC. So far I've not been able to find the right workaround for this. Perhaps Christian might try this? Of course the advantage of (b) is that you see all the warnings which would be error w/o using -mimpure-text and you can fix the code yourself if this is GHC issue...

comment:40 Changed 9 years ago by kgardas

Ah, also, on of the possible reason of the relocation errors on Solaris 10 and not on Solaris 11 might be that GHC depends on some system library which is provided only in a static form on Solaris 10 while it is provided as a shared library on Solaris 11. This also needs to be investigated...

comment:41 Changed 9 years ago by simonmar

Sure. My main concern here is that we're throwing in workarounds for bugs that we don't understand, and in my experience that leads to pain later. Better understand the bug first, and then decide whether the workaround is the right choice or not (your theory about a static lib sounds plausible).

Having said that, it's not a perfect world and fully diagnosing a bug isn't always possible (or desirable). But if that's the case we need at least to put some comments in the code to explain why.

comment:42 Changed 9 years ago by kgardas

Unfortunately it looks like the problematic files are coming from RTS. At least I've googled for similar issues and linker always complained about wrongly compiled object file and in our case it complains about files from RTS. Unfortunately those files are compiled with -fPIC, at least as my record of whole compilation session claim. Do you know where the -c' invocation of gcc is placed? I'd like to put there also -v' to see in a log that gcc is really using -fPIC...

comment:43 Changed 9 years ago by kgardas

On the other hand, we still do have a possibility to disable shared libs on Solaris <11. It might be done purely for Solaris, but it might also be done with general configure --disable-shared option. The question is what you would prefer more?

comment:44 Changed 9 years ago by igloo

Is this related to the -read_only_relocs flag we use on OS X (#2262)?

     -read_only_relocs treatment
                 Enables the use of relocations which will cause dyld to modify (copy-on-write) read-only
                 pages.  The compiler will normally never generate such code.

comment:45 Changed 9 years ago by kgardas

I'm not sure. My problem looks:

"inplace/bin/ghc-stage1" -package-name rts -shared -dynamic -dynload deploy -no-auto-link-packages `cat rts/libs.depend` rts/dist/build/STM.dyn_o rts/dist/build/Printer.dyn_o rts/dist/build/ThreadPaused.dyn_o rts/dist/build/Ticky.dyn_o rts/dist/build/RtsMain.dyn_o rts/dist/build/ThreadLabels.dyn_o rts/dist/build/HsFFI.dyn_o rts/dist/build/Linker.dyn_o rts/dist/build/RaiseAsync.dyn_o rts/dist/build/RtsMessages.dyn_o rts/dist/build/Proftimer.dyn_o rts/dist/build/Schedule.dyn_o rts/dist/build/Hash.dyn_o rts/dist/build/Trace.dyn_o rts/dist/build/Weak.dyn_o rts/dist/build/Task.dyn_o rts/dist/build/StgCRun.dyn_o rts/dist/build/LdvProfile.dyn_o rts/dist/build/ClosureFlags.dyn_o rts/dist/build/RetainerProfile.dyn_o rts/dist/build/Stats.dyn_o rts/dist/build/Interpreter.dyn_o rts/dist/build/FrontPanel.dyn_o rts/dist/build/Messages.dyn_o rts/dist/build/RtsUtils.dyn_o rts/dist/build/Timer.dyn_o rts/dist/build/Threads.dyn_o rts/dist/build/Capability.dyn_o rts/dist/build/Globals.dyn_o rts/dist/build/Adjustor.dyn_o rts/dist/build/RtsAPI.dyn_o rts/dist/build/Inlines.dyn_o rts/dist/build/RtsDllMain.dyn_o rts/dist/build/WSDeque.dyn_o rts/dist/build/Disassembler.dyn_o rts/dist/build/Profiling.dyn_o rts/dist/build/Papi.dyn_o rts/dist/build/StgPrimFloat.dyn_o rts/dist/build/RtsStartup.dyn_o rts/dist/build/RetainerSet.dyn_o rts/dist/build/Sparks.dyn_o rts/dist/build/RtsFlags.dyn_o rts/dist/build/Stable.dyn_o rts/dist/build/Arena.dyn_o rts/dist/build/Hpc.dyn_o rts/dist/build/ProfHeap.dyn_o rts/dist/build/hooks/RtsOpts.dyn_o rts/dist/build/hooks/StackOverflow.dyn_o rts/dist/build/hooks/RtsOptsEnabled.dyn_o rts/dist/build/hooks/OnExit.dyn_o rts/dist/build/hooks/FlagDefaults.dyn_o rts/dist/build/hooks/MallocFail.dyn_o rts/dist/build/hooks/OutOfHeap.dyn_o rts/dist/build/parallel/ParInit.dyn_o rts/dist/build/parallel/RBH.dyn_o rts/dist/build/parallel/0Unpack.dyn_o rts/dist/build/parallel/LLComms.dyn_o rts/dist/build/parallel/GranSim.dyn_o rts/dist/build/parallel/Dist.dyn_o rts/dist/build/parallel/Global.dyn_o rts/dist/build/parallel/Parallel.dyn_o rts/dist/build/parallel/ParTicky.dyn_o rts/dist/build/parallel/0Hash.dyn_o rts/dist/build/parallel/ParallelDebug.dyn_o rts/dist/build/parallel/HLComms.dyn_o rts/dist/build/parallel/Pack.dyn_o rts/dist/build/sm/Storage.dyn_o rts/dist/build/sm/Evac.dyn_o rts/dist/build/sm/Sanity.dyn_o rts/dist/build/sm/GC.dyn_o rts/dist/build/sm/MarkWeak.dyn_o rts/dist/build/sm/BlockAlloc.dyn_o rts/dist/build/sm/GCUtils.dyn_o rts/dist/build/sm/GCAux.dyn_o rts/dist/build/sm/Sweep.dyn_o rts/dist/build/sm/Compact.dyn_o rts/dist/build/sm/Scav.dyn_o rts/dist/build/sm/MBlock.dyn_o rts/dist/build/eventlog/EventLog.dyn_o rts/dist/build/posix/Select.dyn_o rts/dist/build/posix/Signals.dyn_o rts/dist/build/posix/TTY.dyn_o rts/dist/build/posix/Itimer.dyn_o rts/dist/build/posix/FileLock.dyn_o rts/dist/build/posix/OSThreads.dyn_o rts/dist/build/posix/GetTime.dyn_o rts/dist/build/posix/OSMem.dyn_o   rts/dist/build/StgMiscClosures.dyn_o rts/dist/build/HeapStackCheck.dyn_o rts/dist/build/StgStdThunks.dyn_o rts/dist/build/Apply.dyn_o rts/dist/build/Exception.dyn_o rts/dist/build/Updates.dyn_o rts/dist/build/PrimOps.dyn_o rts/dist/build/StgStartup.dyn_o rts/dist/build/AutoApply.dyn_o  -o rts/dist/build/libHSrts-ghc7.0.2.20110303.so
Text relocation remains                         referenced
    against symbol                  offset      in file
threadPaused                        0x4f5       rts/dist/build/Schedule.dyn_o
threadPaused                        0x1eb       rts/dist/build/Interpreter.dyn_o
threadPaused                        0x27a       rts/dist/build/Interpreter.dyn_o
threadPaused                        0x4ab       rts/dist/build/Interpreter.dyn_o
threadPaused                        0x532       rts/dist/build/Interpreter.dyn_o
threadPaused                        0x5f0       rts/dist/build/Interpreter.dyn_o
threadPaused                        0x691       rts/dist/build/Interpreter.dyn_o
threadPaused                        0x1123      rts/dist/build/Interpreter.dyn_o
threadPaused                        0x1198      rts/dist/build/Interpreter.dyn_o
initTimer                           0x43b       rts/dist/build/Schedule.dyn_o
initTimer                           0x155       rts/dist/build/RtsStartup.dyn_o
awaitEvent                          0xa01       rts/dist/build/Schedule.dyn_o
StgRun                              0xb2e       rts/dist/build/Schedule.dyn_o
StgRun                              0x210       rts/dist/build/RtsStartup.dyn_o
interpretBCO                        0xf5f       rts/dist/build/Schedule.dyn_o
exitTimer                           0x311       rts/dist/build/RtsStartup.dyn_o
initGlobalStore                     0x146       rts/dist/build/RtsStartup.dyn_o
exitGlobalStore                     0x334       rts/dist/build/RtsStartup.dyn_o
initFileLocking                     0x14b       rts/dist/build/RtsStartup.dyn_o
resetTerminalSettings               0x316       rts/dist/build/RtsStartup.dyn_o
freeFileLocking                     0x33e       rts/dist/build/RtsStartup.dyn_o
newArena                            0x195       rts/dist/build/ProfHeap.dyn_o
newArena                            0x77e       rts/dist/build/ProfHeap.dyn_o
arenaAlloc                          0x5e6       rts/dist/build/ProfHeap.dyn_o
arenaFree                           0x3ef       rts/dist/build/ProfHeap.dyn_o
sweep                               0x175b      rts/dist/build/sm/GC.dyn_o
getourtimeofday                     0x191       rts/dist/build/posix/Select.dyn_o
getourtimeofday                     0x370       rts/dist/build/posix/Select.dyn_o
getourtimeofday                     0x1c9       rts/dist/build/posix/Itimer.dyn_o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
gmake[1]: *** [rts/dist/build/libHSrts-ghc7.0.2.20110303.so] Error 1
gmake: *** [all] Error 2

and you know, this happens only on Solaris 10 and not on Solaris 11...

comment:46 in reply to:  45 Changed 9 years ago by simonmar

Replying to kgardas:

Text relocation remains referenced

against symbol offset in file

threadPaused 0x4f5 rts/dist/build/Schedule.dyn_o threadPaused 0x1eb rts/dist/build/Interpreter.dyn_o threadPaused 0x27a rts/dist/build/Interpreter.dyn_o threadPaused 0x4ab rts/dist/build/Interpreter.dyn_o threadPaused 0x532 rts/dist/build/Interpreter.dyn_o threadPaused 0x5f0 rts/dist/build/Interpreter.dyn_o threadPaused 0x691 rts/dist/build/Interpreter.dyn_o threadPaused 0x1123 rts/dist/build/Interpreter.dyn_o threadPaused 0x1198 rts/dist/build/Interpreter.dyn_o initTimer 0x43b rts/dist/build/Schedule.dyn_o initTimer 0x155 rts/dist/build/RtsStartup.dyn_o awaitEvent 0xa01 rts/dist/build/Schedule.dyn_o StgRun 0xb2e rts/dist/build/Schedule.dyn_o StgRun 0x210 rts/dist/build/RtsStartup.dyn_o interpretBCO 0xf5f rts/dist/build/Schedule.dyn_o exitTimer 0x311 rts/dist/build/RtsStartup.dyn_o initGlobalStore 0x146 rts/dist/build/RtsStartup.dyn_o exitGlobalStore 0x334 rts/dist/build/RtsStartup.dyn_o initFileLocking 0x14b rts/dist/build/RtsStartup.dyn_o resetTerminalSettings 0x316 rts/dist/build/RtsStartup.dyn_o freeFileLocking 0x33e rts/dist/build/RtsStartup.dyn_o newArena 0x195 rts/dist/build/ProfHeap.dyn_o newArena 0x77e rts/dist/build/ProfHeap.dyn_o arenaAlloc 0x5e6 rts/dist/build/ProfHeap.dyn_o arenaFree 0x3ef rts/dist/build/ProfHeap.dyn_o sweep 0x175b rts/dist/build/sm/GC.dyn_o getourtimeofday 0x191 rts/dist/build/posix/Select.dyn_o getourtimeofday 0x370 rts/dist/build/posix/Select.dyn_o getourtimeofday 0x1c9 rts/dist/build/posix/Itimer.dyn_o

Interesting - these are all the symbols declared with RTS_PRIVATE in their header files. RTS_PRIVATE is defined like this:

// Symbols that are extern, but private to the RTS, are declared
// with visibility "hidden" to hide them outside the RTS shared
// library.
#if defined(HAS_VISIBILITY_HIDDEN)
#define RTS_PRIVATE  GNUC3_ATTRIBUTE(visibility("hidden"))
#else
#define RTS_PRIVATE  /* disabled: RTS_PRIVATE */
#endif

So the errors at least partly make sense: a hidden symbol is supposed to be resolved when the library is linked, so the relocation would be in the text section. Maybe the linker is not correctly resolving the symbol at link time, and leaving a dynamic relocation.

There seems to be a similar bug on FreeBSD, looking at rts/BeginPrivate.h:

/* We don't use symbol visibility pragmas on FreeBSD, because it causes
   "undefined reference" errors at link-time.  The true reasons are
   unknown, however FreeBSD 8.x includes GCC 4.2.1 in the base system,
   which might be buggy. */
/* On Windows, with gcc 4.5.0-1, using visibility hidden gives:
       error: visibility attribute not supported in this configuration; ignored
   */
#if defined(HAS_VISIBILITY_HIDDEN) && !defined(freebsd_HOST_OS)
#pragma GCC visibility push(hidden)
#endif

comment:47 Changed 9 years ago by kgardas

Simon, this is indeed good catch! I've modified Rts.h and although not needed also BeginPrivate.h and EndPrivate.h (just for case someone is using gcc >= 4.x) and disabled RTS_PRIVATE completely there like done for mingw and for freebsd and this time I'm able to build RTS shared lib. The problem is I'm stuck now on failure in gmp lib. It looks like a lot of unresolved symbols and again some relocations errors. When comparing with Solaris 11 Express reference, unresolved symbols are OK and the problem with GMP relocations is that on Solaris 11 Express we're using system supplied GMP, while this is not detected on stock Solaris 10 and hence GHC attempts to compile its own GMP lib, but in this case in a wrong way w/o any -fPIC and linker is complaining about it.

comment:48 Changed 9 years ago by simonmar

Right, if we're using dynamic linking then GMP should be compiled for dynamic linking too. I'm not sure what is supposed to happen here.

comment:49 Changed 9 years ago by kgardas

So when I installed GMP library myself (both static and shared) and with using appropriate --with-gmp-* options I'm able to fully build 7.0.2/3 snapshot. That's with just

#if !defined(mingw32_HOST_OS) && !defined(solaris2_HOST_OS)
#define RTS_PRIVATE  GNUC3_ATTRIBUTE(visibility("hidden"))
#else
#define RTS_PRIVATE  /* disabled: RTS_PRIVATE */
#endif

in Rts.h and with similar change in Begin/EndPrivate.h as I already mentioned. Now, I still do have the issue to link dynamic executable. The issue is exactly same like with -mimpure-text option:

Linking HelloWorld ...
ld: fatal: option -dn and -P are incompatible
ld: fatal: Flags processing errors
collect2: ld returned 1 exit status

Now the question is: submit this fix as it is now and later investigate this executable linking failure or investigate first and then submit as a whole? Also the question is, do the work on 7.0.x tree (7.0.3 snapshot) or on the HEAD? Thanks!

comment:50 Changed 9 years ago by simonmar

Note that in GHC HEAD, there's an autoconf test for visibility("hidden"), and the test is now in terms of that (HAS_VISIBILITY_HIDDEN).

What are the -dn and -P options to ld, and where do they come from? Why are they incompatible?

If the workaround is only required for Solaris 10, shouldn't we have an autoconf test for it?

comment:51 Changed 9 years ago by maeder

Hi, I'm quite disappointed that ghc-7.0.3 still fails:

ld: Schwerer Fehler: Verschiebungsfehler: R_386_GOTOFF: Datei rts/dist/build/STM.d
yn_o: Symbol capabilities: Verschiebung muss lokal gebunden sein
gmake[1]: *** [rts/dist/build/libHSrts-ghc7.0.3.so] Fehler 1
gmake: *** [all] Fehler 2

I appreciate if you try to find a proper fix, but in the mean time shared libraries should have been disabled.

comment:52 in reply to:  51 Changed 9 years ago by simonmar

Replying to maeder:

I appreciate if you try to find a proper fix, but in the mean time shared libraries should have been disabled.

I'm sorry if I gave the wrong impression here. Solaris is a community-supported platform, our role is to review and accept patches and provide guidance (which is what I was trying to do above). We don't have the resources to test patches for x86/Solaris ourselves. There was one patch submitted, which I objected to because it was (a) a workaround for a bug that nobody understood, and (b) didn't have any comments. We'd be happy to accept a patch that disables the broken functionality provided it is appropriately commented.

comment:53 Changed 9 years ago by kgardas

Hi, I take it as my fault. Now, the question is, will there be any 7.0.4 release? For 7.0.3 we should "solve" it by providing appropriate information about how to disable shared lib stuff on Sol10/x86 on trac wiki.

comment:54 Changed 9 years ago by herzen

Cc: viskovatoff@… added

Since no one appears to have created a Solaris package of a 7.x ghc release yet, I've uploaded ghc-7.1.spec here. This builds on Solaris 11 Express snv_151a.

By the way, I don't think that using gcc 3.4.3 is a long-term solution. So all the code should be modified not to use the gcc hidden visibility attribute when building for Solaris. As far as I can tell, the reason builds work on Solaris using gcc 3.4.3 is that that version doesn't know about visibility attributes.

Changed 9 years ago by kgardas

This patch disables solaris shared libs support in GHC 7.0.3 release (fixes compilation failure on Solaris)

comment:56 Changed 9 years ago by kgardas

Hello, I've retested GHC 7.0.3 and GHC HEAD as of 2011-03-25 on both Solaris 11 Express and Solaris 10 and found out that I was mistaken assuming 7.0.x builds fine on Solaris 11 Express. It does not. The attached patch disables shared libs support in GHC 7.0.3 release. On the other hand GHC HEAD seems to be compilable with shared libs support on both Solaris 11 Express and Solaris 10. On Solaris 11 Express the shared libs support is working well, while on Solaris 10 it is not working due to linker complaining about conflicting command-line options -dn and -P:

Linking HelloWorld ...
ld: fatal: option -dn and -P are incompatible
ld: fatal: Flags processing errors
collect2: ld returned 1 exit status

This is output of compiling bindisttest HelloWorld with ghc --make -dynamic on Solaris 10. The -dn option means that linker is working in static mode, i.e. linking static executable. The -P option is documented in man ld as:

     -P auditlib

         Identifies  an  audit  library,  auditlib.  This   audit
         library  is used to audit the dependencies of the object
         being created at runtime. Dependency auditing  can  also
         be  inherited  from  dependencies that are identified as
         requiring auditing. See the -p option.

comment:57 Changed 9 years ago by igloo

So if I understand correctly, in the HEAD:

  • nothing needs to be done for Solaris 11
  • The -dn / -P problem needs to be fixed for Solaris 10.

I don't understand where those flags are coming from though. I can't find them anywhere in the GHC tree?

comment:58 Changed 9 years ago by kgardas

Yes, you are right. Solaris 11/HEAD is OK, Solaris 10/HEAD needs a fix for -dn/-P conflict. However, those flags are coming from gcc's ld invocation and I'm not yet able to override those flags by using ghc's -optl-Wl,<something>. The second choice of fix is obvious disabling of shared libs on Solaris <=10.

comment:59 Changed 9 years ago by igloo

Owner: igloo deleted
Status: patchnew

OK, please let us know when there's a patch ready to apply.

Thanks!

Changed 9 years ago by kgardas

Fix: disable shared libs on Solaris older than Solaris 11

comment:60 Changed 9 years ago by kgardas

Owner: set to igloo

I've given up on this, so attached patch fixes this issue by disabling shared libs support on Solaris older than Solaris 11. Please review and apply if you are happy. Thanks.

comment:61 Changed 9 years ago by kgardas

Status: newpatch

comment:62 Changed 9 years ago by igloo

Resolution: fixed
Status: patchclosed

Applied, thanks.

comment:63 Changed 9 years ago by maeder

Owner: igloo deleted
Resolution: fixed
Status: closednew

I still get this error with ghc-7.0.4-rc1

ld: Schwerer Fehler: Verschiebungsfehler: R_386_GOTOFF: Datei rts/dist/build/STM.dyn_o: Sy
mbol capabilities: Verschiebung muss lokal gebunden sein
gmake[1]: *** [rts/dist/build/libHSrts-ghc7.0.3.20110531.so] Fehler 1

comment:64 Changed 9 years ago by kgardas

Could you be so kind and verify that the patch 0001-disable-shared-lib-support-on-Solaris-10-and-older-f.patch is merged into 7.0.x tree? I'm afraid perhaps Ian forgotten this to do?

comment:65 Changed 9 years ago by maeder

Your above patch did not make it into ghc-7.0.4-rc1, so Ian should merge it into the 7.0.x tree, too (if this is not a major pain).

comment:66 Changed 9 years ago by igloo

Resolution: fixed
Status: newclosed

Merged.

comment:67 Changed 9 years ago by maeder

Resolution: fixed
Status: closednew

The merging went wrong. mk/config.mk.in contains

# Do we support shared libs?
SharedLibsPlatformList = \
        i386-unknown-linux x86_64-unknown-linux \
        i386-unknown-freebsd x86_64-unknown-freebsd \
        i386-unknown-openbsd x86_64-unknown-openbsd \
        i386-unknown-mingw32 \
        i386-unknown-solaris2 \
        i386-apple-darwin powerpc-apple-darwin

ifeq "$(SOLARIS_BROKEN_SHLD)" "NO"
SharedLibsPlatformList += i386-unknown-solaris2
endif

The first occurrence of i386-unknown-solaris2 (line 112) should not be there. SOLARIS_BROKEN_SHLD is correctly detected by configure on my machine.

(Please check if that's correct in the head)

comment:68 Changed 9 years ago by kgardas

HEAD (as of 1st June 2011) contains:

# Do we support shared libs? SharedLibsPlatformList = i386-unknown-linux x86_64-unknown-linux \

i386-unknown-freebsd x86_64-unknown-freebsd \ i386-unknown-openbsd x86_64-unknown-openbsd \ i386-unknown-mingw32 \ i386-apple-darwin powerpc-apple-darwin

ifeq ($(SOLARIS_BROKEN_SHLD), NO) SharedLibsPlatformList := $(SharedLibsPlatformList) i386-unknown-solaris2 endif

and also I've tested it on my Solaris 10 installation...

comment:69 Changed 9 years ago by kgardas

Sigh! Forgot code brackets...

# Do we support shared libs?
SharedLibsPlatformList = i386-unknown-linux x86_64-unknown-linux \
        i386-unknown-freebsd x86_64-unknown-freebsd \
        i386-unknown-openbsd x86_64-unknown-openbsd \
        i386-unknown-mingw32 \
        i386-apple-darwin powerpc-apple-darwin

ifeq ($(SOLARIS_BROKEN_SHLD), NO)
SharedLibsPlatformList := $(SharedLibsPlatformList) i386-unknown-solaris2
endif

comment:70 Changed 9 years ago by igloo

Resolution: fixed
Status: newclosed

Ah, sorry. Yep, looks right in the HEAD.

Note: See TracTickets for help on using tickets.