Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portability #29

Open
mmiszczyk opened this issue Jul 24, 2019 · 17 comments
Open

Portability #29

mmiszczyk opened this issue Jul 24, 2019 · 17 comments

Comments

@mmiszczyk
Copy link

Is your feature request related to a problem? Please describe.
According to the website, one of the stated goals of the project is the possibilty to port Death Rally to other platforms. However, current codebase is strongly coupled with Windows/Visual Studio/MSVC environment.

Describe the solution you'd like
There are several issues which prevent us from being able to compile DreeRally for e.g. Linux. The most obvious one is Windows-specific C functions and headers. They should be identified and replaced with SDL equivalents (if graphics/windowing/GUI related) or with ISO C equivalents (if related to things like e.g. file access). If all else fails, we can use #ifdef macros.

Less obvious issues are non-standard language elements (e.g. I'm pretty sure that some of the #pragmas are MSVC specific and won't work with gcc or clang) and build process. I think that pragmas are mostly used to suppress warnings, which I think is something we could live without. As for build process, it seems simple enough - shouldn't be too hard to make an equivalent Makefile.

Describe alternatives you've considered
Running in Wine, I guess? But I think source portability would be preferable.

Additional context
N/A

@neuromancer
Copy link
Contributor

Related with #17 . Also, I saw a branch with cmake support, was it deleted or merged @enriquesomolinos ?

@enriquesomolinos
Copy link
Owner

Yes, this is one of the main golas of the project. I try to create a stable window version in this months to start this task later.

@neuromancer
Copy link
Contributor

@enriquesomolinos it seems you are trying to fix travis to build the portability branch. Do you need some help with that?

@enriquesomolinos
Copy link
Owner

yes, help will be appreciated. In my locla computer dreerally compiles fine, but in travis libraries are not well recognized

@neuromancer
Copy link
Contributor

I'm taking a look to this issue again..

@enriquesomolinos
Copy link
Owner

Thanks for the contribution neuromancer, the code compiles fine 👍 . Now i need to solve some problems in order to have a functional executable under linux.

@neuromancer
Copy link
Contributor

It fails to run here:

$ LD_LIBRARY_PATH=. gdb --quiet --args ./dreerally.exe 
Reading symbols from ./dreerally.exe...done.
(gdb) r
Starting program: /home/g/Games/DreeRally/dreerally.exe 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
free(): invalid next size (normal)

Program received signal SIGABRT, Aborted.
0xf7fd5059 in __kernel_vsyscall ()
(gdb) bt
#0  0xf7fd5059 in __kernel_vsyscall ()
#1  0xf7b53832 in raise () from /lib/i386-linux-gnu/libc.so.6
#2  0xf7b54cc1 in abort () from /lib/i386-linux-gnu/libc.so.6
#3  0xf7b95bd3 in ?? () from /lib/i386-linux-gnu/libc.so.6
#4  0xf7b9c7ed in ?? () from /lib/i386-linux-gnu/libc.so.6
#5  0xf7b9e15b in ?? () from /lib/i386-linux-gnu/libc.so.6
#6  0xf77d79f7 in _XFreeDisplayStructure () from /usr/lib/i386-linux-gnu/libX11.so.6
#7  0xf77c481c in XCloseDisplay () from /usr/lib/i386-linux-gnu/libX11.so.6
#8  0xf7ddad9c in ?? () from /usr/lib/i386-linux-gnu/libSDL-1.2.so.0
#9  0xf7dcd351 in SDL_VideoInit () from /usr/lib/i386-linux-gnu/libSDL-1.2.so.0
#10 0xf7da4268 in SDL_InitSubSystem () from /usr/lib/i386-linux-gnu/libSDL-1.2.so.0
#11 0x565bc213 in inicializeScreen (a1=3.75) at dr.c:34658
#12 0x565b9848 in sub_43ACE0 (a1=3.75, a2=1, a3=-11996, args=0x56b11910 "/home/g/Games/DreeRally/home\301\004") at dr.c:32972
#13 0x565bef9d in initSystem (fmodMinVersion=3.75, a1=1, a2=0xffffd124, args=0x56b11910 "/home/g/Games/DreeRally/home\301\004") at dr.c:35899
#14 0x565bf140 in main (argc=1, argv=0xffffd214) at dr.c:35968

@neuromancer
Copy link
Contributor

@enriquesomolinos I tested the latest revision of the feature-portability branch (which is in a PR right now), and I'm getting this error:

$ LD_LIBRARY_PATH=. gdb --args ./dreerally 
..
Reading symbols from ./dreerally...
(gdb) r

Loading music & effects, please wait..
double free or corruption (!prev)

Program received signal SIGABRT, Aborted.
0xf7fd2b29 in __kernel_vsyscall ()
(gdb) bt
#0  0xf7fd2b29 in __kernel_vsyscall ()
#1  0xf78fab06 in raise () from /usr/lib32/libc.so.6
#2  0xf78e33f5 in abort () from /usr/lib32/libc.so.6
#3  0xf793ef3c in __libc_message () from /usr/lib32/libc.so.6
#4  0xf79471dd in malloc_printerr () from /usr/lib32/libc.so.6
#5  0xf7948eff in _int_free () from /usr/lib32/libc.so.6
#6  0x56591793 in decryptAnimFrame () at dr.c:17287
#7  0x56591bed in openAnimation (animFile=0x565c8479 "SANIM.haf", a2=1, 
    music=1448903823, a4=2, effect=1448903811, onKeyPressExit=1 '\001', 
    screenResolution=120 'x') at dr.c:17446
#8  0x565a0a3e in checkAndOpenAnimation () at dr.c:23532
#9  0x565b3b1a in mainMenu () at dr.c:32549
#10 0x565b4289 in sub_43ACE0 (a1=3.75, a2=1, a3=-10308, args=0x56b11300 "")
    at dr.c:32997
#11 0x565b89e6 in initSystem (fmodMinVersion=3.75, a1=1, a2=0xffffd7bc, 
    args=0x56b11300 "") at dr.c:35933
#12 0x565b8b32 in main (argc=1, argv=0xffffd8a4) at dr.c:36003

Just to clarify, I'm using the official Death Rally data files.

@enriquesomolinos
Copy link
Owner

you right, try to remove the video files (*.haf files)

In linux there is a lot of errors.

@neuromancer
Copy link
Contributor

neuromancer commented Nov 23, 2019

It works! 🎉 (however there is no keyboard input).

Keep up the great work!

@enriquesomolinos
Copy link
Owner

Yes, it has a lot of error, but it is a good start.

@neuromancer
Copy link
Contributor

It seems that the linux version won't compile unless you create the Debug directory.

@enriquesomolinos
Copy link
Owner

Yes, the makefile.linux file tries to create the executable under this directory. In the next release we can change it without problem

@enriquesomolinos
Copy link
Owner

In the branch 0.3.x the problem is resolved.

@cyberbeat
Copy link

I cannot compile under linux:

first problem: the was no -lSDLMain, could be safely removed, I think

But now many other errors:

make -f Makefile.linux
gcc -ggdb -m32 -O0 anim.o cars.o circuit.o config.o dr.o drivers.o graphics.o imageUtil.o menus.o raceParticipant.o raceResults.o savegame.o util.o asset/bpaUtil.o asset/haf.o i18n/i18n.o input/input.o mod/mod.o multiplayer/multiplayer.o popup/popup.o portability/portability.o race/3dSystem.o race/pedestrian.o race/powerup.o sfx/sound.o ui/blackMarketScreen.o ui/creditsScreen.o ui/endGameScreen.o ui/hallOfFame.o ui/licenseScreen.o ui/loadSaveGameScreen.o ui/mainScreen.o ui/menu.o ui/prevRaceScreen.o ui/raceResultsScreen.o ui/selectRaceScreen.o ui/shopScreen.o ui/startGameScreen.o util/hash.o -o dreerally -lstdc++ -lglut -lGLU -lGL -lm -lSDL -lc -lfmod-3.75
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: imageUtil.o:/DreeRally/imageUtil.c:10: multiple definition of choo2Bpk'; dr.o:/DreeRally/dr.c:1059: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: imageUtil.o:/DreeRally/imageUtil.c:12: multiple definition of unk_445928'; anim.o:/DreeRally/anim.c:127: first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: savegame.o:/DreeRally/savegame.c:8: multiple definition of Str'; dr.o:/DreeRally/dr.c:743: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: asset/haf.o:/DreeRally/asset/haf.c:17: multiple definition of DstBuf'; dr.o:/DreeRally/dr.c:1050: first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: popup/popup.o:/DreeRally/popup/popup.c:242: multiple definition of bigLetterSpacing_445848'; imageUtil.o:/DreeRally/imageUtil.c:46: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ui/loadSaveGameScreen.o:/DreeRally/ui/loadSaveGameScreen.c:19: multiple definition of Str'; dr.o:/DreeRally/dr.c:743: first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ui/shopScreen.o:/DreeRally/ui/shopScreen.c:17: multiple definition of unk_444160'; ui/blackMarketScreen.o:/DreeRally/ui/blackMarketScreen.c:19: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ui/shopScreen.o:/DreeRally/ui/shopScreen.c:20: multiple definition of unk_45FDC4'; ui/blackMarketScreen.o:/DreeRally/ui/blackMarketScreen.c:20: first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ui/startGameScreen.o:/DreeRally/ui/startGameScreen.c:11: multiple definition of `textureTemp'; graphics.o:/DreeRally/graphics.c:5: first defined here
collect2: Fehler: ld gab 1 als Ende-Status zurück
make: *** [Makefile.linux:26: dreerally] Fehler 1

@Jpxe
Copy link

Jpxe commented Dec 11, 2021

I tried to compile the latest 0.3 ver today (bb07127) on Linux and I got this error: https://gist.github.com/ToughGuyKunio/606701cbb473293b37b9207b613cf7d6

Is there another branch that is working?

@karjonas
Copy link

karjonas commented May 19, 2023

I managed to get it to compile on Arch Linux. I had to do some minor fixes, see this branch:

https://github.com/karjonas/DreeRally/commits/linuxtest

Sound is disabled, keyboard input is still borked and it crashes randomly so don't expect too much.

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

No branches or pull requests

6 participants