.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   compile GNU/Linux binaries in Windows (http://forums.bots-united.com/showthread.php?t=3626)

Whistler 21-02-2005 02:41

compile GNU/Linux binaries in Windows
 
... It's just possible, this is what you need :)
http://filebase.bots-united.com/inde...on=file&id=278

It's actually just a mere build of the MinGW source code with some extra configs, as MinGW and GNU/Linux version of gcc are actually the same code.

koraX 21-02-2005 08:37

Re: compile GNU/Linux binaries in Windows
 
binaries can be compiled ?
what is this program doing ?
Does it compile source code ? If so, does it have support for SUSv3 or LSBSv2.01 under windows ?

Whistler 21-02-2005 11:27

Re: compile GNU/Linux binaries in Windows
 
it's just a GCC built under Windows in this way:
./configure --prefix=c:/gcc-gnulinux --target=i686-pc-linux-gnu
make
make install

Actually MinGW and *NIX gcc are the same code, this just enabled the GNU/Linux compiling instead of default MinGW Windows compiling. It should compile the same as GNU/Linux, but perhaps you need some extra libraries to compile something other than bots.

Pierre-Marie Baty 21-02-2005 15:05

Re: compile GNU/Linux binaries in Windows
 
Can it do cross-compiles? I'd be interested in compiling native Linux binaries for my metamod stuff without needing to upload my sources each time on the BU server.

sPlOrYgOn 21-02-2005 18:29

Re: compile GNU/Linux binaries in Windows
 
I just tried it with pbmm but it seems to create a .so file twice the size of when it is compiled on linux and also gets a badf load...:(
can i compile on the BU server too?

Pierre-Marie Baty 21-02-2005 19:55

Re: compile GNU/Linux binaries in Windows
 
Anybody who has a shell account on the BU machine can compile his plugins... but I think you don't have one yet because you don't have any website for your bot. One more reason to change that :)

Whistler 22-02-2005 01:40

Re: compile GNU/Linux binaries in Windows
 
well I've found the problem... try NOT to use "-march" parameter (like -march=i586 or so) and use "_i386.so" as the end of the filename and it should work in Metamod

also note that "gcc" is the C compiler, and "g++" is the c++ compiler so make sure you are compiling C++ code with "g++" command.

but the file size is still big, as it's totally staticly linked.

Whistler 22-02-2005 05:22

Re: compile GNU/Linux binaries in Windows
 
well you also need to use the "-static" parameter...

here's the work Makefile
PHP Code:

CPP g++
TARGET podbot_mm
BASEFLAGS 
= -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp
OPTFLAGS 
= -DNDEBUG
CPPFLAGS 
= ${BASEFLAGS} ${OPTFLAGS} -O2 --I"../metamod-1.17/metamod" -I"../hlsdk/multiplayer/common" -I"../hlsdk/multiplayer/dlls" -I"../hlsdk/multiplayer/engine" -I"../hlsdk/multiplayer/pm_shared"

OBJ =     bot.\
    
bot_chat.\
    
bot_client.\
    
bot_combat.\
    
bot_globals.\
    
bot_sounds.\
    
compress.\
    
dll.\
    
engine.\
    
util.\
    
waypoint.o

${TARGET}_i386.so: ${OBJ}
    ${
CPP} -fPIC -shared -static -$@ ${OBJ} -ldl -lm

clean
:
    
rm -*.o
    rm 
-*.map

%.o:    %.cpp
    
${CPP} ${CPPFLAGS} -$< -$@

%.
o:    %.c
    
${CPP} ${CPPFLAGS} -$< -$@ 

looks like it's still far from being perfect :(

KaCaT 22-02-2005 08:07

Re: compile GNU/Linux binaries in Windows
 
Works fine, thanks! :)

btw, I've just found another similiar way to compile win32 binaries from linux 8D:
http://www.wxwidgets.org/technote/crosscmp.htm

Pierre-Marie Baty 22-02-2005 14:30

Re: compile GNU/Linux binaries in Windows
 
Yes, and I believe that's what Will Day does with metamod, he compiles everything on GNU/Linuts :)


All times are GMT +2. The time now is 01:15.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.