title: compiling pcre 3.38 as 64bit on Solaris 10 - wrong ELF class
body: <p>I am trying to compile pcre 3.38 on Solaris 10 as a 64 bit binary. It starts to compile, and then at some point stops complaining about "wrong ELF class", and indeed, it turns out that some object files created are 32bit - allthough most are 64 bit as desired.</p>
  
  <p>Here is what I have done:</p>
  
  <pre><code>./configure CFLAGS=-m64 LDFLAGS=-m64
  </code></pre>
  
  <p>Then </p>
  
  <pre><code>make            
  rm -f pcre_chartables.c
  ln -s ./pcre_chartables.c.dist pcre_chartables.c
  make  all-am
  make[1]: Entering directory `/local/src/pcre-8.38'
    CC       libpcre_la-pcre_byte_order.lo
    CC       libpcre_la-pcre_compile.lo
    CC       libpcre_la-pcre_config.lo
    CC       libpcre_la-pcre_dfa_exec.lo
    CC       libpcre_la-pcre_exec.lo
    CC       libpcre_la-pcre_fullinfo.lo
    CC       libpcre_la-pcre_get.lo
    CC       libpcre_la-pcre_globals.lo
    CC       libpcre_la-pcre_jit_compile.lo
    CC       libpcre_la-pcre_maketables.lo
    CC       libpcre_la-pcre_newline.lo
    CC       libpcre_la-pcre_ord2utf8.lo
    CC       libpcre_la-pcre_refcount.lo
    CC       libpcre_la-pcre_string_utils.lo
    CC       libpcre_la-pcre_study.lo
    CC       libpcre_la-pcre_tables.lo
    CC       libpcre_la-pcre_ucd.lo
    CC       libpcre_la-pcre_valid_utf8.lo
    CC       libpcre_la-pcre_version.lo
    CC       libpcre_la-pcre_xclass.lo
    CC       libpcre_la-pcre_chartables.lo
    CCLD     libpcre.la
    CC       libpcreposix_la-pcreposix.lo
    CCLD     libpcreposix.la
    CXX      libpcrecpp_la-pcrecpp.lo
    CXX      libpcrecpp_la-pcre_scanner.lo
    CXX      libpcrecpp_la-pcre_stringpiece.lo
    CXXLD    libpcrecpp.la
  ld: fatal: file ./.libs/libpcre.so: wrong ELF class: ELFCLASS64
  ld: fatal: file processing errors. No output written to .libs/libpcrecpp.so.0.0.1
  collect2: ld returned 1 exit status
  make[1]: *** [libpcrecpp.la] Error 1
  make[1]: Leaving directory `/local/src/pcre-8.38'
  make: *** [all] Error 2
  </code></pre>
  
  <p>Checking what was done so war, I see mostly 64 bit object files, but a few 32 bit ones, and I assume this is where the problem comes from:</p>
  
  <pre><code>file .libs/*
  .libs/libpcre_la-pcre_byte_order.o:     ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_chartables.o:     ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_compile.o:        ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_config.o: ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_dfa_exec.o:       ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_exec.o:   ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_fullinfo.o:       ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_get.o:    ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_globals.o:        ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_jit_compile.o:    ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_maketables.o:     ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_newline.o:        ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_ord2utf8.o:       ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_refcount.o:       ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_string_utils.o:   ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_study.o:  ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_tables.o: ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_ucd.o:    ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_valid_utf8.o:     ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_version.o:        ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre_la-pcre_xclass.o: ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcre.a:        current ar archive, 32-bit symbol table
  .libs/libpcre.la:       ascii text
  .libs/libpcre.lai:      ascii text
  .libs/libpcre.so:       ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
  .libs/libpcre.so.1:     ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
  .libs/libpcre.so.1.2.6: ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
  .libs/libpcrecpp_la-pcre_scanner.o:     ELF 32-bit MSB relocatable SPARC Version 1
  .libs/libpcrecpp_la-pcre_stringpiece.o: ELF 32-bit MSB relocatable SPARC Version 1
  .libs/libpcrecpp_la-pcrecpp.o:  ELF 32-bit MSB relocatable SPARC Version 1
  .libs/libpcreposix_la-pcreposix.o:      ELF 64-bit MSB relocatable SPARCV9 Version 1
  .libs/libpcreposix.a:   current ar archive, 32-bit symbol table
  .libs/libpcreposix.la:  ascii text
  .libs/libpcreposix.lai: ascii text
  .libs/libpcreposix.so:  ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
  .libs/libpcreposix.so.0:        ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
  .libs/libpcreposix.so.0.0.3:    ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
  </code></pre>
  
  <p>Its unclear to my why 32 bit binaries are even built, <code>CFLAGS=-m64</code> should take care of that. </p>
  
  <p>Any idea how to debug this further?</p>