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

Compile error #13

Closed
VonKossa opened this issue Jan 16, 2019 · 19 comments
Closed

Compile error #13

VonKossa opened this issue Jan 16, 2019 · 19 comments
Labels
enhancement New feature or request

Comments

@VonKossa
Copy link

When compiling devilutionX i get the following "undefined reference to" messages and then it fails the compilation.

[ 52%] Linking CXX executable devil-sanitize
CMakeFiles/devil-sanitize.dir/Stub/sound.cpp.o: In function snd_init(void*)': sound.cpp:(.text+0x11c): undefined reference to Mix_AllocateChannels'
sound.cpp:(.text+0x186): undefined reference to Mix_OpenAudio' CMakeFiles/devil-sanitize.dir/Stub/sound.cpp.o: In function music_start(int)':
sound.cpp:(.text+0x6bf): undefined reference to Mix_LoadMUS_RW' sound.cpp:(.text+0x719): undefined reference to Mix_PlayMusic'
CMakeFiles/devil-sanitize.dir/Stub/sound.cpp.o: In function LoadAndPlaySound(char*, int, int)': sound.cpp:(.text+0xad9): undefined reference to Mix_LoadWAV_RW'
sound.cpp:(.text+0xb34): undefined reference to Mix_PlayChannelTimed' CMakeFiles/devil-sanitize.dir/Stub/sound.cpp.o: In function music_stop()':
sound.cpp:(.text+0xca1): undefined reference to Mix_HaltMusic' sound.cpp:(.text+0xcc9): undefined reference to Mix_HaltChannel'
CMakeFiles/devil-sanitize.dir/Stub/sound.cpp.o: In function snd_play_snd(TSnd*, int, int)': sound.cpp:(.text+0xdab): undefined reference to Mix_PlayChannelTimed'
CMakeFiles/devil-sanitize.dir/Stub/sound.cpp.o: In function snd_stop_snd(TSnd*)': sound.cpp:(.text+0xe0c): undefined reference to Mix_HaltMusic'
CMakeFiles/devil-sanitize.dir/Stub/sound.cpp.o: In function sound_file_load(char*)': sound.cpp:(.text+0x117a): undefined reference to Mix_LoadWAV_RW'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/devil-sanitize.dir/build.make:2463: devil-sanitize] Error 1
make[1]: *** [CMakeFiles/Makefile2:106: CMakeFiles/devil-sanitize.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

@AJenbo
Copy link
Member

AJenbo commented Jan 18, 2019

This is caused by the linker not finding SDL_mixer, it seams to happen when compiling on a 64bit platform, probably all it needs is a parameter to point it in the right direction. The problem appears to be that the way we force the compiler to 32bit causes auto discover in cmake not to work properly. The issue should go away when either compiling on a 32bit installation, or compiling to a 64bit file (however the code is not in a state where this can be done yet).

@ApertureSecurity might be able to provide some info in regards to what environment he is compiling under.
He is currently working on rebasing the code to the latest devilution, this should help significantly in terms of getting closer to be able to compile to a 64bit target.

@AJenbo
Copy link
Member

AJenbo commented Jan 18, 2019

@VonKossa make sure that you have added -lSDL2_mixer to the /usr/lib/i386-linux-gnu/cmake/SDL2/sdl2-config.cmake file.

@ghost
Copy link

ghost commented Jan 18, 2019

Good day and salutations,

I was able to compile this on a clean new system

My history...


   1  apt-get install g++-multilib libc6-dev-i386
    2  apt-get install cmake
    3  apt-get install libsdl2-dev:i386
    4  sudo dpkg --add-architecture i386
    5  sudo apt-get update
    6  vim /etc/resolv.conf 
    7  sudo apt-get update
    8  apt-get install libsdl2-dev:i386
    9  apt-get install libsdl2-mixer-dev:i386
   10  ls
   11  vim usr/lib/i386-linux-gnu/cmake/SDL2/sdl2-config.cmake
   12  history

in file vim usr/lib/i386-linux-gnu/cmake/SDL2/sdl2-config.cmake


# sdl2 cmake project-config input for ./configure scripts

set(prefix "/usr")
set(exec_prefix "${prefix}")
set(libdir "${prefix}/lib/i386-linux-gnu")
set(SDL2_PREFIX "/usr")
set(SDL2_EXEC_PREFIX "/usr")
set(SDL2_LIBDIR "${prefix}/lib/i386-linux-gnu")
set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2")
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR}  -lSDL2 -lSDL2_mixer ")

I had to comment out an include line in the code which is looking for #include <SDL_image.h>

which I will fix now.

@AJenbo
Copy link
Member

AJenbo commented Jan 18, 2019

@ApertureSecurity your history doesn't show you running cmake or make? Do you do that from a GUI tool?

@VonKossa
Copy link
Author

Hi again!
Thanks for the answers.

For the record i am running Gentoo, not a debian or debian like distro.
The location for the sdl2-config.cmake seems to be /usr/lib/cmake/SDL2 for me.
I added -lSDL2_mixer like described and compiled both libsdl2 and sdl2-mixer with x86_32 support.
Same error. :(

@ghost
Copy link

ghost commented Jan 18, 2019

Are you wanting to compile it or do you just want to play?

I can compile it for you. Ideally , I can just release stable branches of the game.

@AJenbo, I ran cmake ..;make from the build folder. That terminal used for vim on sdl cmake.

@VonKossa
Copy link
Author

VonKossa commented Jan 18, 2019

Actually i want to compile it.
i believe my problem is related to x64/x86 somehow.

My sdl2-config.cmake looks different than yours:

set(prefix "/usr")
set(exec_prefix "${prefix}")
set(libdir "/usr/lib64")
set(SDL2_PREFIX "/usr")
set(SDL2_EXEC_PREFIX "/usr")
set(SDL2_LIBDIR "/usr/lib64")
set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2")
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2 -lSDL2_mixer")
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)

@VonKossa
Copy link
Author

VonKossa commented Jan 18, 2019

I solved it.
Of course there was another sdl2-config.cmake under /usr/lib32/cmake/SDL2. lol
Stupid me. :)

@AJenbo
Copy link
Member

AJenbo commented Jan 18, 2019

Hopfully we can get SDL2_mixerfind.cmake working for 32bit builds so that it won't be needed to edit the file :)

@VonKossa
Copy link
Author

It did compile and it did start, but that was about all. The game menu appeared but you are unable to choose anything with the keyboard and if you are lucky you might be able to proceed to the choose character menu if you by luck find the right pixel with the mouse. Then it segfaults. :)
I guess this is the current state right now or am i doing something wrong here?

@ghost
Copy link

ghost commented Jan 19, 2019

Can you launch it in terminal and give me output before it crashes please.

Thank you for this.

@VonKossa
Copy link
Author

sure... just a moment. :)

@VonKossa
Copy link
Author

DUMMY: ShowCursor : 0
DUMMY: FindWindowA : class: DIABLO window: (null)
DUMMY: CreateEventA : DiabloEvent

SND INIT
Opened 8 sound channels

./diabdat.mpq
./Patch_rt.mpq

SND INIT
Opened 8 sound channels

Main Menu Init
Window And Renderer Created!
GpBuffer Created
SIZE OF SCREEN 503808X 287 , Y 138
X 286 , Y 142
X 299 , Y 160
X 311 , Y 170
X 316 , Y 182
X 316 , Y 196
X 316 , Y 203
X 316 , Y 209
X 317 , Y 213
X 318 , Y 221
X 319 , Y 224
X 319 , Y 233
SinglePlayer Diablo
X 318 , Y 247
X 318 , Y 247
X 330 , Y 271
X 457 , Y 437
X 536 , Y 492
X 566 , Y 496
X 628 , Y 529
X 643 , Y 546
X 641 , Y 556
Clicked Create Hero Box

menu3 X641 Y556
X 635 , Y 567

menu3 X635 Y567
X 632 , Y 582

menu3 X632 Y582
X 598 , Y 554

menu3 X598 Y554
X 587 , Y 516

menu3 X587 Y516
X 433 , Y 438

menu3 X433 Y438
X 504 , Y 449

menu3 X504 Y449
X 513 , Y 457

menu3 X513 Y457
X 533 , Y 467

menu3 X533 Y467
X 569 , Y 492

menu3 X569 Y492
X 581 , Y 510

menu3 X581 Y510
X 617 , Y 535

menu3 X617 Y535
X 629 , Y 554

menu3 X629 Y554
X 630 , Y 572

menu3 X630 Y572
X 642 , Y 560

menu3 X642 Y560
X 580 , Y 567

menu3 X580 Y567
X 405 , Y 567

menu3 X405 Y567
X 311 , Y 546

menu3 X311 Y546
X 243 , Y 378

menu3 X243 Y378
X 253 , Y 306

menu3 X253 Y306
X 235 , Y 270

menu3 X235 Y270
X 270 , Y 303

menu3 X270 Y303
X 167 , Y 328

menu3 X167 Y328
X 138 , Y 325

menu3 X138 Y325
X 217 , Y 476

menu3 X217 Y476
X 159 , Y 493

menu3 X159 Y493
X 166 , Y 587

menu3 X166 Y587
X 175 , Y 565

menu3 X175 Y565
X 206 , Y 383

menu3 X206 Y383
X 411 , Y 315

menu3 X411 Y315
X 408 , Y 261

menu3 X408 Y261
X 322 , Y 247

menu3 X322 Y247
X 507 , Y 316

menu3 X507 Y316
X 552 , Y 360

menu3 X552 Y360
X 588 , Y 440

menu3 X588 Y440
X 598 , Y 486

menu3 X598 Y486
X 489 , Y 264

menu3 X489 Y264
X 538 , Y 329

menu3 X538 Y329
X 526 , Y 419

menu3 X526 Y419
X 533 , Y 476

menu3 X533 Y476
X 551 , Y 483

menu3 X551 Y483
X 590 , Y 492

menu3 X590 Y492
X 626 , Y 522

menu3 X626 Y522
X 636 , Y 546

menu3 X636 Y546
X 642 , Y 566

menu3 X642 Y566
X 637 , Y 581

menu3 X637 Y581
X 609 , Y 571

menu3 X609 Y571
X 647 , Y 558

menu3 X647 Y558
X 675 , Y 565

menu3 X675 Y565
X 637 , Y 566

menu3 X637 Y566
X 630 , Y 556

menu3 X630 Y556
X 571 , Y 485

menu3 X571 Y485
X 488 , Y 512

menu3 X488 Y512
X 522 , Y 558

menu3 X522 Y558
X 682 , Y 561

menu3 X682 Y561
Cancel

X 715 , Y 453
X 518 , Y 320
X 378 , Y 223
X 306 , Y 172
X 315 , Y 126
X 456 , Y 108
X 603 , Y 108
X 292 , Y 99
X 263 , Y 219
X 239 , Y 317
X 194 , Y 355
X 356 , Y 450
X 550 , Y 463
X 617 , Y 475
X 595 , Y 503
X 623 , Y 546
X 635 , Y 568
Clicked Create Hero Box

menu3 X635 Y568
X 656 , Y 568

menu3 X656 Y568
X 644 , Y 563

menu3 X644 Y563
X 615 , Y 557

menu3 X615 Y557
X 676 , Y 557

menu3 X676 Y557
Cancel

X 660 , Y 555
X 705 , Y 557
Cancel

X 730 , Y 567
X 762 , Y 552
X 701 , Y 474
X 428 , Y 361
MultiPlayer Diablo
X 415 , Y 267
SinglePlayer Diablo
X 537 , Y 310
X 207 , Y 89
X 234 , Y 118
X 351 , Y 262
X 440 , Y 379
X 114 , Y 359
X 341 , Y 228
X 159 , Y 240
X 405 , Y 187
X 261 , Y 182
X 423 , Y 87
X 368 , Y 92
X 173 , Y 178
X 169 , Y 299
X 306 , Y 443
X 534 , Y 461
X 558 , Y 489
X 586 , Y 506
X 555 , Y 479
X 519 , Y 457
X 498 , Y 438
X 512 , Y 400
X 518 , Y 427
X 524 , Y 457
X 525 , Y 467
X 535 , Y 509
X 701 , Y 541
X 606 , Y 485
X 617 , Y 451
X 577 , Y 491
X 454 , Y 462
X 420 , Y 442
X 522 , Y 438
X 555 , Y 449
X 524 , Y 453
X 515 , Y 453
X 503 , Y 448
X 441 , Y 465
X 403 , Y 393
X 488 , Y 420
X 560 , Y 456
X 501 , Y 454
X 500 , Y 448
X 521 , Y 445
X 434 , Y 388
X 350 , Y 281
X 282 , Y 167
X 199 , Y 360
X 197 , Y 434
X 159 , Y 327
Segmentation fault

@VonKossa
Copy link
Author

well it was hard to find the correct spot to click on, lots of coordinates... . :(

@AJenbo
Copy link
Member

AJenbo commented Jan 19, 2019

Sounds like you might be trying the 64bit branch? The menu is a bit of a work in progress atm, and 64bit crashes as soon as you start the game. The 32bit build should work ok, though the menu is also a bit unfinished.

@VonKossa
Copy link
Author

no actually not but i have also studied your progress in the 64-bit branch, great work!
I did compile the master branch but i think the problem has something to do with the mixed environment iḿ running.
No worries.

@AJenbo
Copy link
Member

AJenbo commented Jan 20, 2019

We are working on merging devilution 0.5 and then also most of the stuff in the 64-bit branch, so things should be more interesting in a weeks time :)
I'm hoping that we can get the 64bit up and running in a months time after that.

@AJenbo
Copy link
Member

AJenbo commented Jan 22, 2019

@VonKossa as you might have notice we have merged the code and things should now be in a better state, though 64bit builds currently only gets you to the loading screen. How ever you can force the compiler to 32bit mode by providing FORCE32=1 before running CMake. Hope that helps.

@VonKossa
Copy link
Author

VonKossa commented Jan 23, 2019

It did not work, the menu works as expected but if i try to start a game i am greeted with the message "out of hash space, aborted"

Thanks for your help anyway. :)

@AJenbo AJenbo added the enhancement New feature or request label Mar 23, 2019
glebm added a commit to glebm/devilutionX that referenced this issue Mar 23, 2021
Single-player difficulty selection was implemented in a very hacky way.

Documents what's going on there and fixes a memory leak.

Memory leaks that this fixes looked like this:

```
Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f435b789f17 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.6+0xb1f17)
    #1 0x5567766c62b8 in dvl::selgame_GameSelection_Select(int) ../SourceX/DiabloUI/selgame.cpp:163
    #2 0x5567766d8ee8 in dvl::selhero_Load_Select(int) ../SourceX/DiabloUI/selhero.cpp:464
    #3 0x5567766d6ed1 in dvl::selhero_List_Select(int) ../SourceX/DiabloUI/selhero.cpp:325
    #4 0x556776692683 in dvl::UiFocusNavigationSelect() ../SourceX/DiabloUI/diabloui.cpp:396
    #5 0x55677669158e in HandleMenuAction ../SourceX/DiabloUI/diabloui.cpp:223
    #6 0x5567766917b9 in dvl::UiFocusNavigation(SDL_Event*) ../SourceX/DiabloUI/diabloui.cpp:277
    #7 0x556776695dff in dvl::UiPollAndRender() ../SourceX/DiabloUI/diabloui.cpp:626
    #8 0x5567766d94ef in UiSelHeroDialog ../SourceX/DiabloUI/selhero.cpp:512
    diasurgical#9 0x5567766d997f in dvl::UiSelHeroSingDialog(int (*)(int (*)(dvl::_uiheroinfo*)), int (*)(dvl::_uiheroinfo*), int (*)(dvl::_uiheroinfo*), void (*)(unsigned int, dvl::_uidefaultstats*), int*, char (*) [16], int*) ../SourceX/DiabloUI/selhero.cpp:547
    diasurgical#10 0x556776a44f45 in mainmenu_select_hero_dialog ../Source/mainmenu.cpp:98
    diasurgical#11 0x5567765f9f15 in SNetInitializeProvider ../SourceX/storm/storm_net.cpp:102
    diasurgical#12 0x556776c996b9 in multi_init_single ../Source/multi.cpp:826
    diasurgical#13 0x556776c98b1e in NetInit ../Source/multi.cpp:770
    diasurgical#14 0x5567767d0c0b in StartGame ../Source/diablo.cpp:375
    diasurgical#15 0x556776a4493d in mainmenu_init_menu ../Source/mainmenu.cpp:45
    diasurgical#16 0x556776a44c05 in mainmenu_single_player ../Source/mainmenu.cpp:61
    diasurgical#17 0x556776a454a9 in mainmenu_loop ../Source/mainmenu.cpp:152
    diasurgical#18 0x5567767d2892 in DiabloMain ../Source/diablo.cpp:602
    diasurgical#19 0x5567766e3c69 in main ../SourceX/main.cpp:34
    diasurgical#20 0x7f435a69ecb1 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28cb1)
```
AJenbo pushed a commit that referenced this issue Mar 23, 2021
Single-player difficulty selection was implemented in a very hacky way.

