C compiler cannot create executables


doragasu

Member
Joined
Jun 2, 2008
Messages
325
I'm trying to compile Ren'Py. Here is the README file with the compilation process: http://www.renpy.org/dl/lgpl/README.txt


This is the first thing I try to port to Pandora and of course it's not working :( :



Code:
doragasu@doragasu-C2D:~/Pandora/renpy$ setprj renpy

doragasu@doragasu-C2D:~/Pandora/renpy$ cd renpy-deps/

doragasu@doragasu-C2D:~/Pandora/renpy/renpy-deps$ echo $CC

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc

doragasu@doragasu-C2D:~/Pandora/renpy/renpy-deps$ echo $CFLAGS

-DPANDORA -DHAVE_GLES -O3 -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant -fsigned-char

doragasu@doragasu-C2D:~/Pandora/renpy/renpy-deps$ ./build.sh 

2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 

[GCC 4.4.3]

Python works.


Source: /home/doragasu/Pandora/renpy/renpy-deps

Build: /home/doragasu/Pandora/renpy/renpy-deps/build

Install: /home/doragasu/Pandora/renpy/renpy-deps/install


patching file src/stdlib/SDL_iconv.c

Hunk #1 succeeded at 383 (offset 57 lines).

patching file src/video/x11/SDL_x11modes.c

patching file src/audio/SDL_audio.c

configure: loading site script /usr/local/angstrom/arm/site-config

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking for gcc... /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc

checking for C compiler default output file name... 

configure: error: C compiler cannot create executables

