Bug #33126 64-bit build fails on Solaris x86
Submitted: 10 Dec 2007 21:37 Modified: 18 Dec 2007 4:01
Reporter: River Tarnell Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.0.51 OS:Solaris (Solaris 10 11/06)
Assigned to: Kent Boortz CPU Architecture:Any

[10 Dec 2007 21:37] River Tarnell
Description:
Compiling a 64-bit server on Solaris gives an error while building instance-manager.

$ LDFLAGS=-m64
$ CFLAGS='-O2 -m64'
$ CPPFLAGS='-O2 -m64'
$ export LDFLAGS CFLAGS CPPFLAGS
$ ./configure --prefix=/usr/local/mysql-5.0.51-custom
$ gmake
[...]
Making all in instance-manager
gmake[3]: Entering directory `/home/river/mysql-5.0.51/server-tools/instance-manager'
/bin/bash ../../libtool --preserve-dup-deps --tag=CXX --mode=link g++  -DDBUG_OFF -O2 -m64   -fno-implicit-templates -fno-exceptions -fno-rtti -DHAVE_RWLOCK_T  -m64  -o mysqlmanager  command.o mysqlmanager.o manager.o log.o thread_registry.o listener.o protocol.o mysql_connection.o user_map.o messages.o commands.o instance.o instance_map.o instance_options.o buffer.o parse.o guardian.o parse_output.o liboptions.la libnet.a ../../vio/libvio.a ../../mysys/libmysys.a ../../strings/libmystrings.a ../../dbug/libdbug.a ../../zlib/libzlt.la -lpthread -lthread -lposix4 -lresolv -lgen -lsocket -lnsl -lm  -lpthread -lthread 
g++ -DDBUG_OFF -O2 -m64 -fno-implicit-templates -fno-exceptions -fno-rtti -DHAVE_RWLOCK_T -m64 -o mysqlmanager command.o mysqlmanager.o manager.o log.o thread_registry.o listener.o protocol.o mysql_connection.o user_map.o messages.o commands.o instance.o instance_map.o instance_options.o buffer.o parse.o guardian.o parse_output.o  ./.libs/liboptions.a -lpthread -lthread -lpthread -lthread -lpthread -lthread -lpthread -lthread /usr/sfw/lib/libstdc++.so -L/usr/sfw/lib -lgcc_s libnet.a ../../vio/libvio.a ../../mysys/libmysys.a ../../strings/libmystrings.a ../../dbug/libdbug.a ../../zlib/.libs/libzlt.a -lpthread -lthread -lposix4 -lresolv -lgen -lsocket -lnsl -lm -lpthread -lthread -Wl,-R -Wl,/usr/sfw/lib -Wl,-R -Wl,/usr/sfw/lib
ld: fatal: file /usr/sfw/lib/libstdc++.so: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to mysqlmanager
collect2: ld returned 1 exit status
gmake[3]: *** [mysqlmanager] Error 1
gmake[3]: Leaving directory `/home/river/mysql-5.0.51/server-tools/instance-manager'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/home/river/mysql-5.0.51/server-tools'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/river/mysql-5.0.51'
gmake: *** [all] Error 2

How to repeat:
Compile server as in description.

Suggested fix:
Unknown.
[11 Dec 2007 8:43] Sveta Smirnova
Thank you for the report.

Verified as described.
[11 Dec 2007 13:46] River Tarnell
In the original description, i wrote "CPPFLAGS=".  I meant to write "CXXFLAGS=", as that's what I actually used when building the server (I did not set CPPFLAGS).
[14 Dec 2007 18:43] Daniel Fischer
Reproducing a comment from bug#31268 that deals with building 64 bit binaries on Solaris x86:

 [4 Dec 15:15] Kent Boortz

The problem with "-m64" not passed to "gcc -print-search-paths"
seem to be fixed in libtool 1.5.24, at least the code doing
this check now handles "multilibs".

I think no documentation change is needed for this, unless
some hints should be added to the Solaris specific page.
The hint would be something like

  Building a 64-bit binary on Solaris AMD64 with gcc might fail.
  Not going into why (see bug#31268), you can work around this by
  forcing the build to be 64-bit

  o Give "--build=x86_64-pc-solaris2.10" as a configure argument

  o Give "-m64" part of CFLAGS, CXXFLAGS and LDFLAGS

  o Configure and run make like

    % LIBRARY_PATH=/usr/local/lib/amd64 ./configure .....
    % LIBRARY_PATH=/usr/local/lib/amd64 gmake
[18 Dec 2007 4:01] Paul DuBois
Added this bug number to the changelog entry for Bug#31268.