Bug 492 - Unbound 1.4.20 fails to compile with gcc 4.6.3 on Solaris x64 (64bit binary)
Unbound 1.4.20 fails to compile with gcc 4.6.3 on Solaris x64 (64bit binary)
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
unspecified
i386 other
: P5 normal
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-25 10:23 CET by Carsten Strotmann
Modified: 2013-03-26 11:44 CET (History)
1 user (show)

See Also:


Attachments
configure output (10.07 KB, text/x-log)
2013-03-25 10:23 CET, Carsten Strotmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Strotmann 2013-03-25 10:23:05 CET
Created attachment 221 [details]
configure output

Hi,

I might have found a regression in Unbound 1.4.20

Unbound fails to compile on Solaris i86pc with the error message

 libtool: compile:  gcc -I. -I/usr/local/include -I/usr/local/ssl/include -I/opt/csw/include -O2 -g -pipe -Wall -m64 -mtune=generic -std=c99 -D_REENTRANT -pthreads -c u
til/storage/dnstree.c  -fPIC -DPIC -o .libs/dnstree.o
libtool: compile:  gcc -I. -I/usr/local/include -I/usr/local/ssl/include -I/opt/csw/include -O2 -g -pipe -Wall -m64 -mtune=generic -std=c99 -D_REENTRANT -pthreads -c u
til/storage/dnstree.c -o dnstree.o >/dev/null 2>&1
./libtool --tag=CC --mode=compile gcc -I. -I/usr/local/include  -I/usr/local/ssl/include -I/opt/csw/include -O2 -g -pipe -Wall -m64 -mtune=generic -std=c99 -D_REENTRAN
T -pthreads -o lookup3.lo -c `cat .source`
libtool: compile:  gcc -I. -I/usr/local/include -I/usr/local/ssl/include -I/opt/csw/include -O2 -g -pipe -Wall -m64 -mtune=generic -std=c99 -D_REENTRANT -pthreads -c u
til/storage/lookup3.c  -fPIC -DPIC -o .libs/lookup3.o
util/storage/lookup3.c:79:35: error: operator '==' has no right operand
*** Error code 1
make: Fatal error: Command failed for target `lookup3.lo'


configure line was:
./configure --disable-ecdsa --disable-gost --with-libexpat=/opt/csw --with-ldns=/usr/local

GCC is 4.6.3
Comment 1 Carsten Strotmann 2013-03-25 10:31:24 CET
same issue on Solaris 10 i86pc with 32bit compile and gcc 3.4.3

Unbound 1.4.19 compiles without errors with the same settings.
Comment 2 Wouter Wijngaards 2013-03-25 10:40:06 CET
Hi Carsten,

Can you try the current svn version of lookup3.c ?

I have reverted the change in lookup3.c, and then added the new detections for endianness after the existing tests.  That should allow detection of new systems without regressions (I hope).

If this fails, we can try another version which checks for specific values (1234 and 4321) of the macros, or perhaps only for BSD.

Best regards,
   Wouter
Comment 3 Carsten Strotmann 2013-03-25 11:50:40 CET
I've tested the new trunk version, but same error message, just the location is different:

util/storage/lookup3.c:93:35: error: operator '==' has no right operand
make: Fatal error: Command failed for target `lookup3.lo'
Comment 4 Wouter Wijngaards 2013-03-25 11:59:05 CET
Hi Carsten,

A new fix, that tests on __sparc and __sparc__ as well.  In svn trunk if you want to try that one.

If that does not work, I can adjust the _LITTLE_ENDIAN tests with a test for _MACHINE_ENDIAN_H_ (which basically tests for the bsd include file).

Best regards, Wouter
Comment 5 Carsten Strotmann 2013-03-25 15:08:17 CET
Hi Wouter,

I've tried the latest svn trunk. Still the same error:
util/storage/lookup3.c:93:35: error: operator '==' has no right operand


Please note: I'm compiling on Solaris 10 Intel (not SPARC, SPARC will be done once the Intel binaries are working).

-- Carsten
Comment 6 Wouter Wijngaards 2013-03-25 15:54:15 CET
Hi Carsten,

Okay, I have updated it again, so that it'll go into the 'undetected' category.

I do not know how to endian-detect the intel-solaris, but the generic code works fine I guess.

Best regards,
   Wouter
Comment 7 Wouter Wijngaards 2013-03-25 16:01:37 CET
Hi Carsten,

Just updated again, found out it uses __x86 for intel solaris.  (The sparc solaris header files contain clues that this is the case for intel solaris).

Added this to the previous solution, which should speed up and not fail.

Best regards,
   Wouter
Comment 8 Carsten Strotmann 2013-03-25 19:05:23 CET
Hi Wouter,

I've tried the latest trunk version, it now compiles on 32bit Intel Solaris 10.

I will try 64bit also, but I expect it to work there as well.

Thanks for the quick response.

-- Carsten
Comment 9 Carsten Strotmann 2013-03-25 19:31:16 CET
strange enough, I was able to compile a 32bit Unbound using gcc 3.4.3, but not a 64bit binary using gcc 4.6.3:

bash-3.00# make
./libtool --tag=CC --mode=compile gcc -I. -I/usr/local/include  -I/usr/local/ssl/include -I/opt/csw/include -O2 -g -pipe -Wall -m64 -mtune=generic -std=c99 -D_REENTRANT -pthreads -o lookup3.lo -c `cat .source`
libtool: compile:  gcc -I. -I/usr/local/include -I/usr/local/ssl/include -I/opt/csw/include -O2 -g -pipe -Wall -m64 -mtune=generic -std=c99 -D_REENTRANT -pthreads -c util/storage/lookup3.c  -fPIC -DPIC -o .libs/lookup3.o
util/storage/lookup3.c:93:58: error: operator '==' has no right operand
*** Error code 1
make: Fatal error: Command failed for target `lookup3.lo'


-- Carsten

p.s.:

is it correct that the "else" clause sets both values to "0"?

# define HASH_LITTLE_ENDIAN 1
# define HASH_BIG_ENDIAN 0
#else
# define HASH_LITTLE_ENDIAN 0
# define HASH_BIG_ENDIAN 0
Comment 10 Carsten Strotmann 2013-03-25 19:36:50 CET
Maybe this is useful:

http://docs.oracle.com/cd/E19253-01/816-5138/dev-env-2/index.html

the defines might be different when compiling with GCC and -m64
Comment 11 Wouter Wijngaards 2013-03-26 09:15:45 CET
Hi Carsten,

Thanks for the testing, it seems to work for me on platforms.

I have fixed (yet again), with the #include that was on the documentation that you found for me.  The defines should also work.

The 0 defines in the final else are OK.

I also moved the nasty == statement wrapped inside an #if to protect it even more.  So that it falls to the 0 defines if detection fails, instead of failing on that ==.

The update is in svn trunk.

Best regards,
   Wouter
Comment 12 Carsten Strotmann 2013-03-26 11:08:14 CET
Hello Wouter,

success! with the latest trunk version, it now compiles also as a 64bit binary.

Thank you for fixing this issue.

Have a good Easter holiday!

Carsten
Comment 13 Wouter Wijngaards 2013-03-26 11:44:59 CET
Hi Carsten,

Thanks for these tests, I'll put that code through to NSD4 as well.

Best regards,
   Wouter