Compilation of Nginx on Solris 10 as 64bit

Hi All
I have a problem with compilation of nginx 0.7.62 on solaris 10
I use the sun studio 12 for compilation
I constantly have the following error ( with or without pcre support)

ld: fatal: file objs/src/core/nginx.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to objs/nginx
make[1]: *** Error 1

my environment:
bash-3.00# env
LDFLAGS= -L/lib/64 -L/usr/sfw/lib/64 -R/usr/sfw/lib/64 -R/lib/64
HZ=
TERM=xterm
SHELL=/usr/local/bin/bash
OLDPWD=/export/home/arin
LD_LIBRARY_PATH=/opt/sunstudio12.1/lib:/opt/mysql/mysql/lib:/usr/ccs/lib:/usr/lib:/usr/local/lib:/lib:
PATH=/opt/sunstudio12.1/bin:/opt/mysql/mysql/bin:/usr/sbin:/usr/bin:/usr/local/bin:.:/usr/ccs/bin:
MAIL=/var/mail/root
PWD=/export/home/arin/nginx-0.7.62
TZ=Europe/Berlin
SHLVL=1
HOME=/
CFLAGS=-m64 -I/usr/local/include -I /usr/local/include/ncurses
LOGNAME=root
CC=/opt/sunstudio12.1/bin/cc
_=/usr/bin/env

Dose nginx supports 64bit on solaris ?

Posted at Nginx Forum:

On Wed, Oct 7, 2009 at 2:40 AM, arin [email protected] wrote:

bash-3.00# env
SHLVL=1

what’s the configure line? last time I tried it needs
‘–with-cpu-opt=amd64’.

I tried that either, won’t work

also I have tried to compile in 32bit mode (different env !!!)

Undefined first referenced
symbol in file
ngx_atomic_fetch_add objs/src/core/ngx_resolver.o
ngx_atomic_cmp_set objs/src/core/nginx.o
ngx_cpu_pause objs/src/core/ngx_spinlock.o
ld: fatal: Symbol referencing errors. No output written to objs/nginx
make[1]: *** Error 1
make[1]: Leaving directory `/export/home/arin/nginx-0.7.62’
make: *** Error 2
seems that we have problem with solaris and the current version of
nginx
WHAT VERSION OF NGINX is can be built with Solaris 10 (latest release )
and SunStudio 12.1 ?
I will be happy to be the nginx QA (at least for the basic sanity of
compilation and basic functionality test and some performance tests).
for Solaris 10
however I will need some help from the community as I’m new to nginx
(not to solaris :slight_smile:

Arin

my 32 bit env is :
bash-3.00# env
LDFLAGS= -L/lib -L/usr/sfw/lib/ -L/usr/lib -R/usr/sfw/lib/ -R/lib/
HZ=
TERM=xterm
SHELL=/usr/local/bin/bash
OLDPWD=/export/home/arin/nginx-0.7.62/objs
LD_LIBRARY_PATH=/opt/sunstudio12.1/lib:/usr/ccs/lib:/usr/lib:/usr/local/lib:/lib:/opt/mysql/mysql/lib
PATH=/opt/sunstudio12.1/bin:/opt/mysql/mysql/bin:/usr/sbin:/usr/bin:/usr/local/bin:.:/usr/ccs/bin:
MAIL=/var/mail/root
PWD=/export/home/arin/nginx-0.7.62
TZ=Europe/Berlin
SHLVL=1
HOME=/
CFLAGS= -I/usr/local/include -I /usr/local/include/ncurses
-I/usr/sfw/include
LOGNAME=root
CC=/opt/sunstudio12.1/bin/cc
_=/usr/bin/env

Posted at Nginx Forum:

2009/10/7 arin [email protected]:

make[1]: *** Â Error 1
make[1]: Leaving directory `/export/home/arin/nginx-0.7.62’
make: *** Â Error 2
 seems that we have problem with solaris and the current version of nginx
WHAT VERSION OF NGINX is can be built with Solaris 10 (latest release ) and SunStudio 12.1 ?
I will be happy to be the nginx QA Â (at least for the basic sanity of compilation and basic functionality test and some performance tests).
for Solaris 10
however I will need some help from the community as I’m new to nginx (not to solaris :slight_smile:

Try my libatomic patches from this list. The referenced symbols should
be found, even without GCC as libatomic compiles fine with SunC.

I haven’t tried SunStudio 12.1, but I do know that nginx compiles
under Solaris 10 using GCC for SPARC, which uses the same code
generator as SunStudio.

-Dustin

On Thu, Oct 08, 2009 at 04:45:54PM +0200, W-Mark K. wrote:

ld: fatal: Symbol referencing errors. No output written to objs/nginx
be found, even without GCC as libatomic compiles fine with SunC.
It would not help: nginx has SunC atomic operations set, however, for
some reason the source file was not included.

I have also had this problem on Solaris 10 and SunCC.

The problem is that nginx’s configure creates a broken objbs/Makefile
when your own CFLAGS defined in your environment.

If you look at objs/Makefile after you’ve run configure without CFLAGS
set, you will see in there
CFLAGS = -fast -xipo -errwarn=%all -g. Until the configure is fixed, I
guess you could just edit that CFLAGS to what you want in the Makefile
after running configure and before running your gmake.

Igor - The problem that the environment CFLAGS causes to the
objs/MakeFile is illustrated in the following diff (Makefile generated
with environment CFLAGS set is on the left, Makefile generated without
environment CFLAGS is on the right)…

diff CFLAGSsetMakefile CFLAGSnotsetMakefile
3c3
< CFLAGS = -m32

CFLAGS = -fast -xipo -errwarn=%all -g
293c293,294
< -lsocket -lnsl -lsendfile -lmd -lz


  -lsocket -lnsl -lsendfile -lmd -lz \
  -fast -xipo

301c302
< objs/ngx_modules.c

          objs/ngx_modules.c src/os/unix/ngx_sunpro_x86.il

308c309
< src/core/nginx.c

          src/core/nginx.c src/os/unix/ngx_sunpro_x86.il

315c316
< src/core/ngx_log.c

          src/core/ngx_log.c src/os/unix/ngx_sunpro_x86.il

322c323
< src/core/ngx_palloc.c

          src/core/ngx_palloc.c src/os/unix/ngx_sunpro_x86.il

329c330
< src/core/ngx_array.c

          src/core/ngx_array.c src/os/unix/ngx_sunpro_x86.il

336c337
< src/core/ngx_list.c

etc… You see the problem :slight_smile:

Posted at Nginx Forum:

that CFLAGS to what you want in the Makefile after
running configure and before running your gmake.

is this visible only when you build nginx as 64bit ?
This affects only setups where you try to pass your own CFLAGS, right ?

thanks,
Stefan

Stefan P. Wrote:

is this visible only when you build nginx as 64bit
?
This affects only setups where you try to pass
your own CFLAGS, right ?

Yes this only happens when CFLAGS is set in the environment of the
configure script. I’m actually building it via pkgsrc, which does set
CFLAGS in the environment.

Posted at Nginx Forum:

wega3k Wrote:

CFLAGS = -fast -xipo -errwarn=%all -g. Until the
configure is fixed, I guess you could just edit
that CFLAGS to what you want in the Makefile after
running configure and before running your gmake.

I’ve just run across this myself. The reason for the problem is that the
auto/cc/conf script skips the logic in auto/cc/sunc if CFLAGS is set.
This means if you set CFLAGS from the environment you should also set
everything else that is set in auto/cc/sunc from the environment. In
this case the NGX_AUX variable needs to be set to "
src/os/unix/ngx_sunpro_x86.il" (or another ngx_sunpro_*.il file,
depending on architecture).

Posted at Nginx Forum: