Bug #48006 make: wrong ELF class: ELFCLASS32
Submitted: 12 Oct 2009 17:34 Modified: 16 Nov 2009 9:27
Reporter: P C Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S2 (Serious)
Version:1.0.5 OS:Solaris (x86_64)
Assigned to: CPU Architecture:Any
Tags: "wrong ELF CLASS", Connector/C++

[12 Oct 2009 17:34] P C
Description:

When running the "make" command for 1.0.5 C++ connector it fails with "ccpptests.o: wrong ELF class: ELFCLASS32". 

Best Regards,
Patrick

Installation Details:
===================================
Solaris 10 x86_64 (Fresh Install)
mysql-5.1.39-solaris10-x86_64.pkg

Screen Dumps:
===================================
bash-3.00# make
[  0%] Building CXX object driver/CMakeFiles/mysqlcppconn.dir/mysql_art_resultset.o
[  1%] Building CXX object driver/CMakeFiles/mysqlcppconn.dir/mysql_art_rset_metadata.o
..................
[ 54%] Building CXX object test/CJUnitTestsPort/CMakeFiles/CJUnitTestsPort.dir/BaseTestFixture.o
"/Desktop/mysql-connector-c++-1.0.5/test/CJUnitTestsPort/BaseTestFixture.cpp", line 57: Warning: sqlProps hides testsuite::TestFixtureCommon::sqlProps.
1 Warning(s) detected.
[ 55%] Building CXX object test/CJUnitTestsPort/CMakeFiles/CJUnitTestsPort.dir/__/common/stringutils.o
..................
[ 67%] Building CXX object test/CJUnitTestsPort/CMakeFiles/CJUnitTestsPort.dir/compliance/UnbufferedRsStmtTest.o
Linking CXX executable CJUnitTestsPort
ld: fatal: file CMakeFiles/CJUnitTestsPort.dir/ccpptests.o: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to CJUnitTestsPort
*** Error code 1
The following command caused the error:
cd /Desktop/mysql-connector-c++-1.0.5/test/CJUnitTestsPort && /Desktop/cmake/bin/cmake -E cmake_link_script CMakeFiles/CJUnitTestsPort.dir/link.txt --verbose=
make: Fatal error: Command failed for target `test/CJUnitTestsPort/CJUnitTestsPort'
Current working directory /Desktop/mysql-connector-c++-1.0.5
*** Error code 1
The following command caused the error:
make -f test/CJUnitTestsPort/CMakeFiles/CJUnitTestsPort.dir/build.make test/CJUnitTestsPort/CMakeFiles/CJUnitTestsPort.dir/build
make: Fatal error: Command failed for target `test/CJUnitTestsPort/CMakeFiles/CJUnitTestsPort.dir/all'
Current working directory /Desktop/mysql-connector-c++-1.0.5
*** Error code 1
The following command caused the error:
make -f CMakeFiles/Makefile2 all
make: Fatal error: Command failed for target `all'

Manual cmake with verbose=9
==================================
bash-3.00# cd /Desktop/mysql-connector-c++-1.0.5/test/CJUnitTestsPort && /Desktop/cmake/bin/cmake -E cmake_link_script CMakeFiles/CJUnitTestsPort.dir/link.txt --verbose=9
/usr/bin/CC   -xO4  -g  -KPIC CMakeFiles/CJUnitTestsPort.dir/ccpptests.o CMakeFiles/CJUnitTestsPort.dir/BaseTestFixture.o CMakeFiles/CJUnitTestsPort.dir/__/common/stringutils.o CMakeFiles/CJUnitTestsPort.dir/resources.o CMakeFiles/CJUnitTestsPort.dir/regression/EscapeProcessorRegressionTest.o CMakeFiles/CJUnitTestsPort.dir/compliance/ConnectionTest.o CMakeFiles/CJUnitTestsPort.dir/compliance/DatabaseMetaDataTest.o CMakeFiles/CJUnitTestsPort.dir/compliance/StatementTest.o CMakeFiles/CJUnitTestsPort.dir/compliance/ResultSetMetadataTest.o CMakeFiles/CJUnitTestsPort.dir/compliance/PreparedStatementTest.o CMakeFiles/CJUnitTestsPort.dir/simple/BlobTest.o CMakeFiles/CJUnitTestsPort.dir/regression/BlobRegressionTest.o CMakeFiles/CJUnitTestsPort.dir/regression/PreparedStatementRegressionTest.o CMakeFiles/CJUnitTestsPort.dir/simple/TransactionTest.o CMakeFiles/CJUnitTestsPort.dir/regression/SubqueriesRegressionTest.o CMakeFiles/CJUnitTestsPort.dir/compliance/UnbufferedRsStmtTest.o  -o CJUnitTestsPort  -L/usr/sfw/lib/64 -L/usr/lib/64 -L/lib/64 -L/opt/mysql/5.1.39/lib ../../driver/libmysqlcppconn.so.1.0.5 -lmysqlclient_r ../framework/libtest_framework.a -lz -lpthread -lthread -lposix4 -lresolv -lsocket -lnsl -lm -lpthread -lthread -lposix4 -lresolv -lsocket -lnsl -lm -m64 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic   -DHAVE_RWLOCK_T -DUNIV_SOLARIS -DUNIV_SOLARIS -R/usr/sfw/lib/64:/usr/lib/64:/lib/64:/opt/mysql/5.1.39/lib:/Desktop/mysql-connector-c++-1.0.5/driver 
ld: fatal: file CMakeFiles/CJUnitTestsPort.dir/ccpptests.o: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to CJUnitTestsPort
bash-3.00#

How to repeat:

# tar xvf mysql-connector-c++-1.0.5.tar

# cd mysql-connector-c++-1.0.5

# /path/to/cmake -DCMAKE_INSTALL_PREFIX=/path/to/mysql-connector-c++-1.0.5 -DMYSQL_CONFIG_EXECUTABLE=/opt/mysql/5.1.39/bin/mysql_config -DCMAKE_BUILD_TYPE=Debug -DMYSQLCPPCONN_TRACE_ENABLE:BOOL=1

Suggested fix:

Looks to be a missmatch of 32bit and 64bit files.
[9 Nov 2009 9:07] Tonci Grgin
Hi Patrick and thanks for your report.

I've asked our build master to take a look.
[9 Nov 2009 9:18] Kent Boortz
You could try the following:

 1) Remove the CMakeCache.txt file if any

 2) Set in your environment (assuming you use SunStudio

ASFLAGS=-m64
CC=cc
CFLAGS=-xO2 -xtarget=generic -m64 -mt -xstrconst
CPPFLAGS=-D_POSIX_PTHREAD_SEMANTICS
CXX=CC
CXXFLAGS=-xO2 -xtarget=generic -m64 -mt
LDFLAGS=-m64
export ASFLAGS CC CFLAGS CPPFLAGS CXX CXXFLAGS LDFLAGS

  You can always find the environment used to produce the packages provided
  by Sun at the end of the README file in the binary packages, in this case inside
  mysql-connector-c++-1.1.0-solaris10-x86-64bit.tar.gz

 3) Rerun the build

 4) If it still fails the same way, please rerun your build with "make VERBOSE=1" and compress and attach the complete log to this bug report
[14 Nov 2009 21:15] P C
Hi,
I'm sorry to say we have no servers that can are running OpenSolaris anymore.

It was 100% reporoducible with the information provided in the bug.  Fresh install of OpenSolaris, with MySql server 5.1.39 and C++/Connector 1.0.5.  

BR Patrick
[16 Nov 2009 9:27] Tonci Grgin
Patrick, I can't go on verifying this and not knowing if your cache files were tainted the way Kent described. The fact that, maybe, there was bad CMakeCache.txt file left over from our builds does not constitute a bug per-se as removing that file before (re)building is a known request.

Will consult Kent once more though.