LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-18-2006, 12:24 PM   #1
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Cross-Compilers for Slackware


I recently added a Cross-Compile section to my Sources area with a sampling of compilers for other architectures:

Symbian SDK and gcc30-psion98r2 compiler for Nokia phones

MingW-gcc compilers 2.95.3, 3.2.3 and 3.4.2 for producing
Win32 binaries. I've produced working binaries for Windows using these for grubinstall.exe and makebootfat.exe

There are no packages available just yet, but the build scripts will set them up for you. I may need to fix the Symbian directory -I've replaced the original SDK zip file with a tar.bz2. That's because the SDK packages are pretty hard to process -they are Windwos .cab files and have to be sanitized and culled, etc. To make it easier I do all that and repackage them.

Installation of these compilers won't overwrite anything from your regular Slackware compiler. Project files are here:

http://distro.ibiblio.org/pub/linux/...Cross-Compile/

Last edited by gnashley; 06-18-2006 at 12:25 PM.
 
Old 06-19-2006, 09:20 PM   #2
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
SWEET! Thank you kind sir!

...aaron
 
Old 06-20-2006, 01:59 AM   #3
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Original Poster
Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Also, in DevelTools you'll find older versions of the regular i486-slackware gcc compilers, all recompiled under Slack>10.0 They are all available as packages, which like the cross compilers, don't overwrite your regular gcc installation.
They come in handy for compiling older code which doesn't conform to newer coding conventions.
 
Old 11-18-2006, 09:36 PM   #4
rcorkum
Member
 
Registered: Aug 2005
Location: Thunder Bay, Ontario, Canada
Distribution: Slackware Current
Posts: 113

Rep: Reputation: 15
thank you so much for your scripts, they are a god send I been banging my head on dialup now 48 hours trying to get so I could cross compile simple dos/windows programs in my slack box
I mean who wants to work in windows when you have a choice

but can I ask whats the proper way to call your build tools after they are compiled? --target?

whats the target build or such just a couple examples would be great. than you
 
Old 11-18-2006, 11:14 PM   #5
rcorkum
Member
 
Registered: Aug 2005
Location: Thunder Bay, Ontario, Canada
Distribution: Slackware Current
Posts: 113

Rep: Reputation: 15
bin untils built fine then (my slack box is only a p233 192 megs 20 megs ram but I love her)

but after 2 hours on gcc it coughed.

below is the tail end of my /home/mingw/gcc-mingw32# more make.log

any feedback and help appreciated as really want to get a cross compiler installed and running out of caffiene.

/bin/sh mklibgcc > tmp-libgcc.mk
mv tmp-libgcc.mk libgcc.mk
TARGET_CPU_DEFAULT="" \
HEADERS="ansidecl.h config/i386/xm-mingw32.h" DEFINES="" \
/bin/sh /home/mingw/source/gcc-3.4.5-20060117-1/gcc/mkconfig.sh tconfig.h
/home/mingw/gcc-mingw32/gcc/xgcc -B/home/mingw/gcc-mingw32/gcc/ -B/usr/local/mingw32/mingw32/bin/ -B/usr/local/
mingw32/mingw32/lib/ -isystem /usr/local/mingw32/mingw32/include -isystem /usr/local/mingw32/mingw32/sys-includ
e -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-
definition -isystem ./include -I. -I. -I/home/mingw/source/gcc-3.4.5-20060117-1/gcc -I/home/mingw/source/gcc-
3.4.5-20060117-1/gcc/. -I/home/mingw/source/gcc-3.4.5-20060117-1/gcc/../include -g0 -finhibit-size-directive
-fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-unit-at-a-time -fno-omit-frame-pointer
\
-c /home/mingw/source/gcc-3.4.5-20060117-1/gcc/crtstuff.c -DCRT_BEGIN \
-o crtbegin.o
In file included from /home/mingw/source/gcc-3.4.5-20060117-1/gcc/crtstuff.c:62:
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/tsystem.h:79:19: stdio.h: No such file or directory
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/tsystem.h:82:23: sys/types.h: No such file or directory
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/tsystem.h:85:19: errno.h: No such file or directory
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/tsystem.h:92:20: string.h: No such file or directory
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/tsystem.h:93:20: stdlib.h: No such file or directory
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/tsystem.h:94:20: unistd.h: No such file or directory
In file included from /home/mingw/gcc-mingw32/gcc/include/syslimits.h:7,
from /home/mingw/gcc-mingw32/gcc/include/limits.h:11,
from /home/mingw/source/gcc-3.4.5-20060117-1/gcc/tsystem.h:97,
from /home/mingw/source/gcc-3.4.5-20060117-1/gcc/crtstuff.c:62:
/home/mingw/gcc-mingw32/gcc/include/limits.h:122:61: limits.h: No such file or directory
In file included from /home/mingw/source/gcc-3.4.5-20060117-1/gcc/crtstuff.c:62:
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/tsystem.h:100:18: time.h: No such file or directory
In file included from ./tm.h:10,
from /home/mingw/source/gcc-3.4.5-20060117-1/gcc/crtstuff.c:64:
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/config/i386/cygming.h:358: error: syntax error before '*' token
/home/mingw/source/gcc-3.4.5-20060117-1/gcc/config/i386/cygming.h:358: warning: function declaration isn't a pr
ototype
make[1]: *** [crtbegin.o] Error 1
make[1]: Leaving directory `/home/mingw/gcc-mingw32/gcc'
make: *** [all-gcc] Error 2
 
Old 11-19-2006, 09:58 AM   #6
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Original Poster
Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Have you trie building any other versions of gcc -3.2.3 might be the best candidate.

crt problems -I get these when I try to build uClibc shared libs also.
In your case it seems that stdlib headers are not being found. do you have the MingW runtime installed? Sometimes you need to include the mingW windows.h also.
I haven't done much serious compiling with MingW, but you can see a couple of simple programs that I compiled on my site -grubinstall.exe is one.

It may be that we need to set GCC_INCLUDES or some other variable in the wrapper to find and use the right headers.
You are using the wrapper to run it right?
 
Old 11-19-2006, 09:17 PM   #7
rcorkum
Member
 
Registered: Aug 2005
Location: Thunder Bay, Ontario, Canada
Distribution: Slackware Current
Posts: 113

Rep: Reputation: 15
Cool

sorry for the long reply starting clean again
I had to drop this out of your doitall-3.4.2

#
# Main part of the script
#

# download_files

removing that bottom #, I know you know this just sharing info with others, before it would detect or find or download files (I already had them pre downloaded) but it wouldn't find them without.

anyway starting fresh and clean letting the pc do its thing

thanks for your reply and help and how you've shared your work its truey truely appreciated i may have questions again if something coughs will know in a few hours on this p233

Last edited by rcorkum; 11-19-2006 at 09:21 PM.
 
Old 11-20-2006, 11:59 AM   #8
rcorkum
Member
 
Registered: Aug 2005
Location: Thunder Bay, Ontario, Canada
Distribution: Slackware Current
Posts: 113

Rep: Reputation: 15
Thumbs up

well I had this on my screen this morning

Installation complete!

this was my setup

GCC_CORE_ARCHIVE="gcc-core-3.4.5-20060117-1-src.tar.gz"
GCC_GPP_ARCHIVE="gcc-g++-3.4.5-20060117-1-src.tar.gz"
GCC_G77_ARCHIVE=""
GCC_OBJC_ARCHIVE=""
GCC_JAVA_ARCHIVE=""
GCC_ADA_ARCHIVE=""
GCC_PATCH=""

BINUTILS_ARCHIVE="binutils-2.17.50-20060824-1-src.tar.gz"

MINGW_ARCHIVE="mingw-runtime-3.11.tar.gz"

W32API_ARCHIVE="w32api-3.8.tar.gz"

my /home/mingw/source contents

-rw-r--r-- 1 root root 17702533 2006-11-19 23:06 binutils-2.17.50-20060824-1-src.tar.gz
-rw-r--r-- 1 root root 17693587 2006-11-18 23:21 gcc-core-3.4.5-20060117-1-src.tar.gz
-rw-r--r-- 1 root root 3946638 2006-11-18 23:21 gcc-g++-3.4.5-20060117-1-src.tar.gz
-rw-r--r-- 1 root root 426259 2006-11-18 19:33 mingw-runtime-3.11.tar.gz
-rw-r--r-- 1 root root 1623353 2006-11-18 19:33 w32api-3.8.tar.gz

so thanks so much for your script, no idea why it didn't work before this run it went right out of the box I did slocate on my box and did make sure i started I had no other copies of mingw hanging around as i been playing so much (I hunted for some of the missing .h and when noticed them in other mingw folders made sure I was only working in one spot (since my sanity was starting to be questioned chuckle)
 
Old 11-20-2006, 12:01 PM   #9
rcorkum
Member
 
Registered: Aug 2005
Location: Thunder Bay, Ontario, Canada
Distribution: Slackware Current
Posts: 113

Rep: Reputation: 15
Quote:
Originally Posted by gnashley
Have you trie building any other versions of gcc -3.2.3 might be the best candidate.

crt problems -I get these when I try to build uClibc shared libs also.
In your case it seems that stdlib headers are not being found. do you have the MingW runtime installed? Sometimes you need to include the mingW windows.h also.
I haven't done much serious compiling with MingW, but you can see a couple of simple programs that I compiled on my site -grubinstall.exe is one.
yeah I was using the wrapper also tried a few other dozen chuckle install scripts but as I posted above it finally worked perfect and sweet do you have a link to the your site that has the example above?
 
Old 11-21-2006, 06:06 AM   #10
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Original Poster
Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
This is the wrapper that I use to compile sources with MingW32:

#!/bin/sh
export PATH=/usr/i586-mingw32/mingw32/bin:/usr/i586-mingw32/bin:$PATH
echo "Here's the PATH:"
echo $PATH
echo ""
export LD_LIBRARY_PATH=/usr/i586-mingw32/mingw32/lib:/usr/i586-mingw32/lib/gcc/mingw32/3.4.5:$LD_LIBRARY_PATH
echo "Here's the LD_LIBRARY_PATH:"
echo $LD_LIBRARY_PATH
echo ""
export GCC_INCLUDE_DIR=/usr/i586-mingw32/lib/gcc/mingw32/3.4.5/include:$GCC_INCLUDE_DIR
echo "Here's the GCC_INCLUDE_DIR:"
echo $GCC_INCLUDE_DIR
echo ""
sleep 2
echo "Now running commands..."
exec "$@"

# end wrapper script

Just place it in /usr/local/bin. Then to compile using mingw32 type:

MINGW345 make

Sometimes you need to add lines something like:
-I/usr/i586-mingw32/include
-L/usr/i586-mingw32/lib
to your make file.

Here's a binary package with everything in it;
http://distro.ibiblio.org/pub/linux/...4.5-i586-1.tgz

It uses these sources:
binutils-2.17.50-20060824-1-src.tar.gz
gcc-core-3.4.5-20060117-1-src.tar.gz
gcc-g++-3.4.5-20060117-1-src.tar.gz
mingw-runtime-3.11.tar.gz
w32api-3.7.tar.gz

Note that these build scripts are not written by me. They are simply what I have found to work. The MinGW wiki has several different scripts. This method uses the pre-compiled runtime libs from the project. I have not yet been able to compile the runtime libs from source.

Here's the sources that I test with:
http://distro.ibiblio.org/pub/linux/...l-0.9d.tar.bz2

To try out your compiler:
Unzip this (or other) grub tarball in a free directory.
http://distro.ibiblio.org/pub/linux/...ub-0.97.tar.gz
You don't need to compile grub.
Then unzip the grubinstall tarball *inside* the grub sources.
Then cd into the grub-0.xx/grubinstall directory and type 'MINGW345 make'
This should produce grubinstall.exe

I have another program that I also compiled with mingw32 but don't remember what it was... I have also compiled the 'hello world' example from the documentation and run it under Linux using wine. I'd be interested in knowing about your results and having examples of code that works.

Last edited by gnashley; 11-21-2006 at 06:07 AM.
 
Old 11-21-2006, 10:26 AM   #11
rcorkum
Member
 
Registered: Aug 2005
Location: Thunder Bay, Ontario, Canada
Distribution: Slackware Current
Posts: 113

Rep: Reputation: 15
yes i had used your doitall-3.4.2 and had installed from my build dir of /home/mingw/ to /usr/local/mingw as my target (never worked with a cross compiler before was just intereted to get it going
and I was working local without the wrapper you showed me (this so greatly ties it all together thank you SO SO Much,

I am snagging your package now will take me about 2 hours on dialup but

like you I had done a test hello world and it worked on my xp box

[12:13:11] [root] [/usr/local/mingw32/bin] >ls
hello.c mingw32-c++filt* mingw32-gcc* mingw32-ld* mingw32-readelf*
mingw32-addr2line* mingw32-cpp* mingw32-gcc-3.4.5* mingw32-nm* mingw32-size*
mingw32-ar* mingw32-dlltool* mingw32-gccbug* mingw32-objcopy* mingw32-strings*
mingw32-as* mingw32-dllwrap* mingw32-gcov* mingw32-objdump* mingw32-strip*
mingw32-c++* mingw32-g++* mingw32-gprof* mingw32-ranlib* mingw32-windres*
[12:13:16] [root] [/usr/local/mingw32/bin] >more hello.c
#include <stdio.h>

int main(void)
{
printf("Hello, world!\n");
return 0;
}

[12:13:23] [root] [/usr/local/mingw32/bin] >./mingw32-gcc hello.c -o hello.exe
[12:13:40] [root] [/usr/local/mingw32/bin] >ls -l hello*
-rw-r--r-- 1 root root 81 2006-11-20 23:06 hello.c
-rwxr-xr-x 1 root root 420789 2006-11-21 12:13 hello.exe*
[12:13:48] [root] [/usr/local/mingw32/bin] >./mingw32-strip hello.exe
[12:14:00] [root] [/usr/local/mingw32/bin] >ls -l hello*
-rw-r--r-- 1 root root 81 2006-11-20 23:06 hello.c
-rwxr-xr-x 1 root root 6144 2006-11-21 12:14 hello.exe*
[12:14:06] [root] [/usr/local/mingw32/bin] >upx hello.exe
Ultimate Packer for eXecutables
Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
UPX 2.03 Markus Oberhumer, Laszlo Molnar & John Reiser Nov 7th 2006

File size Ratio Format Name
-------------------- ------ ----------- -----------
6144 -> 3584 58.33% win32/pe hello.exe

Packed 1 file.
[12:14:16] [root] [/usr/local/mingw32/bin] >ls -l hello*
-rw-r--r-- 1 root root 81 2006-11-20 23:06 hello.c
-rwxr-xr-x 1 root root 3584 2006-11-21 12:14 hello.exe*
[12:14:20] [root] [/usr/local/mingw32/bin] >

Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\DJGPP\MYSTUFF>cd hello

C:\DJGPP\MYSTUFF\HELLO>ls -l
total 4
-rw-r--r-- 1 dosuser root 81 Nov 20 23:06 hello.c
-rwxr-xr-x 1 dosuser root 3584 Nov 21 10:34 hello.exe

C:\DJGPP\MYSTUFF\HELLO>hello
Hello, world!

C:\DJGPP\MYSTUFF\HELLO>

I really let out a yell of joy last night when I finally got so I could cross compile and now with your new package and wrapper going to make it easier for many I know I plan to undo my manual install and just add your package. it gives me a standard directory structure to follow and such thanks so much, I got really bored last night and decided to uninstall apache and php and mysql and build them all from stable so having fun, I run my slackbox local being on dialup but its my baby, windows is so so boring staring at a screen clicking on a mouse puts me to sleep. and who wants to program in windows when working in linux is just so much easier and more relaxing.

just thank you for releasing the stuff you do, gives us all toys to play with

Robert
 
Old 11-22-2006, 05:17 PM   #12
rcorkum
Member
 
Registered: Aug 2005
Location: Thunder Bay, Ontario, Canada
Distribution: Slackware Current
Posts: 113

Rep: Reputation: 15
Thumbs up

installed your package works like a champ I get some time this weekend will play some more thanks so much again.
 
Old 11-23-2006, 02:35 PM   #13
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Original Poster
Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
I just added UClibc with gcc wrappers also. These let you compile binaries linked to uClibc, but using your regular compiler and binutils. Nice for building busybox or other tiny stuff.
 
Old 11-24-2006, 04:52 PM   #14
rcorkum
Member
 
Registered: Aug 2005
Location: Thunder Bay, Ontario, Canada
Distribution: Slackware Current
Posts: 113

Rep: Reputation: 15
I was going to post this in the programmers forum but thought I'd post here in case someone is following this thread since its related

http://www.libsdl.org/extras/win32/cross/

the cross configure sh

I'm trying to cross compile a program that uses the gmp library
http://www.swox.com/gmp/

now of course i can make it under native linux no problem

but I admit this is newbie confusion ( I been pouring over the gmp mailing list archives as well as the mingw list archives)

but how do I cross compile this lib I am guessing as you showed me above once i have it done i just add its includes and lib manually around the MINGW345 wrapper with the -I and -L

I poured over the configure.in for the gmp source trying to figure out my --build and --host

at first I didn't check when I was cross compiling and had lack of gmp error but slocate sure found it just fine so then (this was 3am after tweaking kernels) that i needed to cross compile this library build it for windows and target CPU (i586 is fine) and then link my MINGW345 build to it as I work.

I tried editing the cross_build.sh to support your layout but couldn't make that work. not lost just banging my head so thought maybe someone could shine a lit on my errors in thought process and method.

so how do I cross configure to run configuration scripts to support your mingw package

and how would i cross build this lib using your package even pointers would be appreciated. so I can understand method and learn aa I go thanks

p.s. on a side note, making a new 2.6.18.3 kernel went like a swiss watch was so shocked have built a few now just to play and tweaking.

Last edited by rcorkum; 11-24-2006 at 04:53 PM.
 
Old 11-25-2006, 02:40 AM   #15
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Original Poster
Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
I haven't tried compiling autoconf sources yet, but I'll try to help you get going.
Try exporting your paths manually from the command line and then configure with
--host=mingw32

You mnay need to give includedir and libdir also, depending on the sources.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross compiled kernel-2.6.13 for x86-64 arch stops booting under Slackware-10.1 Basel Slackware 4 09-09-2005 12:57 PM
updating compilers in slackware HKJGN Linux - Software 2 03-02-2005 11:03 AM
Cross-Building Slackware as a whole? gargamel Slackware - Installation 2 05-09-2004 06:31 PM
C++ Compilers (!~CoW~!) Linux - Software 12 11-18-2003 09:52 AM
CD with many compilers...Are there any? Colonel Panic Programming 5 10-16-2001 07:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration