# 0.9.1 compilation failure on Nexenta 3.0.1

**URL:** <https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110>\
**Category:** NGINX\
**Created:** [December 5, 2010, 10:46am UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110 "2010-12-05T10:46:49Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 5, 2010, 10:46am UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/1 "2010-12-05T10:46:49Z")

</div>

When playing around with Nexenta 3.0.1 and trying to compile latest  
nginx, I got this error:

make[1]: Entering directory `/export/home/edho/tmp/nginx-0.9.1' gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g -I/app/pcre/include -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \ -o objs/src/os/unix/ngx_errno.o \ src/os/unix/ngx_errno.c src/os/unix/ngx_errno.c: In function ‘ngx_strerror’: src/os/unix/ngx_errno.c:36: error: ‘NGX_SYS_NERR’ undeclared (first use in this function) src/os/unix/ngx_errno.c:36: error: (Each undeclared identifier is reported only once src/os/unix/ngx_errno.c:36: error: for each function it appears in.) src/os/unix/ngx_errno.c: In function ‘ngx_strerror_init’: src/os/unix/ngx_errno.c:57: error: ‘NGX_SYS_NERR’ undeclared (first use in this function) make[1]: *** [objs/src/os/unix/ngx_errno.o] Error 1 make[1]: Leaving directory `/export/home/edho/tmp/nginx-0.9.1’  
make: \*\*\* [build] Error 2

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 5, 2010, 1:59pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/2 "2010-12-05T13:59:59Z")

</div>

[http://nginx.org/pipermail/nginx/2010-December/023926.html](http://nginx.org/pipermail/nginx/2010-December/023926.html)

Best regards,  
Piotr S. \< removed\_email\_address@domain.invalid \>

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 5, 2010, 3:43pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/3 "2010-12-05T15:43:21Z")

</div>

On Sun, Dec 5, 2010 at 7:58 PM, Piotr S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> [error building 0.9.1 on Cygwin](http://nginx.org/pipermail/nginx/2010-December/023926.html)
> 
> Best regards,  
> Piotr S. \< [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) \>

tried and still fail - in fact the error message I copied is the  
result of patched source. Same error unpatched.

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 3:09pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/4 "2010-12-06T15:09:18Z")

</div>

2010/12/6 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > result of patched source. Same error unpatched.  
> > {  
> > printf(“%d\n”, sys\_nerr);  
> > return 0;  
> > }
> 
> * * *

looks like there’s no sys\_nerr in Nexenta.

edho@nexenta:~$ cat \< test.c

> EOF  
> edho@nexenta:~$ make test  
> cc test.c -o test  
> test.c: In function ‘main’:  
> test.c:8: error: ‘sys\_nerr’ undeclared (first use in this function)  
> test.c:8: error: (Each undeclared identifier is reported only once  
> test.c:8: error: for each function it appears in.)  
> make: \*\*\* [test] Error 1  
> edho@nexenta:~$ uname -a  
> SunOS nexenta 5.11 NexentaOS\_134f i86pc i386 i86pc Solaris

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 3:11pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/5 "2010-12-06T15:11:49Z")

</div>

On Mon, Dec 06, 2010 at 09:07:31PM +0700, Edho P Arief wrote:

> > > tried and still fail - in fact the error message I copied is the  
> > > main()  
> > > edho@nexenta:~$ cat \< test.c  
> > > EOF  
> > > edho@nexenta:~$ make test  
> > > cc test.c -o test  
> > > test.c: In function ‘main’:  
> > > test.c:8: error: ‘sys\_nerr’ undeclared (first use in this function)  
> > > test.c:8: error: (Each undeclared identifier is reported only once  
> > > test.c:8: error: for each function it appears in.)  
> > > make: \*\*\* [test] Error 1  
> > > edho@nexenta:~$ uname -a  
> > > SunOS nexenta 5.11 NexentaOS\_134f i86pc i386 i86pc Solaris

As I understand it uses glibc which has sys\_nerr.  
What does  
grep -r sys\_nerr /usr/include  
show ?

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 2:15pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/6 "2010-12-06T14:15:57Z")

</div>

On Sun, Dec 05, 2010 at 09:41:31PM +0700, Edho P Arief wrote:

> On Sun, Dec 5, 2010 at 7:58 PM, Piotr S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > [error building 0.9.1 on Cygwin](http://nginx.org/pipermail/nginx/2010-December/023926.html)
> > 
> > Best regards,  
> > Piotr S. \< [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) \>
> 
> tried and still fail - in fact the error message I copied is the  
> result of patched source. Same error unpatched.

Could you try to build this program:

* * *

#include \<errno.h\>  
#include \<string.h\>  
#include \<stdio.h\>

int  
main()  
{  
printf(“%d\n”, sys\_nerr);  
return 0;  
}

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 3:33pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/7 "2010-12-06T15:33:48Z")

</div>

On Mon, Dec 6, 2010 at 9:10 PM, Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> As I understand it uses glibc which has sys\_nerr.  
> What does  
> grep -r sys\_nerr /usr/include  
> show ?

I tried that yesterday, too. Also I believe it uses Solaris’ libc.

Wikipedia:

> Nexenta OS is the first distribution that combines the OpenSolaris C library and  
> GNU userland with the OpenSolaris kernel.

Here’s the result:

edho@nexenta:~$ grep -r sys\_nerr /usr/include  
/usr/include/errno.h: \* The symbols \_sys\_errlist and \_sys\_nerr are not  
visible in the  
/usr/include/iso/errno\_iso.h: \* The symbols \_sys\_errlist and \_sys\_nerr  
are not visible in the  
edho@nexenta:~$

## edho@nexenta:~$ grep -C 3 -r sys\_nerr /usr/include /usr/include/errno.h- /usr/include/errno.h-#if defined(\_LP64) /usr/include/errno.h-/\* /usr/include/errno.h: \* The symbols \_sys\_errlist and \_sys\_nerr are not visible in the /usr/include/errno.h- \* LP64 libc. Use strerror(3C) instead. /usr/include/errno.h- _/ /usr/include/errno.h-#endif /_ \_LP64 \*/

/usr/include/iso/errno\_iso.h-  
/usr/include/iso/errno\_iso.h-#if defined(\_LP64)  
/usr/include/iso/errno\_iso.h-/\*  
/usr/include/iso/errno\_iso.h: \* The symbols \_sys\_errlist and \_sys\_nerr  
are not visible in the  
/usr/include/iso/errno\_iso.h- \* LP64 libc. Use strerror(3C) instead.  
/usr/include/iso/errno\_iso.h- _/  
/usr/include/iso/errno\_iso.h-#endif /_ \_LP64 \*/

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 3:36pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/8 "2010-12-06T15:36:57Z")

</div>

On Mon, Dec 06, 2010 at 09:32:07PM +0700, Edho P Arief wrote:

> > Nexenta OS is the first distribution that combines the OpenSolaris C library  
> > and GNU userland with the OpenSolaris kernel.
> 
> /usr/include/iso/errno\_iso.h-  
> /usr/include/iso/errno\_iso.h-#if defined(\_LP64)  
> /usr/include/iso/errno\_iso.h-/\*  
> /usr/include/iso/errno\_iso.h: \* The symbols \_sys\_errlist and \_sys\_nerr  
> are not visible in the  
> /usr/include/iso/errno\_iso.h- \* LP64 libc. Use strerror(3C) instead.  
> /usr/include/iso/errno\_iso.h- _/  
> /usr/include/iso/errno\_iso.h-#endif /_ \_LP64 \*/

Yes, I’ve just checked OpenSolaris, it has no sys\_nerr.  
I will detect maximum errno using EINVAL error from strerror().

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 4:31pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/9 "2010-12-06T16:31:01Z")

</div>

On Mon, Dec 06, 2010 at 06:00:57PM +0300, Maxim D. wrote:

> p.s. If for some reason you’ll still prefer to continue attempts  
> to build async-signal-safe strerror() - please note that POSIX  
> doesn’t require strerror() to return EINVAL for invalid codes, it  
> only says “may”.

I believe it will be the last iteration.  
Actually the current ngx\_strerror\_r() in 0.8.x is a set of hacks  
and workarounds, collected during nginx development.  
For example, Linux GNU strerror\_r() is very different than POSIX one.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 4:02pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/10 "2010-12-06T16:02:05Z")

</div>

Hello!

On Mon, Dec 06, 2010 at 05:36:13PM +0300, Igor S. wrote:

> > are not visible in the  
> > /usr/include/errno.h-#endif /\* \_LP64 \*/  
> > Yes, I’ve just checked OpenSolaris, it has no sys\_nerr.  
> > I will detect maximum errno using EINVAL error from strerror().

What about just not using strerror() while in signal handler (and  
using normal one in other cases)? I believe we’ve already seen  
too many problems while trying to build async-signal-safe version  
of strerror().

Maxim D.

p.s. If for some reason you’ll still prefer to continue attempts  
to build async-signal-safe strerror() - please note that POSIX  
doesn’t require strerror() to return EINVAL for invalid codes, it  
only says “may”.

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 4:34pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/11 "2010-12-06T16:34:47Z")

</div>

On Mon, Dec 06, 2010 at 09:32:07PM +0700, Edho P Arief wrote:

> > Nexenta OS is the first distribution that combines the OpenSolaris C library  
> > and GNU userland with the OpenSolaris kernel.  
> > Could you test the attached patch ?

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 5:31pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/12 "2010-12-06T17:31:56Z")

</div>

Hello!

On Mon, Dec 06, 2010 at 06:30:08PM +0300, Igor S. wrote:

> > Maxim D.
> > 
> > p.s. If for some reason you’ll still prefer to continue attempts  
> > to build async-signal-safe strerror() - please note that POSIX  
> > doesn’t require strerror() to return EINVAL for invalid codes, it  
> > only says “may”.
> 
> I believe it will be the last iteration.

I wish it will… Unfortunately, I’m almost sure it won’t. POSIX  
doesn’t specify anything about error codes, and it’s not really  
safe to assume they are somehow ordered.

> Actually the current ngx\_strerror\_r() in 0.8.x is a set of hacks  
> and workarounds, collected during nginx development.  
> For example, Linux GNU strerror\_r() is very different than POSIX one.

Yes, I understand. My general idea is to use POSIX interface if  
available, and use hacks/workarounds only if they are known to be  
needed. This way it will be as portable as possible.

The only real problem with POSIX strerror\_r() is that it isn’t  
async-signal-safe. And I think it’s fair enough to don’t print  
error message if an error happens in a signal handler.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 6:17pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/13 "2010-12-06T18:17:45Z")

</div>

2010/12/6 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Could you test the attached patch ?

it works.

edho@nexenta:~/tmp/nginx-0.9.2$ file /app/nginx/sbin/nginx  
/app/nginx/sbin/nginx: ELF 32-bit LSB executable, Intel 80386, version  
1 (SYSV), dynamically linked (uses shared libs), not stripped  
edho@nexenta:~/tmp/nginx-0.9.2$ LD\_LIBRARY\_PATH=/app/pcre/lib  
/app/nginx/sbin/nginx -V  
nginx: nginx version: nginx/0.9.2  
nginx: built by gcc 4.2.3 (Ubuntu 4.2.3-2nexenta7)  
nginx: TLS SNI support enabled  
nginx: configure arguments: --prefix=/app/nginx  
–with-cc-opt=-I/app/pcre/include --with-ld-opt=-L/app/pcre/lib  
–with-ipv6 --with-http\_ssl\_module

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 6:22pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/14 "2010-12-06T18:22:08Z")

</div>

On Tue, Dec 07, 2010 at 12:15:57AM +0700, Edho P Arief wrote:

> edho@nexenta:~/tmp/nginx-0.9.2$ LD\_LIBRARY\_PATH=/app/pcre/lib  
> /app/nginx/sbin/nginx -V  
> nginx: nginx version: nginx/0.9.2  
> nginx: built by gcc 4.2.3 (Ubuntu 4.2.3-2nexenta7)  
> nginx: TLS SNI support enabled  
> nginx: configure arguments: --prefix=/app/nginx  
> –with-cc-opt=-I/app/pcre/include --with-ld-opt=-L/app/pcre/lib  
> –with-ipv6 --with-http\_ssl\_module

BTW, you can build “–with-ld-opt=-R/app/pcre/lib -L/app/pcre/lib”  
and omit LD\_LIBRARY\_PATH=/app/pcre/lib.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 6:20pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/15 "2010-12-06T18:20:15Z")

</div>

The patch works for me. I was running into same problem when I was doing  
“make” with nginx-0.9.2 on SunOS 5.10. “‘NGX\_SYS\_NERR’ undeclared”  
occurred. But after patching auto/unix, make command finally works.  
Thank you.

Posted at Nginx Forum:

> **[Re: 0.9.1 compilation failure on Nexenta 3.0.1](https://forum.nginx.org/read.php?2,155668,156105#msg-156105)**
>
> When playing around with Nexenta 3.0.1 and trying to compile latest nginx, I got this error: make\[1\]: Entering directory \`/export/home/edho/tmp/nginx-0.9.1' gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function...

---

<div class="post-metadata">

**Author:** ![Edho\_P\_Arief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@Edho\_P\_Arief](https://www.ruby-forum.com/u/Edho_P_Arief)\
**Post date:** [December 6, 2010, 6:56pm UTC](https://www.ruby-forum.com/t/0-9-1-compilation-failure-on-nexenta-3-0-1/200110/16 "2010-12-06T18:56:04Z")

</div>

On Tue, Dec 7, 2010 at 12:21 AM, Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> BTW, you can build “–with-ld-opt=-R/app/pcre/lib -L/app/pcre/lib”  
> and omit LD\_LIBRARY\_PATH=/app/pcre/lib.

ah right. Thanks!

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)