See `config.log' for more details.



I have checked "build.sh" script and it looks like neither CC nor CFLAGS are overwritten:





Code:
[...]

INSTALL=$PWD/install

[...]

export CFLAGS="$CFLAGS -O3 -I$INSTALL/include -I$INSTALL/include/freetype2"

export CXXFLAGS="$CXXFLAGS -O3 -I$INSTALL/include -I$INSTALL/include/freetype2"

[...]


Unfortunately I know nothing about autotools and little about scripts, so I'm lost here...


Any suggestions?
 
Last edited by a moderator:
Now that I actually look at it, I see that it thinks you aren't cross compiling, as it detects your host system. Is there any flags you can pass build.sh?
 
It doesn't look like it takes flags. Contents of build.sh:



Code:
#!/bin/bash


SOURCE=`dirname "$0"`

PWD=`pwd`

BUILD=$PWD/build

INSTALL=$PWD/install

export PATH="$INSTALL/bin:$PATH"

export LD_LIBRARY_PATH="$INSTALL/lib:/usr/local/lib"

export DYLIB_LIBRARY_PATH="$INSTALL/lib"

export DYLD_FRAMEWORK_PATH="$INSTALL/frameworks"


if python -c 'import sys; print sys.version; sys.exit(0)'; then

    echo "Python works."

else

    echo "Python could not be found. Please add the directory containing"

    echo "the python program to your PATH."

    exit 1

fi


# The xes are required to prevent msys from interpreting these as

# paths.

SOURCE=`python $SOURCE/norm_source.py "x$PWD" "x$SOURCE"`


CP='cp -pR'


echo

echo Source: $SOURCE

echo Build: $BUILD

echo Install: $INSTALL

echo


mkdir -p $BUILD

mkdir -p $INSTALL


# Unix debug

# export CFLAGS="$CFLAGS -ggdb -I$INSTALL/include -I$INSTALL/include/freetype2"

# export CXXFLAGS="$CXXFLAGS -ggdb -I$INSTALL/include -I$INSTALL/include/freetype2"

# export LDFLAGS="-ggdb -L$INSTALL/lib $LDFLAGS"


# Windows debug

# export CFLAGS="$CFLAGS -gstabs -I$INSTALL/include -I$INSTALL/include/freetype2"

# export CXXFLAGS="$CXXFLAGS -gstabs -I$INSTALL/include -I$INSTALL/include/freetype2"

# export LDFLAGS="-gstabs -L$INSTALL/lib $LDFLAGS"


# Production

export CFLAGS="$CFLAGS -O3 -I$INSTALL/include -I$INSTALL/include/freetype2"

export CXXFLAGS="$CXXFLAGS -O3 -I$INSTALL/include -I$INSTALL/include/freetype2"

export LDFLAGS="-O3 -L$INSTALL/lib $LDFLAGS"


if [ "x$MSYSTEM" != "x" ]; then

  export CFLAGS="$CFLAGS -fno-strict-aliasing "

  export CXXFLAGS="$CXXFLAGS -fno-strict-aliasing "

fi


OLD_CC="$CC"

OLD_LD="$LD"

OLD_CXX="$CXX"

OLD_CXXLD="$CXXLD"

OLD_CFLAGS="$CFLAGS"

OLD_CXXFLAGS="$CXXFLAGS"

OLD_LDFLAGS="$LDFLAGS"

OLD_CXXLDFLAGS="$CXXLDFLAGS"


if [ `uname` = 'Darwin' ]; then

    MAC=yes

    NOALTIVEC=yes

else

    MAC=no

fi


export SED=sed

export RENPY_DEPS_INSTALL=$INSTALL


try () {

    "$@" || exit -1

}


libtool() {

    cp /usr/local/bin/libtool .

}


cd $BUILD


cat <<EOF > ../env.sh

export PATH="$PATH"

export RENPY_DEPS_INSTALL="$INSTALL"

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH"

export DYLIB_LIBRARY_PATH="$DYLIB_LIBRARY_PATH"

export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH"

export PYTHONPATH="$INSTALL/python"

EOF


# try cp "$SOURCE/gcc_version.c" "$BUILD"

# try gcc -c "$BUILD/gcc_version.c"


if [ \! -e built.sdl ]; then


   try mkdir -p "$INSTALL/include/asm"

   try touch "$INSTALL/include/asm/page.h"


   try tar xzf "$SOURCE/SDL-1.2.13.tar.gz"

   try cd "$BUILD/SDL-1.2.13"


   try patch -p0 < $SOURCE/sdl-windows-title.diff

   try patch -p0 < $SOURCE/sdl-staticgray.diff

   try patch -p0 < $SOURCE/sdl-audio-order.diff

   # try patch -p0 < $SOURCE/sdl-no-asm-stretch.diff


   try ./configure --prefix="$INSTALL" --disable-debug --disable-video-dummy --disable-video-fbcon --disable-nas $SDL_ASM


   try make

   try make install

   cd "$BUILD"

   touch built.sdl

fi



# This will be built shared on Linux and Mac by build_python, and 

# static on windows here.

if [ \! -e built.zlib ]; then

   try tar xvzf "$SOURCE/zlib-1.2.3.tar.gz"

   try cd "$BUILD/zlib-1.2.3"

   try ./configure --prefix="$INSTALL"

   try make

   try make install

   cd "$BUILD"

   touch built.zlib

fi



if [ \! -e built.freetype ]; then

   try tar xzf "$SOURCE/freetype-2.3.11.tar.gz"

   try cd "$BUILD/freetype-2.3.11"


   # try cp "$SOURCE/ftmodules.cfg" ./modules.cfg


   try ./configure --prefix="$INSTALL"


   try make modules

   try make

   try make install prefix="$INSTALL"

   cd "$BUILD"

   touch built.freetype

fi


if [ \! -e built.sdl_ttf ]; then

   try tar xvzf "$SOURCE/SDL_ttf-2.0.8.tar.gz"

   try cd "$BUILD/SDL_ttf-2.0.8"

   try ./configure --prefix="$INSTALL"


   try patch -p1 < "$SOURCE/no_freetype_internals.dpatch"


   try make

   try make install

   cd "$BUILD"

   touch built.sdl_ttf

fi



if [ \! -e built.jpeg ]; then

   try tar xvzf "$SOURCE/jpegsrc.v6b.tar.gz"

   try cd "$BUILD/jpeg-6b"

   try ./configure --prefix="$INSTALL"

   try make

   try make install-lib

   ranlib "$INSTALL/lib/libjpeg.a"

   cd "$BUILD"

   touch built.jpeg

fi



if [ \! -e built.png ]; then

   export CFLAGS="$CFLAGS -DPNG_NO_WRITE_tIME"


   try tar xvzf "$SOURCE/libpng-1.2.8-config.tar.gz"

   try cd "$BUILD/libpng-1.2.8-config"

   try ./configure --prefix="$INSTALL" --enable-static --disable-shared

   try make

   try make install

   cd "$BUILD"

   touch built.png

fi


if [ \! -e built.sdl_image ]; then

   export LIBS="-lz"

   try tar xvzf "$SOURCE/SDL_image-1.2.7.tar.gz"

   try cd "$BUILD/SDL_image-1.2.7"

   try ./configure --prefix="$INSTALL" --disable-tif --enable-static --disable-shared --disable-jpg-shared --disable-png-shared --enable-png --enable-jpg --enable-gif

   try make

   try make install

   cd "$BUILD"

   touch built.sdl_image

fi


if [ \! -e built.pygame ]; then


   SDL=`sdl-config --cflags --libs | python -c 'import sys; sys.stdout.write(sys.stdin.read().replace("\n", " ").replace("-mwindows", "").replace("-lSDLmain", "").replace("-Dmain=SDL_main", ""))'`


   echo $SDL

   sleep 10


   try tar xvzf "$SOURCE/pygame-1.8.1release.tar.gz"

   try cd "$BUILD/pygame-1.8.1release"


   try patch -p0 src/rwobject.c "$SOURCE/pygame-rwobject.diff"


   try cp "$SOURCE/rwobject.c" src/

   try cp "$SOURCE/surflock.c" src/

   ## # try cp "$SOURCE/transform.c" src/

   ## # try cp "$SOURCE/sysfont.py" lib/

   try cp "$SOURCE/pygame-setup.py" setup.py

   ## try cp "$SOURCE/alphablit.c" src/alphablit.c

   ## # try cp "$SOURCE/display.c" src/display.c

   try cp "$SOURCE/macosx.py" lib/macosx.py

   try cp "$SOURCE/pygame_init.py" lib/__init__.py

   ## # try cp "$SOURCE/config"*.py .


   # try grep -v "install_parachute ()" src/base.c > src/base.c.new

   # try mv src/base.c.new src/base.c


   try python "$SOURCE/edit.py" "$SOURCE/Setup" Setup @SDL@ "$SDL" @INSTALL@ "$INSTALL"


   if [ "x$MSYSTEM" != "x" ]; then

       try python setup.py build --compiler=mingw32 install_lib -d "$INSTALL/python"

       try cp "$INSTALL/bin/"*.dll "$INSTALL/python/pygame"

       try strip "$INSTALL/python/pygame/"*.dll

       try strip "$INSTALL/python/pygame/"*.pyd

   else

       try python setup.py build install_lib -d "$INSTALL/python"

   fi


   try cp lib/*.ico "$INSTALL/python/pygame"

   try cp lib/*.icns "$INSTALL/python/pygame"

   try cp lib/*.tiff "$INSTALL/python/pygame"

   try cp lib/*.ttf "$INSTALL/python/pygame"

   try cp lib/*.bmp "$INSTALL/python/pygame"


   try python setup.py install_headers -d "$INSTALL/include/pygame"


   cd "$BUILD"

   touch built.pygame

fi


if [ \! -e built.ffmpeg ]; then

   try tar xzf "$SOURCE/ffmpeg-0.6.tar.gz" 

   try cd "$BUILD/ffmpeg-0.6"


   # My windows libraries don't seem to export fstat. So use _fstat32

   # instead.

   try patch -p1 < "$SOURCE/ffmpeg-fstat.diff"


   # av_cold is also a problem on windows.

   export CFLAGS="$CFLAGS -fno-common -Dav_cold="

   export CXXFLAGS="$CXXFLAGS -fno-common -Dav_cold="

   MEM_ALIGN_HACK="--enable-memalign-hack"


   try ./configure --prefix="$INSTALL" \

       --cc="${CC:-gcc}" \

       $FFMPEGFLAGS \

       $MEM_ALIGN_HACK \

       --enable-shared \

       --disable-encoders \

       --disable-muxers \

       --disable-bzlib \

       --disable-demuxers \

       --enable-demuxer=au \

       --enable-demuxer=avi \

       --enable-demuxer=flac \

       --enable-demuxer=m4v \

       --enable-demuxer=matroska \

       --enable-demuxer=mov \

       --enable-demuxer=mp3 \

       --enable-demuxer=mpegps \

       --enable-demuxer=mpegts \

       --enable-demuxer=mpegtsraw \

       --enable-demuxer=mpegvideo \

       --enable-demuxer=ogg \

       --enable-demuxer=wav \

       --disable-decoders \

       --enable-decoder=flac \

       --enable-decoder=mp2 \

       --enable-decoder=mp3 \

       --enable-decoder=mp3on4 \

       --enable-decoder=mpeg1video \

       --enable-decoder=mpeg2video \

       --enable-decoder=mpegvideo \

       --enable-decoder=msmpeg4v1 \

       --enable-decoder=msmpeg4v2 \

       --enable-decoder=msmpeg4v3 \

       --enable-decoder=mpeg4 \

       --enable-decoder=pcm_dvd \

       --enable-decoder=pcm_s16be \

       --enable-decoder=pcm_s16le \

       --enable-decoder=pcm_s8 \

       --enable-decoder=pcm_u16be \

       --enable-decoder=pcm_u16le \

       --enable-decoder=pcm_u8 \

       --enable-decoder=theora \

       --enable-decoder=vorbis \

       --enable-decoder=vp3 \

       --disable-parsers \

       --enable-parser=mpegaudio \

       --enable-parser=mpegvideo \

       --enable-parser=mpeg4video \

       --enable-parser=vp3 \

       --disable-protocols \

       --enable-protocol=file \

       --disable-devices \

       --disable-vdpau \

       --disable-filters \

       --disable-bsfs

   # --disable-stripping


   try make

   try make install


   try mkdir -p "$INSTALL/include/libswscale"

   try cp libswscale/swscale.h  "$INSTALL/include/libswscale"


   cd "$BUILD"

   touch built.ffmpeg

fi


if [ \! -e built.fribidi ]; then


   export CFLAGS="$CFLAGS -DFRIBIDI_CHUNK_SIZE=4080"


   try tar xvzf "$SOURCE/fribidi-0.19.2.tar.gz"

   try cd "$BUILD/fribidi-0.19.2"

   try ./configure --prefix="$INSTALL"

   if [ "x$MSYSTEM" != "x" ]; then

       try patch -p0 < "$SOURCE/fribidi-windows.diff"

   fi

   try make

   try make install

   cd "$BUILD"

   touch built.fribidi

fi


# argparse is so tiny.

cp "$SOURCE/argparse.py" "$INSTALL/python"


export CC=${CC:=gcc}

export CXX=${CXX:=g++}

export LD=${LD:=gcc}

export CXXLD=${CXXLD:=g++}


if [ \! -e built.glew ]; then


   try tar xzf "$SOURCE/glew-1.5.4.tgz"

   try cd "$BUILD/glew-1.5.4"


   try make install OPT="$CFLAGS $LDFLAGS" CC="$CC" LD="$LD" GLEW_DEST=$INSTALL


   cd "$BUILD"

   touch built.glew

fi




echo

cat ../env.sh
 
Code:
doragasu@doragasu-C2D:~/Pandora/renpy$ setprj renpy

checking for C compiler default output file name... 

configure: error: C compiler cannot create executables

See `config.log' for more details.
Been a while since I mucked around with autoconf, but when it's doing the above it usually creates a temp .c file and tries to compile it. You should be able to find the file and the output somewhere to see exactly what the error is e.g. missing library, wrong command line etc. Sorry can't remember where. Have a search of all the created files.

Not much help sorry. I'm sure someone will be along with something better.
 
Last edited by a moderator:
As sebt3 says, look at config.log (usually in the auto directory). My guess would be that cc1 can't find libmpfr and libgmp because it's looking in /usr/lib not /usr/local/lib so you'll need to create some symlinks.
 
This is the config.log file: http://pastebin.com/KZrUf7gy


I had a look to it. Compiler is called at line 81:



Code:
configure:2588: /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc -DPANDORA -DHAVE_GLES -O3 -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant -fsigned-char -O3 -I/home/doragasu/Pandora/renpy/renpy-deps/install/include -I/home/doragasu/Pandora/renpy/renpy-deps/install/include/freetype2 -DPANDORA -DHAVE_GLES -O3 -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant -fsigned-char -O3 -L/home/doragasu/Pandora/renpy/renpy-deps/install/lib -L/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib -Wl,-rpath,/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib -L/mnt/utmp/renpy/lib conftest.c  >&5



Error shows at the following line (82):





Code:
/usr/local/angstrom/arm/libexec/gcc/arm-angstrom-linux-gnueabi/4.3.3/cc1: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory


What is libmpfr? Why doesn't the compiler find it?
 
This is the config.log file: http://pastebin.com/KZrUf7gy


I had a look to it. Compiler is called at line 81:



Code:
configure:2588: /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc -DPANDORA -DHAVE_GLES -O3 -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant -fsigned-char -O3 -I/home/doragasu/Pandora/renpy/renpy-deps/install/include -I/home/doragasu/Pandora/renpy/renpy-deps/install/include/freetype2 -DPANDORA -DHAVE_GLES -O3 -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant -fsigned-char -O3 -L/home/doragasu/Pandora/renpy/renpy-deps/install/lib -L/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib -Wl,-rpath,/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib -L/mnt/utmp/renpy/lib conftest.c  >&5



Error shows at the following line (82):





Code:
/usr/local/angstrom/arm/libexec/gcc/arm-angstrom-linux-gnueabi/4.3.3/cc1: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory


What is libmpfr? Why doesn't the compiler find it?

You might need to run this.

# for 32bit PC


sudo ln -s /usr/lib/libmpfr.so.4.0.0 /usr/lib/libmpfr.so.1


# for 64bit PC


sudo ln -s /usr/lib32/libmpfr.so.4.0.0 /usr/lib32/libmpfr.so.1
Quote from sebt3 from gp32x forum.

3) cc1 (the gcc C compiler backend) requiere libmpfr.so.1, there is chance you have a newer version (probably 4.0.0), then (as root) go to /usr/lib (or lib32 for the 64bits users with multilib support) and :


ln -s libmpfr.so.4.0.0 libmpfr.so.1
 
Last edited by a moderator:
libmpfr was not installed in my system. I installed it using synaptic, but only 64 bit version get installed (under /lib). I have not the 32 bit version, and it continues failing.
 
I posted in the gp32x thread about this. If you don't find the library in your repos, you can link to another file (can't remember which now, check my post there), works peaches.
 
I posted in the gp32x thread about this. If you don't find the library in your repos, you can link to another file (can't remember which now, check my post there), works peaches.

Found your post. The substitution library is libgmp.so.3. Installed, symlinked and got rid of that error. Now I face a new error :( . As slaeshjag suggested, it doesn't detect it's cross compiling and fails with error:



Code:
checking whether the C compiler works... configure: error: cannot run C compiled programs.

If you meant to cross compile, use `--host'.

See `config.log' for more details.


I think I should look for something easier to port :p
 
Paste the config.log and your steps so far like you did in the first post. We'll get through this :)
No need, this (and the script earlier) is enough to know what's wrong :

Code:
If you meant to cross compile, use `--host'.
configure here is complaining because it detect cross-compilation (the script does pass --cc argument) but we are not telling him to which target (--host argument is set by pndconfigure)


Kazuki have a good idea : (you'll need to load $SDK_PATH/environment-setup at the begin of the script)

Try change every instance of ./configure to pndconfigure in build.sh.
Actually the script try to build many libraries that are all already on the pandora.


I'm pretty sure all this is not requiered. the pygame should just run on pandora ;)
 
Last edited by a moderator:
It would be great if I could build only the needed libraries that are not already in Pandora. I suppose that can be made, but to get to it, I would have to learn shell scripting, and maybe also autotools first...


The build process detailed in the readme file makes you build all the dependencies (even if they already exist in your system) and then the build script creates a env.sh file needed to build ren'py itself. I have found no documentation about the contents of this env.sh file, but I suppose it must have the paths of the libraries built in the first step.


I might try to build it in my desktop PC to see the format of the created env.sh. Maybe if I have success with this, I can modify the env.sh file to fit the Pandora and try to compile only the missing stuff...
 
Back
Top