Author Topic: Non-developer looking to build Chocolate Doom, Cross Compiling Woes  (Read 2769 times)

knock (OP)

  • Posts: 3
Hello!  I've just recieved my GCW Zero in the mail, and have decided to try to build *something* today.  So, I thought I'd give Chocolate Doom a shot.

I'm not a developer (can't program, but I can build anything I need given enough time), and was wondering if somebody could give me a little assistance on compiling for the Zero.  I've built this program a few times, and my first good attempt at building it for the Zero resulted in 686 binaries.

So, is there a guide out there for cross-compiling, preferably specifically for the GCW-Zero?  I found something for the kernel, but how about more simple programs?

I'm using Arch Linux with GCC 4.8.1 from the repository (I won't post build specs right now unless needed, it's the vanilla package from the distro), on an Intel Atom n270 processor, if any of this information is helpful.  If I missed any important details, feel free to ask.

Burb

  • *
  • Posts: 37
Re: Non-developer looking to build Chocolate Doom, Cross Compiling Woes
« Reply #1 on: August 28, 2013, 11:25:36 pm »
Have you downloaded the gcw0-toolchain yet?

http://www.gcw-zero.com/develop

Pretty basic, follow the instructions on there. Download the tar.bz2 and unpack in /opt

Instead of using gcc for your native environment, use the one in /opt/gcw0-toolchain/usr/bin
You could add this dir to your PATH if you wish

So you compile a program like this:
Code: [Select]
/opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc main.c -I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/include -L/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/lib -lSDL -lSDL_image -lSDL_gfx -lSDL_mixer -lSDL_ttf -o output.gcw
example for an SDL app.. link with the libraries you need.

knock (OP)

  • Posts: 3
Re: Non-developer looking to build Chocolate Doom, Cross Compiling Woes
« Reply #2 on: August 29, 2013, 12:46:19 am »
I already had the toolkit installed.  I'm sorry, I forgot to mention that Chocolate Doom uses autoconf.  That said, I was able to take some of your post, Burb, and apply it to what I'm trying.

So, I got this far:
Code: [Select]
$ ./configure CC="/opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc" --host --build
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
checking for --build-gcc... /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc accepts -g... yes
checking for /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc option to accept ISO C89... none needed
checking for --build-ranlib... no
checking for ranlib... ranlib
configure: WARNING: using cross tools not prefixed with host triplet
checking for python... true
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.1.3... cross compiling; assumed OK...
yes
checking how to run the C preprocessor... /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for Mix_LoadMUS in -lSDL_mixer... yes
checking for SDLNet_UDP_Send in -lSDL_net... yes
checking for src_new in -lsamplerate... no
checking for log in -lm... yes
checking linux/kd.h usability... yes
checking linux/kd.h presence... yes
checking for linux/kd.h... yes
checking dev/isa/spkrio.h usability... no
checking dev/isa/spkrio.h presence... no
checking for dev/isa/spkrio.h... no
checking dev/speaker/speaker.h usability... no
checking dev/speaker/speaker.h presence... no
checking for dev/speaker/speaker.h... no
checking for mmap... yes
checking for sched_setaffinity... yes
checking for ioperm... yes
checking for i386_iopl in -li386... no
checking for amd64_iopl in -lamd64... no
checking for --build-windres... no
checking for windres... no
checking for --build-strip... no
checking for strip... strip
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for --build-strip... strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking dependency style of /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc... gcc3
configure: creating ./config.status
config.status: creating Makefile
config.status: creating rpm.spec
config.status: creating man/Makefile
config.status: creating opl/Makefile
config.status: creating opl/examples/Makefile
config.status: creating pcsound/Makefile
config.status: creating pkg/Makefile
config.status: creating pkg/config.make
config.status: creating pkg/osx/Info.plist
config.status: creating pkg/osx/Info-gnustep.plist
config.status: creating setup/Makefile
config.status: creating setup/setup.desktop
config.status: creating setup/setup-res.rc
config.status: creating setup/setup-manifest.xml
config.status: creating data/Makefile
config.status: creating src/Makefile
config.status: creating src/doom.desktop
config.status: creating src/doom-screensaver.desktop
config.status: creating src/resource.rc
config.status: creating textscreen/Makefile
config.status: creating textscreen/examples/Makefile
config.status: creating wince/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

and then run make I error like so:

Code: [Select]
/opt/gcw0-toolchain/usr/lib/gcc/mipsel-gcw0-linux-uclibc/4.8.1/../../../../mipsel-gcw0-linux-uclibc/bin/ld: skipping incompatible /usr/lib/libSDL.so when searching for -lSDL



So, I sort of understand what I need to do.  The error I see is related to the lbraries.  When I edit the output to this:

Code: [Select]
./configure CC="/opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc" LIBS="/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/lib"
I get the following:
Code: [Select]
\checking for gcc... /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc
checking whether the C compiler works... no
configure: error: in `/home/arin/Source/GCW/chocolate-doom/chocolate-doom-1.7.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
[[email protected] chocolate-doom-1.7.0]$ ./configure CC="/opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc" LIBS="/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/lib"
checking for gcc... /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc
checking whether the C compiler works... no
configure: error: in `/home/arin/Source/GCW/chocolate-doom/chocolate-doom-1.7.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

So, how am I supposed to tell the compiler where the libraries are?  Or did I just take your information, and go in the total opposite direction?

It seems the last bits are the LIBS and CPPFLAGS tags, and --host/--build.  So, what do I need for these fields?

johnnyonflame

  • *
  • Posts: 212
Re: Non-developer looking to build Chocolate Doom, Cross Compiling Woes
« Reply #3 on: August 29, 2013, 02:45:56 am »
use "--host=mipsel-linux", and remove the other arguments.

knock (OP)

  • Posts: 3
Re: Non-developer looking to build Chocolate Doom, Cross Compiling Woes
« Reply #4 on: August 31, 2013, 03:04:26 am »
Thank you!  It built.  I don't have much to share beyond that, since I was just trying to use my device to learn a bit about cross-compiling.

 

Post a new topic