Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

vaultmp - Compiling in Code Blocks #141

Open
Langerz82 opened this issue Jun 5, 2017 · 50 comments
Open

vaultmp - Compiling in Code Blocks #141

Langerz82 opened this issue Jun 5, 2017 · 50 comments

Comments

@Langerz82
Copy link

Hello,

I'm receiving the following error wondering if you have any idea how to fix.

See:
image

@foxtacles
Copy link
Owner

This happens if the C++ standard library that comes with your MinGW does not include thread support. Check this answer:

https://stackoverflow.com/a/17986785

I also mentioned it in the instructions: https://github.com/foxtacles/vaultmp#compilation

@Langerz82
Copy link
Author

Thanks I fixed the error, will let you know how it goes.

@Langerz82
Copy link
Author

Hello,
These are the new errors I'm getting:
image

@Langerz82
Copy link
Author

I've sorted out the threading issues, turns out I wasnt using POSIX threads in my MinGW.

Now I can compile as far as this:
image

@foxtacles
Copy link
Owner

which GCC version are you using? probably something changed in a newer version, leading to issues like that. maybe you can get a mingw64 including GCC 4.9 - otherwise the current code would probably need to be adjusted (not sure how much effort this would be, I have no mingw setup to try atm)

@Langerz82
Copy link
Author

Langerz82 commented Jun 5, 2017

Ok I dowloaded and used GCC 5.4 as thats the closest I could find. It's throwing these errors:

image

Looks like it's compiling in 64-bit mode, any ideas?

@Langerz82
Copy link
Author

I changed the makefile to run the 32-bit g++ and Ive resolved the previous issue. Let you know how it goes.

@Langerz82
Copy link
Author

Hey Chris I'm having trouble with the ini parser I compiled it in linux then copied the files .a and .so.0 files into MinGW's 32-bit lib folder but its not linking either by using -liniiparser or -l:libiniparser.a . How can I compile it under Codeblocks and MinGW? Setting up a standard static library did not work.

@foxtacles
Copy link
Owner

foxtacles commented Jun 6, 2017

https://github.com/foxtacles/vaultmp/tree/master/source/lib there are C::B project files and makefiles for iniparser and time libraries, did you try them to compile them on Windows?

@Langerz82
Copy link
Author

Hey, I needed to create my own makefile for the ini parser which I based off the raknet makefile.
Am I missing any flags? I checked verbose linking and it says that it skipped it because it was incompatible and hence the library not being found.
Here is the adjusted makefile for windows:
https://gist.github.com/Langerz82/8bb5037b54b9cf6a09efb277adb4bfb0

@foxtacles
Copy link
Owner

https://github.com/foxtacles/vaultmp/blob/master/source/lib/iniparser_makefile.windows this one didn't work?

maybe you are missing -m32 in the CC var

@Langerz82
Copy link
Author

It still does not get loaded when linking, both with and without -m32, any ideas?

@Langerz82
Copy link
Author

Langerz82 commented Jun 7, 2017

Think I know the issue. The command is running 64-bit ld.exe as shown here:
D:/Program Files/mingw-w64/x86_64-5.4.0-release-posix-sjlj-rt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible D:/Program Files/mingw-w64/x86_64-5.4.0-release-posix-sjlj-rt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/../../..\libiniparser.a when searching for -l:libiniparser.a
Just gotta find a 32-bit ld.exe

@Langerz82
Copy link
Author

Its finding the libraries yet it keeps searching and throws errors as if it can't find them. I'm stuck on this:

image

@Langerz82
Copy link
Author

Managed to find the Raknet library by removing the -m32 flags when compiling. Now I got the following errors with stack_trace.

image

@foxtacles
Copy link
Owner

hmm, strange. are you re-compiled all parts after you changed the compiler version? alternatively you can try the Release build which does not require stack trace

@Langerz82
Copy link
Author

it cannot find libbfd.a as its skipping incompatible. So I'm guessing its not a proper 32-bit version.

@Langerz82
Copy link
Author

I'm getting the following errors when compiling the time module. Could it be because it needs x86_64-w64-mingw32-g++.exe to compile? I dont see in the Makefile where to rename the g++.exe

image

@foxtacles
Copy link
Owner

@Langerz82
Copy link
Author

Says no rule to make target.

image

@foxtacles
Copy link
Owner

I believe the makefile is in the wrong location, it uses relative pathes inside

make sure that the containing folder of the makefile + time\time64.c is a valid path to the source file. or adjust the pathes inside the makefile

@Langerz82
Copy link
Author

Fixed the paths now I'm getting 64-bit related errors even though it uses a 64-bit compiler.

image

@Langerz82
Copy link
Author

Langerz82 commented Jun 8, 2017

Parsed in -std=c99 now the only warnings that appear are here:
image
Should I be concerned about them?

@foxtacles
Copy link
Owner

hmm yep that's an issue. gmtime_r and localtime_r are functions that should be called (not declared), they should be in time.h which should be included. not sure why it can't recognize them

@Langerz82
Copy link
Author

Trying to include the time.h header and includes doesn't help. Have I include the arguments in the right section?
image

https://gist.github.com/Langerz82/a61b759dc494f7f40c10404dba1c6d45

@foxtacles
Copy link
Owner

are you sure that you checked out the correct git submodule commit? compare this file with yours:

https://github.com/foxtacles/y2038/blob/a05feb76f1a204a016a7e023a365ac71677cc558/time64_config.h#L44

@Langerz82
Copy link
Author

I commented out all 3 and it compiles ok.
/* #define HAS_GMTIME_R /
/
#define HAS_LOCALTIME_R /
/
#define HAS_TIMEGM */

@Langerz82
Copy link
Author

These are the errors I'm receiving when linking vaultmp.exe:

image

@Langerz82
Copy link
Author

I was using ld.exe instead of g++ to link the libraries. Now I have only the following errors. It seems the iniparser cant be linked but I'm not sure why.

image

@foxtacles
Copy link
Owner

I think you also didn't check out the proper submodule commit in this case. just checking out the iniparser repository won't do, the submodule points to a specific commit (which contains slight changes to make the library work with vaultmp):

https://github.com/foxtacles/vaultmp/tree/master/source/lib

it says iniparser @ ce75430 if you click on it, it goes to the commit that needs to be checked out. take that state, re-compile the iniparser library and it should work

@Langerz82
Copy link
Author

Langerz82 commented Jun 12, 2017

Here are the MAKEFILE and linking errors:
image
image

I am pretty sure I am using the right iniparser commit.
Should I be using the C++ iniparser branch? Im using master atm.

@foxtacles
Copy link
Owner

can you compare your iniparser.h and verify it contains:

foxtacles/iniparser@ce75430

@foxtacles
Copy link
Owner

if you were using master branch, you were not using the right commit - it is specified by the submodule. in this case it is indeed the cplusplus branch

@Langerz82
Copy link
Author

Many thanks its compiling now. I get version mismatch because I'm using 1.7.0.3 How do I obtain the new hash?

@Langerz82
Copy link
Author

How do I compile vaultmpd.exe? Many thanks for helping me thus far. I hope to contribute quite a bit once I've figured out how to do a basic compile.

@foxtacles
Copy link
Owner

I'd ignore the hashing for now (you can comment it out in the code). That was just a simple mechanism used for released builds.

vaultmpd.exe is the produced executable of vaultmp when you use the Debug target of the makefile

@Langerz82
Copy link
Author

Langerz82 commented Jun 14, 2017

I'm getting an access violation error when running vaultmpd.exe.

Here is my makefile:
https://gist.github.com/Langerz82/1abf83ad5f4ae521777394c5cdebe48b

edit:
Sorry it was my code that was causing the access violation error.

@Langerz82
Copy link
Author

Langerz82 commented Jun 14, 2017

I am getting this when trying to compile the Game Server. Any ideas?

image

Here is my makefile:
https://gist.github.com/Langerz82/3457bed5a880febe7633bdac12792656

@Langerz82
Copy link
Author

It's a problem with timer not being compiled with the -m64 option. However the main Game Server is compiled with -m32 any ideas?

@Langerz82
Copy link
Author

I cant seem to compile time into a 64-bit library. Here is my makefile:

time Makefile

CC = gcc.exe
AR = ar.exe
CFLAGS = -O2 -fPIC -W -Wall -ansi -pedantic -Wextra -Wdeclaration-after-statement -Wendif-labels -Wconversion -Wcast-qual -Wwrite-strings -fno-leading-underscore -std=c99 -m32 -march=i686

INCLUDE = -I"D:\Program Files\mingw-w64\x86_64-4.9.1-release-posix-sjlj\mingw64\include"
SHLD = ${CC} ${CFLAGS} $(INCLUDE)
LDSHFLAGS =
LDFLAGS = -L"D:\Program Files\mingw-w64\x86_64-4.9.1-release-posix-sjlj\mingw64\lib"

RM = cmd /c del /f

COMPILE.c=$(CC) $(INCLUDE) $(LDFLAGS) $(CFLAGS) -c
.c.o:
$(COMPILE.c) -o $@ $<

SRCS = time64.c

OBJS = $(SRCS:.c=.o)

default: libtime64.a

libtime64.a: $(OBJS)
$(AR) -rv libtime64.a $(OBJS)

clean:
$(RM) $(OBJS)

@foxtacles
Copy link
Owner

I think it should all be compiled as 32bit (including all libraries). The -m32 flag should be included everywhere. The error you get (on your last screenshot, undefined reference) indicates that it can't find the functions in the time library, which is most likely because the library has not been compiled with the extern "C" declaration in its time64.h file.

Are you sure that you compiled and are linking the correct version of the library everywhere?

This goes for ALL submodules that were used in the repository. If you don't properly set up the submodules, you will not get the right code version of the repositories and it leads to all sorts of issues. For instance if you just clone the respective repositories - it is not the same as initializing the submodules and it causes errors like this.

@Langerz82
Copy link
Author

@fox many thanks for clearing that up for me, I think I got it now.

@Langerz82
Copy link
Author

Compiled the GameServer but when executing I get the following error and no additional debug info.

image

@foxtacles
Copy link
Owner

foxtacles commented Jun 20, 2017

you should be getting some debug info if you compile the Debug version of it (and you need to have this file https://github.com/foxtacles/vaultmp/blob/master/source/deps/exchndl.dll in the same folder as the executable then). it should dump a stack trace in a text file

@Langerz82
Copy link
Author

Have you got the windows makefile for the vaultscript.dll ?

@foxtacles
Copy link
Owner

there is no makefile for that, just a C::B project file: https://github.com/foxtacles/vaultmp/blob/master/source/vaultscript/vaultscript.cbp

@Langerz82
Copy link
Author

Langerz82 commented Jun 23, 2017

Managed to compile the vaultscript.dll ran vaultserver but still the same error without any stack trace.

Is there a specific C++ Redistributal or .NET framework I am missing? I have 4.5,4.6,4.7

@Langerz82 Langerz82 reopened this Jun 23, 2017
@Langerz82
Copy link
Author

Tried to rebuild everything still same error. Tried opening it in OllyDBG but the callstack give me no useful info. Did you compile everything in windows?

@Langerz82
Copy link
Author

I used a dependency walker and it was showing that the executable is trying to load x64 version of win threads.
image

@Langerz82
Copy link
Author

I managed to resolve the x64 library conflicts. Now I'm getting this error:

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants