Menu

invalid ELF header

Help
2016-03-23
2016-03-25
  • Dale Richardson

    Dale Richardson - 2016-03-23

    Hi,

    I have cross-compiled PocketSphinx and SphinxBase for evaluation on a TI OMAP L-138 LCDK. I used the following commands on freshly unarchived tarballs.

    ./autogen.sh --host=arm-arago-linux-gnueabi --build=i686-linux-gnu --without-python
    ./configure --host=arm-arago-linux-gnueabi --build=i686-linux-gnu --without-python
    make
    make install DESTDIR=/home/parallels/ps/fresh1
    

    I'm getting the following error:

    pocketsphinx_continuous: error while loading shared libraries: /home/root/fresh1/usr/local/lib/libpocketsphinx.so.3: invalid ELF header
    

    I edited configure.ac for sphinxbase to force use of ALSA rather than pulseaudio which is present on host machine but not on development board. The relevant portion of the configure file is included below, although I don't think the problem is related to that. I understand that this error is encountered when the libraries were compiled for a different architecture or platform than the one generating the error, but I used the same compiling commands previously without issue.
    It seems that the issue arose after I compiled after running configure with the following arguments:

    ./configure --host=arm-arago-linux-gnueabi --build=i686-linux-gnu --without-python CFLAGS="-O3"
    

    I have since removed the "-O3" argument and recompiled with fresh source, but the problem persists.

    relevant excerpt from configure.ac

    case $host in
        *-*-linux*|*-*-uclinux*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
            # Check for ALSA, then fall back to OSS
            AC_CHECK_HEADER(alsa/asoundlib.h,[
                ad_files="ad_alsa.lo"
                ad_backend="AD_BACKEND_ALSA"
                AC_CHECK_LIB(asound, snd_pcm_open)],[
                ad_files="ad_oss.lo"
                ])
            ;;
        *-*-*cygwin*|*-*-*mingw*)
            ad_files="ad_win32.lo"
            ad_libs="-lwinmm"
            ;;
        *-apple-*darwin*)
            sdkparam=`xcodebuild -showsdks | awk '/^$/{p=0};p; /OS X SDKs:/{p=1}' | tail -1 | cut -f3`
            sdkpath=`xcodebuild -version $sdkparam Path`
            ad_cppflags="-I$sdkpath/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers/"
            backup_CPPFLAGS="$CPPFLAGS"
            CPPFLAGS="$CPPFLAGS $ad_cppflags"
            AC_CHECK_HEADER("alc.h", [], AC_MSG_ERROR([OpenAL not found]))
            CPPFLAGS="$backup_CPPFLAGS"
            ad_files="ad_openal.lo"
            ad_libs="-framework OpenAL"
            ;;
        *)
            ad_files="ad_base.lo"
            AC_MSG_RESULT([No audio interface for host type $host.])
            ;;
    esac
    

    Thanks in advance for any assistance!

     
    • Nickolay V. Shmyrev

      Yes, this is a long-standing problem. This autodetect is just broken, it leads to many issues even in Linux. I'll rework this in coming days.

       
  • Dale Richardson

    Dale Richardson - 2016-03-24

    Okay. Thanks! Do you know if there is any information regarding this specific issue posted anywhere? I'd like to keep digging in to this, but I'm not sure where to look, as the error is not very informative for me as a novice user.

     
    • Nickolay V. Shmyrev

      My reply was about audio autodetection.

      On architecture issue, from you description it is not clear if you run this tool on host or on the device. It seems you run on the host since you use host path with /home/root/fresh1. On the device it must be /usr/local/lib instead. So there is a bit of mistunderstading here.

      Overall, you can study the architectures of the binaries with "file" command, find out what was wrong with the compilations in the build log.

       
  • Dale Richardson

    Dale Richardson - 2016-03-24

    Okay. Thanks. Just to be clear, I was running the tool on the device not the host. I added the install location and LD_LIBRARY_PATH env var to /etc/profile for testing. I was previously able to execute the tool on the device without error (only audio input buffer overrun problem). I was recompiling with different options CFFLAGS="-O3" to try to speed up the tool and avoid the buffer issue when I encountered the "invalid ELF headers" error when running the tool on the device. I reverted back to last successful compiling options, and the error persists. I apologize for the confusion. I just added the configure.ac information in the interest of full disclosure because I had altered the file.

     
    • Nickolay V. Shmyrev

      Answer the following questions:

      1) What architecture does the file /home/root/fresh1/usr/local/lib/libpocketsphinx.so.3 have

      2) How it was created, what if you recreate it.

      3) Provide the config.log and build log

      That will help to solve your problem faster.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.