Linux->Windows cross compiling

cao,
U Kdevelop sam pokusao napraviti crosscompileing win32 project …, ali javlja se greska

checking for C++ compiler default output file name... configure: error: C++ compiler cannot create executables See `config.log' for more details. *** Exited with status: 77 ***
problem je sto najvejrovatnije ne postoji mingw32. Moze li mi neko objasniti koje pakete treba da instaliram da bih mogao kompajlirati win aplikacije na linuxu.

Pa sta kaze u config.log? :slight_smile:

Pa kaze nesto u tom fazonu da nema mingw32 :slight_smile:

evo i tog dijela:

configure:2507: checking for C++ compiler version configure:2514: i586-mingw32msvc-c++ --version >&5 /home/muamer/Desktop/crosss/configure: line 2515: i586-mingw32msvc-c++: command not found configure:2517: $? = 127 configure:2524: i586-mingw32msvc-c++ -v >&5 /home/muamer/Desktop/crosss/configure: line 2525: i586-mingw32msvc-c++: command not found configure:2527: $? = 127 configure:2534: i586-mingw32msvc-c++ -V >&5 /home/muamer/Desktop/crosss/configure: line 2535: i586-mingw32msvc-c++: command not found configure:2537: $? = 127 configure:2560: checking for C++ compiler default output file name configure:2587: i586-mingw32msvc-c++ conftest.cpp >&5 /home/muamer/Desktop/crosss/configure: line 2588: i586-mingw32msvc-c++: command not found
a evo i citav config.log
http://muamer0.googlepages.com/config.log

http://www.mingw.org/MinGWiki/index.php/build%20a%20Win32%20x-compiler%20for%20Linux
(nadam se da će raditi link)

Automated MinGW Installer

http://sourceforge.net/project/showfiles.php?group_id=2435

Koristio sam ovo http://www.mingw.org/MinGWiki/index.php/build%20a%20Win32%20x-compiler%20for%20Linux
uputstvo.
Radio sam sve kako je navedeno ali ipak se javljaju neki errori :(.
Skinuo sam sve potrebne fileove:

[code]Download at least the following (or newer) packages from the MinGW download page

    * binutils
    * gcc-core
    * gcc-g++
    * mingw-runtime
    * w32api[/code]

nadam se da ne fali nista.

U ponuđenoj skripti :http://muamer0.googlepages.com/mingw32 samo dodao:

PACKAGE_DIR=/home/muamer/Documents/programi/mingw32 BUILD_ROOT=/home/src/mingw PREFIX=/home/muamer/Documents/programi/mingw32
gdje su:
PACKAGE_DIR is where we saved the downloaded tarballs;

BUILD_ROOT is a temporary location for the build, (will be created if it doesn’t exist, will be removed when done unless do_clean=0 below);

PREFIX is the root of the compiler’s installation tree.

Nisam bio siguran sta trebam dodati PREFIX (root of the compiler’s installation tree.) pa sam stavio isti
kao i za PACKAGE DIR, moguce da je to pravilo problem.

i na kraju evo i stderr izlaza nakon pokretanja skripte, posto sama skripta nije napravila nikakav log.
http://muamer0.googlepages.com/err.txt

Ja u ovom logu vidim tonu grešaka. Najfatalnije mi se čine ove assembler greške, ali možemo pokušati riješiti ove ostale. Fale ti programi:
makeinfo (dio paketa texinfo)
dlltool - ovo ti je trebalo doći uz mingw!?
libiberty - http://gcc.gnu.org/onlinedocs/libiberty/ (ima paket)
dos2unix

Dalje čini se da ti nedostaje tar fajl gcc-g77-3.4.5-20060117-1-src.tar.gz kao i fajl mingw-runtime-3.10-20060909-1.math_patch (ne znam da li je ovo drugo toliko bitno)

Ok pregldao sam još jednom log i mislim da je ključni problem to što nisi downloadovao g77 (fortran kompajler) a negdje u skripti si ga stavio kao obavezan.

dodavanje ovog filea je rijesilo samo error koji se odnosio na g77.
Potrazit cu i ove ostale fileove koje si gore naveo:

[quote]makeinfo (dio paketa texinfo)
dlltool - ovo ti je trebalo doći uz mingw!?
libiberty - http://gcc.gnu.org/onlinedocs/libiberty/ (ima paket)
dos2unix[/quote]
ovo je log nakon dodavanja g77:
http://muamer0.googlepages.com/err2.log

Koji distro?
Ovo je takođe interesantna poruka:

The directory that should contain system headers does not exist: /home/muamer/Documents/programi/mingw32/lib/gcc/i686-pc-mingw32/3.4.5/../../../../i686-pc-mingw32/sys-include

[quote=vedran]Koji distro?
Ovo je takođe interesantna poruka:

The directory that should contain system headers does not exist: /home/muamer/Documents/programi/mingw32/lib/gcc/i686-pc-mingw32/3.4.5/../../../../i686-pc-mingw32/sys-include
[/quote]
pa mozda je problem sto sam za PREFIX=/home/muamer/Documents/programi/mingw32
stavio pogresnu putanju. Nisam bio siguran sta znaci [quote]PREFIX is the root of the compiler’s installation tree[/quote]
pa sam naveo ovaj mingw32 dir.

Koristim Mandrivu 2007.1

Evo log nakon instaliranja svih paketa koji su pravili problem
http://muamer0.googlepages.com/err10.log
imam jos samo jedan error koji se odnosi
na libstdc+±v3

[quote]configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make: *** [configure-target-libstdc+±v3] Error 1
/usr/bin/install: cannot stat fixinc/fixincl': No such file or directory make[1]: *** No rule to make targetinstall’. Stop.
make: *** [install-target-libstdc+±v3] Error 2[/quote]
ovaj error se nalazi na samo kraju log filea.
pokusao sam ga dodati sa urpmi

[quote][root@localhost mingw32]# urpmi libstdc++
One of the following packages is needed:
1- libstdc++6-4.1.2-1mdv2007.1.i586: GNU C++ library (to upgrade)
2- libstdc++5-3.3.6-3mdk.i586: GNU C++ library (to upgrade)
3- libstdc++2.10-2.96-0.83mdk.i586: GNU C++ library (to upgrade)
What is your choice? (1-3) 2
Packages libstdc++5-3.3.6-3mdk.i586, libstdc++6-4.1.2-1mdv2007.1.i586, libstdc++2.10-2.96-0.83mdk.i586 are already installed
Packages libstdc++5-3.3.6-3mdk.i586, libstdc++2.10-2.96-0.83mdk.i586 can not be installed[/quote]

[quote]pa mozda je problem sto sam za
PREFIX=/home/muamer/Documents/programi/mingw32
stavio pogresnu putanju. Nisam bio siguran sta znaci[/quote]
Pa to sam pretpostavljao :wink: ali ti nisam mogao reći ispravnu putanju a da sam ne instaliram isti taj mingw.

[quote]imam jos samo jedan error koji se odnosi
na libstdc+±v3[/quote]
Taj error se ne odnosi na libstdc++ na tvom sistemu (naravno da ga već imaš, koristi ga npr. KDE) nego na onaj koji je dio tvog crosscompiler stabla. Ne znam šta je fixincl i kako bi ga instalirao, ali mi je interesantnija ova poruka:

[quote]./mingw32: …/mingw-runtime-3.10/config.guess: /bin/sh^M: bad interpreter: No such file or directory
./mingw32: …/mingw-runtime-3.10/configure: /bin/sh^M: bad interpreter: No such file or directory[/quote]
Izgleda da ti ovi fajlovi nisu ispravno konvertovani (dos2unix). Pa pogledaj još fajlova u ovom direktoriju, da li imaju nekakve ^M znakove.

[quote]Taj error se ne odnosi na libstdc++ na tvom sistemu (naravno da ga već imaš, koristi ga npr. KDE) nego na onaj koji je dio tvog crosscompiler stabla. Ne znam šta je fixincl i kako bi ga instalirao, ali mi je interesantnija ova poruka:

./mingw32: ../mingw-runtime-3.10/config.guess: /bin/sh^M: bad interpreter: No such file or directory
./mingw32: ../mingw-runtime-3.10/configure: /bin/sh^M: bad interpreter: No such file or directory

Izgleda da ti ovi fajlovi nisu ispravno konvertovani (dos2unix). Pa pogledaj još fajlova u ovom direktoriju, da li imaju nekakve ^M znakove.[/quote]
Problem je u tome sto je bilo gresaka u skripti. Posto je skripta bila copy/paste neke stvari su se pogresno kopirale.

Uglavnom rijesio sam problem sa novom skriptom:
http://muamer0.googlepages.com/mingw32-install.sh
skripta ce sama download-ovati:

* binutils * gcc-core * gcc-g++ * gdc * mingw-runtime * w32api
Meni je na Mandrivi 2007.1 falilo jos par programa potrebnih za ovu instalaciju, pa sam morao doinstalirati:

*texinfo (urpmi) *dos2unix (urpmi) * flex (urpmi) *bison (urpmi) *binutilis-debug zbog libiberty paketa *
I sada bez problema radi compile

I jos samo jedno pitanje: Da li je moguce kompajlirati fltk aplikacije sa ovim mingw32?
Ja sam pokusao:

i dobijem objektni file, e sada kako da dobijem izvrsni .exe file.
Kada uradim:

dobijem poruku:

[quote]/opt/mingw/lib/gcc/i686-pc-mingw32/3.4.5/…/…/…/…/i686-pc-mingw32/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status[/quote]
Vedrane hvala puno na pomoci !

Cool :slight_smile: crosscompiling me je vazda fascinirao…

Ja bih rekompajlirao fltk uz opciju --without-x

[quote][root@localhost fltk-2.0.x-r5941]# ./configure --without-x
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking for g++… g++
checking whether we are using the GNU C++ compiler… yes
checking whether g++ accepts -g… yes
checking for nroff… /usr/bin/nroff
checking for htmldoc… no
checking for ranlib… ranlib
checking for ar… /usr/bin/ar
checking how to run the C preprocessor… gcc -E
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /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 whether byte ordering is bigendian… no
checking for short… yes
checking size of short… 2
checking for int… yes
checking size of int… 4
checking for long… yes
checking size of long… 4
checking whether the compiler recognizes bool as a built-in type… yes
checking for dirent.h that defines DIR… yes
checking for library containing opendir… none required
checking sys/select.h usability… yes
checking sys/select.h presence… yes
checking for sys/select.h… yes
checking sys/stdtypes.h usability… no
checking sys/stdtypes.h presence… no
checking for sys/stdtypes.h… no
checking for scandir… yes
checking for string.h… (cached) yes
checking for strings.h… (cached) yes
checking for snprintf… yes
checking for vsnprintf… yes
checking for strcasecmp… yes
checking for strdup… yes
checking for strncasecmp… yes
checking for strlcat… no
checking for strlcpy… no
checking for library containing pow… -lm
checking jpeglib.h usability… yes
checking jpeglib.h presence… yes
checking for jpeglib.h… yes
checking for jpeg_destroy_decompress in -ljpeg… yes
checking zlib.h usability… yes
checking zlib.h presence… yes
checking for zlib.h… yes
checking for gzopen in -lz… yes
checking png.h usability… yes
checking png.h presence… yes
checking for png.h… yes
checking libpng/png.h usability… no
checking libpng/png.h presence… no
checking for libpng/png.h… no
checking for png_read_rows in -lpng… yes
checking for png_get_valid… yes
checking for png_set_tRNS_to_alpha… yes
checking pthread.h usability… yes
checking pthread.h presence… yes
checking for pthread.h… yes
checking for pthread_create in -lpthread… yes
checking for X… disabled
configure: error: Configure could not find required X11 libraries
./configure: line 10276: exit: aborting.: numeric argument required
./configure: line 10276: exit: aborting.: numeric argument required[/quote]
Ili nesto radim pogresno ili se ne moze rekompajlirati.

Sanele imaš li ti ideju? Izgleda kao bug u configure skripti…

Pokusao sam ponovo nesto cackati oko ovog fltk2 cross … Nije jedini problem u -lX11, ne moze da prepozna niti jedan od --ldflags osim -lfltk2. Svaki naredni koji je naveden iza -lfltk2 prijavljuje gresku.

i686-pc-mingw32-gcc -o file.exe callbacks.o -L/usr/local/lib -lfltk2 -lXinerama -lXft -lpthread -lm -lXext -lsupc++ -lX11 -lXi /opt/mingw/lib/gcc/i686-pc-mingw32/3.4.5/../../../../i686-pc-mingw32/bin/ld: cannot find -lXinerama collect2: ld returned 1 exit status
ili ako iza -lfltk2 navedem -lpthread

i686-pc-mingw32-gcc -o file.exe callbacks.o -L/usr/local/lib -lfltk2 -lpthread -lXi -lXinerama -lXft -lpthread -lm -lXext -lsupc++ -lX11 /opt/mingw/lib/gcc/i686-pc-mingw32/3.4.5/../../../../i686-pc-mingw32/bin/ld: cannot find -lpthread collect2: ld returned 1 exit status
Nisam siguran da ovo poboljšava situaciju :).

Dok sam pokusavao rijesiti ovaj problem procitao sam da se ovakve greske javljaju zbog problema sa putanjom. U mom slucaju da bi uopste koristio naredbu [quote]i686-pc-mingw32-[/quote]
moram uraditi prvo [quote]export PATH=$PATH:/opt/mingw/bin/[/quote]
tek tada se naredba moze pozvati.