# Compilation of Nginx on Solris 10 as 64bit

**URL:** <https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836>\
**Category:** NGINX\
**Created:** [October 6, 2009, 9:47pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836 "2009-10-06T21:47:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [October 6, 2009, 9:47pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/1 "2009-10-06T21:47:00Z")

</div>

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:

> **[Compilation of Nginx on Solris 10 as 64bit](https://forum.nginx.org/read.php?2,11617,11617#msg-11617)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [October 7, 2009, 4:33am UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/2 "2009-10-07T04:33:52Z")

</div>

On Wed, Oct 7, 2009 at 2:40 AM, arin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> bash-3.00# env  
> SHLVL=1

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

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [October 7, 2009, 9:43pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/3 "2009-10-07T21:43:06Z")

</div>

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 🙂

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:

> **[Re: Compilation of Nginx on Solris 10 as 64bit](https://forum.nginx.org/read.php?2,11617,11924#msg-11924)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [October 8, 2009, 4:54pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/4 "2009-10-08T16:54:34Z")

</div>

2009/10/7 arin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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 🙂

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

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [October 8, 2009, 12:01am UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/5 "2009-10-08T00:01:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [October 8, 2009, 5:44pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/6 "2009-10-08T17:44:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [October 15, 2009, 12:52pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/7 "2009-10-15T12:52:51Z")

</div>

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 🙂

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,11617,13902#msg-13902](http://forum.nginx.org/read.php?2,11617,13902#msg-13902)

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [March 20, 2010, 1:42pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/8 "2010-03-20T13:42:02Z")

</div>

> > 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

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [March 20, 2010, 1:52pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/9 "2010-03-20T13:52:36Z")

</div>

## 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:  
[http://forum.nginx.org/read.php?2,11617,65898#msg-65898](http://forum.nginx.org/read.php?2,11617,65898#msg-65898)

---

<div class="post-metadata">

**Author:** ![arin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@arin](https://www.ruby-forum.com/u/arin)\
**Post date:** [March 20, 2010, 12:49pm UTC](https://www.ruby-forum.com/t/compilation-of-nginx-on-solris-10-as-64bit/176836/10 "2010-03-20T12:49:56Z")

</div>

## 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:  
[http://forum.nginx.org/read.php?2,11617,65883#msg-65883](http://forum.nginx.org/read.php?2,11617,65883#msg-65883)
