On 09/08/2016 12:11 PM, Sascha Frick wrote:
Dear gcc community,
I am trying to compile some code on a Solaris 11 server
Let me see what I can do here.
Firstly you should not be using the GNU as but the as provided by the
vendor on that system. Also, check that you do not have LD_OPTIONS
environment variable set.
If you want a decent gcc that will absolutely work I can give you a
link. In any case, a 32-bit compile on sparcv9 is no problem if you are
using the Oracle/Sun assembler and linker :
mimas $ /usr/local/gcc4/bin/gcc -v -m32 -c -o hello_32bit.o hello.c
Using built-in specs.
COLLECT_GCC=/usr/local/gcc4/bin/gcc
Target: sparc64-sun-solaris2.10
Configured with: ../gcc-4.9.2/configure --build=sparc64-sun-solaris2.10
--prefix=/usr/local/gcc4 --libdir=/usr/local/gcc4/lib
--libexecdir=/usr/local/gcc4/lib --without-gnu-as --without-gnu-ld
--with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/sparcv9/ld
--disable-nls --enable-threads=posix --enable-shared --with-cpu=v9
--enable-bootstrap --enable-languages=ada,c,c++,fortran,go,objc,obj-c++
--enable-stage1-languages=c,c++ --with-pkgversion='genunix Fri Jan 2
11:56:03 GMT 2015'
Thread model: posix
gcc version 4.9.2 (genunix Fri Jan 2 11:56:03 GMT 2015)
COLLECT_GCC_OPTIONS='-v' '-m32' '-c' '-o' 'hello_32bit.o'
/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/cc1 -quiet -v
-imultilib sparcv8plus hello.c -mptr32 -mno-stack-bias -mcpu=v9 -quiet
-dumpbase hello.c -m32 -auxbase-strip hello_32bit.o -version -o
/var/tmp//ccsdgayZ.s
GNU C (genunix Fri Jan 2 11:56:03 GMT 2015) version 4.9.2
(sparc64-sun-solaris2.10)
compiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR
version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/../../../../sparc64-sun-solaris2.10/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/include
/usr/local/include
/usr/local/gcc4/include
/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/include-fixed
/usr/include
End of search list.
GNU C (genunix Fri Jan 2 11:56:03 GMT 2015) version 4.9.2
(sparc64-sun-solaris2.10)
compiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR
version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 85271184078851183a7506c25f69ae43
COLLECT_GCC_OPTIONS='-v' '-m32' '-c' '-o' 'hello_32bit.o'
/usr/ccs/bin/as -V -Qy -s -xarch=v8plus -m32 -o hello_32bit.o
/var/tmp//ccsdgayZ.s
/usr/ccs/bin/as: Sun Compiler Common 12.4 SunOS_sparc Patch 151848-07
Patch 01/30/2016
COMPILER_PATH=/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/:/usr/ccs/bin/
LIBRARY_PATH=/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/sparcv8plus/:/usr/ccs/lib/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/../../../:/lib/:/usr/lib/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/
COLLECT_GCC_OPTIONS='-v' '-m32' '-c' '-o' 'hello_32bit.o'
mimas $
mimas $
mimas $
mimas $ /usr/local/gcc4/bin/gcc -v -m32 -o hello_32bit hello_32bit.o
Using built-in specs.
COLLECT_GCC=/usr/local/gcc4/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/lto-wrapper
Target: sparc64-sun-solaris2.10
Configured with: ../gcc-4.9.2/configure --build=sparc64-sun-solaris2.10
--prefix=/usr/local/gcc4 --libdir=/usr/local/gcc4/lib
--libexecdir=/usr/local/gcc4/lib --without-gnu-as --without-gnu-ld
--with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/sparcv9/ld
--disable-nls --enable-threads=posix --enable-shared --with-cpu=v9
--enable-bootstrap --enable-languages=ada,c,c++,fortran,go,objc,obj-c++
--enable-stage1-languages=c,c++ --with-pkgversion='genunix Fri Jan 2
11:56:03 GMT 2015'
Thread model: posix
gcc version 4.9.2 (genunix Fri Jan 2 11:56:03 GMT 2015)
COMPILER_PATH=/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/:/usr/ccs/bin/
LIBRARY_PATH=/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/sparcv8plus/:/usr/ccs/lib/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/../../../:/lib/:/usr/lib/:/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/
COLLECT_GCC_OPTIONS='-v' '-m32' '-o' 'hello_32bit'
/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/collect2 -V -Y
P,/usr/ccs/lib:/lib:/usr/lib -Qy -o hello_32bit
/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/sparcv8plus/crt1.o
/usr/lib/crti.o /usr/ccs/lib/values-Xa.o
/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/sparcv8plus/crtbegin.o
-L/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/sparcv8plus
-L/usr/ccs/lib
-L/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/../../..
-L/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2 hello_32bit.o
-lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc
/usr/local/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.9.2/sparcv8plus/crtend.o
/usr/lib/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1520
mimas $
mimas $ file hello_32bit
hello_32bit: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+
Required, dynamically linked, not stripped, no debugging information
available
mimas $
mimas $ mcs -p hello_32bit | sort -u | tail
@(#)SunOS 5.10 Generic January 2005
GCC: (genunix Fri Jan 2 11:56:03 GMT 2015) 4.9.2
as: Sun Compiler Common 12.4 SunOS_sparc Patch 151848-07 Patch 01/30/2016
as: SunOS 5.10 118683-13 Patch 08/06/2014
hello_32bit:
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1520
mimas $
let me kow ifyou need a compiler and tools set.
Dennis