Open GoogleCodeExporter opened 8 years ago
I cannot reproduce this error (on Solaris 10, GCC 3.4.3). Which exact
distribution of Solaris are you using?
Original comment by pcnoordh...@gmail.com
on 6 Mar 2011 at 4:28
hi,
* the gcc version is 4.3.4 (not 3.4.3)
* here some more information about the solaris version:
root@comp:~# showrev
[...]
Release: 5.10
Kernel architecture: i86pc
Application architecture: i386
Hardware provider:
Domain:
Kernel version: SunOS 5.10 Generic_127128-11
root@comp-mh:~# cat /etc/release
Solaris 10 5/08 s10x_u5wos_10 X86
Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 24 March 2008
Original comment by marziz...@gmail.com
on 7 Mar 2011 at 2:37
Hello,
I experienced a similar problem when I learned the default build was 32-bit on
the Sun Solaris 10 platform.
Follows may be a fix, to include $(ARCH) in CFLAGS definition for SunOS (line
16 of src/Makefile in TRUNK):
--- redis-2.4.0-rc7/src/Makefile.orig Mon Sep 12 06:13:44 2011
+++ redis-2.4.0-rc7/src/Makefile Mon Sep 12 21:41:57 2011
@@ -25,7 +25,7 @@
endif
ifeq ($(uname_S),SunOS)
- CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -Wall -W -D__EXTENSIONS__ -D_XPG6
+ CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -Wall -W -D__EXTENSIONS__ -D_XPG6
$(ARCH)
CCLINK?=-ldl -lnsl -lsocket -lm -lpthread
DEBUG?=-g -ggdb
else
That is, if you were attempting, directly or not, a 64-bit compile.
I myself ran into your issue mid-way of achieving a 64-bit compile on SunOs. It
appears to be improper PATH, CFLAGS, LDFLAGS. The timeval data type seems
uncertain when incorrect 64-bit flag combinations are used.
My SunOS 10 environment,
$ showrev
[...]
Release: 5.10
Kernel architecture: sun4v
Application architecture: sparc
Hardware provider: Sun_Microsystems
Domain:
Kernel version: SunOS 5.10 Generic_142900-11
$ cat /etc/release
Solaris 10 10/09 s10s_u8wos_08a SPARC
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 16 September 2009
$ which gcc; gcc --version
/usr/local/bin/gcc
gcc (GCC) 4.1.2
Set my path "accordingly",
$ export PATH=/usr/local/bin:/usr/sfw/bin:/usr/bin:/usr/sbin:/usr/ccs/bin
I then execute,
$ truss -f gmake 2>tmp
the build is successful.
you should test and compare that the correct tools are launched with my 'tmp'
output, solaris has many conflicting PATH issues, your own system may require
its own accommodations.
$ awk '/execve\("/{print $2}'<tmp|sort|uniq
[...]
execve("/usr/bin/ar",
execve("/usr/bin/sh",
execve("/usr/ccs/bin/ar",
execve("/usr/ccs/bin/ld",
execve("/usr/local/bin/ar",
[...]
execve("/usr/local/bin/cc",
[...]
execve("/usr/local/libexec/gcc/sparc-sun-solaris2.10/4.1.2/cc1",
execve("/usr/local/libexec/gcc/sparc-sun-solaris2.10/4.1.2/collect2",
execve("/usr/sbin/ar",
execve("/usr/sfw/bin/ar",
execve("/usr/sfw/bin/gas",
[...]
resulting binary is 32-bit,
$ file src/redis-server
src/redis-server: ELF 32-bit MSB executable SPARC Version 1, dynamically
linked, not stripped
=
For 64-bit binary, given gcc in /usr/local/bin, it seems necessary to override
CFLAGS to include -m64 for the linking stage, otherwise:
cc -c -std=c99 -pedantic -O2 -Wall -W -D__EXTENSIONS__ -D_XPG6 -m64 -g -ggdb
ae.c
CC ae.o
cc -c -std=c99 -pedantic -O2 -Wall -W -D__EXTENSIONS__ -D_XPG6
-I../deps/hiredis -g -ggdb
CC redis-benchmark.o
cc -o redis-benchmark -std=c99 -pedantic -O2 -Wall -W -D__EXTENSIONS__ -D_XPG6
-m64 -g -ggdb ae.o anet.o redis-benchmark.o sds.o adlist.o zmalloc.o
../deps/hiredis/libhiredis.a -ldl -lnsl -lsocket -lm -lpthread
LINK redis-benchmark
ld: fatal: file ae.o: wrong ELF class: ELFCLASS32
because in src/Makefile,
158: redis-benchmark.o:
159: $(QUIET_CC)$(CC) -c $(CFLAGS) -I../deps/hiredis $(DEBUG)
$(COMPILE_TIME) $<
Only $(CFLAGS) is defined here as an argument to $(CC) for linking
redis-benchmark.o I believe $(ARCH) should also be passed here, above is a
patch to rectify that issue.
Without the patch, you may set an explicit CFLAGS,
$ export PATH=/usr/local/bin:/usr/sfw/bin:/usr/bin:/usr/sbin:/usr/ccs/bin
$ CFLAGS='-std=c99 -pedantic $(OPTIMIZATION) -Wall -W -D__EXTENSIONS__ -D_XPG6
-m64' LDFLAGS='-m64' gmake ARCH='-m64'
and it builds successfully.
With the patch, both 32-bit (default, no arguments to gmake) and 64-bit builds
(with make argument ARCH='-m64') build successfully.
$ file src/redis-server
src/redis-server: ELF 64-bit MSB executable SPARCV9 Version 1,
dynamically linked, not stripped
=
Using,
$ gmake ARCH="-m64" OPTIMIZATION="-O3"
increased redis-benchmark overall realtime by 1s, from ~6 to ~5 on
UltraSPARC-T2+ 1415 Mhz Sun Blade T6340.
Original comment by af.di...@gmail.com
on 13 Sep 2011 at 2:02
Original issue reported on code.google.com by
marziz...@gmail.com
on 25 Feb 2011 at 6:17