.:: 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)

The Storm 22-02-2005 17:02

Re: compile GNU/Linux binaries in Windows
 
Can someone explain me how to compile with this EPB. It will be good to have a linux version.

sfx1999 22-02-2005 17:12

Re: compile GNU/Linux binaries in Windows
 
So, how do I cross compile for the PDP-11? :P

Whistler 23-02-2005 03:17

Re: compile GNU/Linux binaries in Windows
 
"Can someone explain me how to compile with this EPB. It will be good to have a linux version."
just create a file named "Makefile" in your source directory, like this one:
PHP Code:

 CPP g++
TARGET epb
BASEFLAGS 
= -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp
OPTFLAGS 
= -DNDEBUG
CPPFLAGS 
= ${BASEFLAGS} ${OPTFLAGS} -O2 --I"./hlsdk"

OBJ =     bot.o
    bot_chat
.o
    bot_client
.o
    bot_combat
.o
    bot_globals
.o
    bot_sounds
.o
    compress
.o
    dll
.o
    engine
.o
    util
.o
    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} -$< -$@ 

(note that you MUST have a backslash after each ".o" file; the forum has bugs which ate up all backslashes)

write all your .cpp files in the list, change all .cpp to .o.

Then install the compiler, start a DOS prompt, run the setvars.bat file first and change into your source dir. Then run "make" and it should produce a epb_i386.so file and that's it.

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

Re: compile GNU/Linux binaries in Windows
 
Quote:

Originally Posted by Whistler
(note that you MUST have a backslash after each ".o" file; the forum has bugs which ate up all backslashes)

I wonder what it would be like with the [ code ] tags instead...
Code:

CPP = g++
TARGET = epb
BASEFLAGS = -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp
OPTFLAGS = -DNDEBUG
CPPFLAGS = ${BASEFLAGS} ${OPTFLAGS} -O2 -w -I"./hlsdk"
 
OBJ =        bot.o \\
        bot_chat.o \\
        bot_client.o \\
        bot_combat.o \\
        bot_globals.o \\
        bot_sounds.o \\
        compress.o \\
        dll.o \\
        engine.o \\
        util.o \\
        waypoint.o
 
${TARGET}_i386.so: ${OBJ}
        ${CPP} -fPIC -shared -static -o $@ ${OBJ} -ldl -lm
 
clean:
        rm -f *.o
        rm -f *.map
 
%.o:        %.cpp
        ${CPP} ${CPPFLAGS} -c $< -o $@
 
%.o:        %.c
        ${CPP} ${CPPFLAGS} -c $< -o $@

*edit* damn, yer right.
I'd better look into that someday.

The Storm 23-02-2005 16:27

Re: compile GNU/Linux binaries in Windows
 
It's not working :
here is the error messege:
make : <e=2>:
make : *** [EPB_i386.so] Error 2

Whistler 24-02-2005 01:25

Re: compile GNU/Linux binaries in Windows
 
in which step this error happened? would you post the full output?

(also you need to add the log.o to the list in Makefile if you haven't deleted it, and if you've created new files you need to add them as well)

The Storm 24-02-2005 22:23

Re: compile GNU/Linux binaries in Windows
 
Here :

dll.cpp:20: error: expected `>` before '*' token
dll.cpp:20: error: expected `,` or `;` before '*' token
dll.cpp:22: error: expected `>` before '*' token
dll.cpp:22: error: expected `,` or `;` before '*' token
dll.cpp:29: error: `GETNEWDLLFUNCTIONS` does not name a type
make: *** [dll.o] Error 1

The strange is that when I compile it with MSVC there is no problem.

Whistler 25-02-2005 01:29

Re: compile GNU/Linux binaries in Windows
 
then it's bacause something GNU/Linux specific is missing in the code... you gotta fix it first
search for "__linux__" in HPB bot and you'll see what's required

edit: I think this is the problem:
PHP Code:

// stuff for Win32 vs. Linux builds

#ifndef __linux__

typedef int (FAR *GETENTITYAPI)(DLL_FUNCTIONS *, int);
typedef int (FAR *GETNEWDLLFUNCTIONS)(NEW_DLL_FUNCTIONS *, int *);
typedef void (DLLEXPORT *GIVEFNPTRSTODLL)(enginefuncs_t *, globalvars_t *);
typedef void (FAR *LINK_ENTITY_FUNC)(entvars_t *);

#else

#include <dlfcn.h>
#define GetProcAddress dlsym

typedef int BOOL;

typedef int (*GETENTITYAPI)(DLL_FUNCTIONS *, int);
typedef int (*GETNEWDLLFUNCTIONS)(NEW_DLL_FUNCTIONS *, int *);
typedef void (*GIVEFNPTRSTODLL)(enginefuncs_t *, globalvars_t *);
typedef void (*LINK_ENTITY_FUNC)(entvars_t *);

#endif 

and it seems that in POD-Bot the GETNEWDLLFUNCTIONS isn't declared after the #else.

The Storm 26-02-2005 09:50

Re: compile GNU/Linux binaries in Windows
 
Thanks you Whistler. You was write ! The problem was in bot.h.
Now I succseful compile EPB for Linux. With the next release I will publish and the Linux version of EPB.
Thnaks you again.

EDIT : Did I must publish the source code of EPB if I publish a Linux version ?

Whistler 27-02-2005 02:29

Re: compile GNU/Linux binaries in Windows
 
"Did I must publish the source code of EPB if I publish a Linux version ?"
Nope, as you are just *USING* gcc, which is totally free and not restricted :)
perhaps you can read through the GPL to see in which case you need to release the sources.


All times are GMT +2. The time now is 12:17.

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