Documents what's going on there and fixes a memory leak.

Memory leaks that this fixes looked like this:

```
Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f435b789f17 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.6+0xb1f17)
    #1 0x5567766c62b8 in dvl::selgame_GameSelection_Select(int) ../SourceX/DiabloUI/selgame.cpp:163
    #2 0x5567766d8ee8 in dvl::selhero_Load_Select(int) ../SourceX/DiabloUI/selhero.cpp:464
    #3 0x5567766d6ed1 in dvl::selhero_List_Select(int) ../SourceX/DiabloUI/selhero.cpp:325
    #4 0x556776692683 in dvl::UiFocusNavigationSelect() ../SourceX/DiabloUI/diabloui.cpp:396
    #5 0x55677669158e in HandleMenuAction ../SourceX/DiabloUI/diabloui.cpp:223
    #6 0x5567766917b9 in dvl::UiFocusNavigation(SDL_Event*) ../SourceX/DiabloUI/diabloui.cpp:277
    #7 0x556776695dff in dvl::UiPollAndRender() ../SourceX/DiabloUI/diabloui.cpp:626
    #8 0x5567766d94ef in UiSelHeroDialog ../SourceX/DiabloUI/selhero.cpp:512
    #9 0x5567766d997f in dvl::UiSelHeroSingDialog(int (*)(int (*)(dvl::_uiheroinfo*)), int (*)(dvl::_uiheroinfo*), int (*)(dvl::_uiheroinfo*), void (*)(unsigned int, dvl::_uidefaultstats*), int*, char (*) [16], int*) ../SourceX/DiabloUI/selhero.cpp:547
    #10 0x556776a44f45 in mainmenu_select_hero_dialog ../Source/mainmenu.cpp:98
    #11 0x5567765f9f15 in SNetInitializeProvider ../SourceX/storm/storm_net.cpp:102
    #12 0x556776c996b9 in multi_init_single ../Source/multi.cpp:826
    #13 0x556776c98b1e in NetInit ../Source/multi.cpp:770
    #14 0x5567767d0c0b in StartGame ../Source/diablo.cpp:375
    #15 0x556776a4493d in mainmenu_init_menu ../Source/mainmenu.cpp:45
    #16 0x556776a44c05 in mainmenu_single_player ../Source/mainmenu.cpp:61
    #17 0x556776a454a9 in mainmenu_loop ../Source/mainmenu.cpp:152
    #18 0x5567767d2892 in DiabloMain ../Source/diablo.cpp:602
    #19 0x5567766e3c69 in main ../SourceX/main.cpp:34
    #20 0x7f435a69ecb1 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28cb1)
```
kphoenix137 pushed a commit to kphoenix137/devilutionX that referenced this issue Sep 15, 2023
kphoenix137 added a commit to kphoenix137/devilutionX that referenced this issue Mar 27, 2024
kphoenix137 added a commit to kphoenix137/devilutionX that referenced this issue Mar 31, 2024
kphoenix137 added a commit to kphoenix137/devilutionX that referenced this issue Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants