FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problems Compiling Derelict and Running apps on Win7-64

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
AGear2Ax



Joined: 10 Jun 2012
Posts: 6

PostPosted: Tue Jun 12, 2012 6:23 am    Post subject: Problems Compiling Derelict and Running apps on Win7-64 Reply with quote

Greetings everyone. I come here as my last resort as I have searching around the web with no luck. I have two problems with Derelict, particulary using SFML. The first one is on linux, I run the:
Code:
make -flinux.mak DC=dmd

All seems ok, but when I try to compile an app, this happens:
Code:
agear2ax@Xwain-RV415 ~/ProjectsD/sfml_test $ dmd main.d -L-lDerelictSFMLSystem -L-lDerelictSFMLWindow -L-lDerelictUtil
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(loader_ab_5c5.o): In function `_D8derelict4util6loader15SharedLibLoader6unloadMFZv':
derelict/util/loader.d:(.text._D8derelict4util6loader15SharedLibLoader6unloadMFZv+0x19): undefined reference to `dlclose'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(loader_ab_5c5.o): In function `_D8derelict4util6loader15SharedLibLoader10loadSymbolMFAyaZPv':
derelict/util/loader.d:(.text._D8derelict4util6loader15SharedLibLoader10loadSymbolMFAyaZPv+0x2f): undefined reference to `dlsym'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(loader_ab_5c5.o): In function `_D8derelict4util6loader15SharedLibLoader8bindFuncMFPPvAyabZv':
derelict/util/loader.d:(.text._D8derelict4util6loader15SharedLibLoader8bindFuncMFPPvAyabZv+0x3a): undefined reference to `dlsym'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(sharedlib_b0_36e.o): In function `_D8derelict4util9sharedlib9SharedLib4loadMFAAyaZv':
derelict/util/sharedlib.d:(.text._D8derelict4util9sharedlib9SharedLib4loadMFAAyaZv+0x8f): undefined reference to `dlopen'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(sharedlib_b0_36e.o): In function `_D8derelict4util9sharedlib9SharedLib10loadSymbolMFAyabZPv':
derelict/util/sharedlib.d:(.text._D8derelict4util9sharedlib9SharedLib10loadSymbolMFAyabZPv+0x2f): undefined reference to `dlsym'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(sharedlib_b0_36e.o): In function `_D8derelict4util9sharedlib9SharedLib6unloadMFZv':
derelict/util/sharedlib.d:(.text._D8derelict4util9sharedlib9SharedLib6unloadMFZv+0x19): undefined reference to `dlclose'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(sharedlib_af_463.o): In function `_D8derelict4util9sharedlib11GetErrorStrFZAya':
derelict/util/sharedlib.d:(.text._D8derelict4util9sharedlib11GetErrorStrFZAya+0x7): undefined reference to `dlerror'
collect2: ld returned with exit code 1
--- errorlevel 1


It seems that somehow, it didn't compile fine. Here's my dmd.conf if it can give some aditional info.
Code:
[Environment]

DFLAGS=-I/usr/include/x86_64-linux-gnu/dmd/phobos -I/usr/include/x86_64-linux-gnu/dmd/druntime/import -I/home/agear2ax/Derelict2/import -L-L/usr/lib/x86_64-linux-gnu -L-L/usr/lib/i386-linux-gnu -L-L/home/agear2ax/Derelict2/lib -L--no-warn-search-mismatch -L--export-dynamic


Any ideas what am I doing wrong?

And my second problem is running an App on windows 7 64-bit (the 32-bit one runs perfectly) I have discovered that the problem is with the following line:
Code:
DerelictSFMLWindow.load()

When the App reach that point it doesn't advance from that point. It doesn't froze the app, or crash the app, just waits like an infinite loop. The same happens with DerelictSFML.load().

Thanks in advance. I'll appreciate any help or orientation.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Jun 13, 2012 1:10 am    Post subject: Re: Problems Compiling Derelict and Running apps on Win7-64 Reply with quote

AGear2Ax wrote:

All seems ok, but when I try to compile an app, this happens:
Code:
agear2ax@Xwain-RV415 ~/ProjectsD/sfml_test $ dmd main.d -L-lDerelictSFMLSystem -L-lDerelictSFMLWindow -L-lDerelictUtil
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(loader_ab_5c5.o): In function `_D8derelict4util6loader15SharedLibLoader6unloadMFZv':
derelict/util/loader.d:(.text._D8derelict4util6loader15SharedLibLoader6unloadMFZv+0x19): undefined reference to `dlclose'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(loader_ab_5c5.o): In function `_D8derelict4util6loader15SharedLibLoader10loadSymbolMFAyaZPv':
derelict/util/loader.d:(.text._D8derelict4util6loader15SharedLibLoader10loadSymbolMFAyaZPv+0x2f): undefined reference to `dlsym'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(loader_ab_5c5.o): In function `_D8derelict4util6loader15SharedLibLoader8bindFuncMFPPvAyabZv':
derelict/util/loader.d:(.text._D8derelict4util6loader15SharedLibLoader8bindFuncMFPPvAyabZv+0x3a): undefined reference to `dlsym'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(sharedlib_b0_36e.o): In function `_D8derelict4util9sharedlib9SharedLib4loadMFAAyaZv':
derelict/util/sharedlib.d:(.text._D8derelict4util9sharedlib9SharedLib4loadMFAAyaZv+0x8f): undefined reference to `dlopen'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(sharedlib_b0_36e.o): In function `_D8derelict4util9sharedlib9SharedLib10loadSymbolMFAyabZPv':
derelict/util/sharedlib.d:(.text._D8derelict4util9sharedlib9SharedLib10loadSymbolMFAyabZPv+0x2f): undefined reference to `dlsym'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(sharedlib_b0_36e.o): In function `_D8derelict4util9sharedlib9SharedLib6unloadMFZv':
derelict/util/sharedlib.d:(.text._D8derelict4util9sharedlib9SharedLib6unloadMFZv+0x19): undefined reference to `dlclose'
/home/agear2ax/Derelict2/lib/libDerelictUtil.a(sharedlib_af_463.o): In function `_D8derelict4util9sharedlib11GetErrorStrFZAya':
derelict/util/sharedlib.d:(.text._D8derelict4util9sharedlib11GetErrorStrFZAya+0x7): undefined reference to `dlerror'
collect2: ld returned with exit code 1
--- errorlevel 1


Any ideas what am I doing wrong?


You need to link with the system library libdl (-L-ldl). That's what Derelict uses under the hood to load the shared libraries.

Quote:

And my second problem is running an App on windows 7 64-bit (the 32-bit one runs perfectly)


I'm confused here... do you mean it runs fine on 32-bit Windows or as a 32-bit app? If you're compiling as a 64-bit app, I assume you are using GDC.

Quote:

I have discovered that the problem is with the following line:
Code:
DerelictSFMLWindow.load()

When the App reach that point it doesn't advance from that point. It doesn't froze the app, or crash the app, just waits like an infinite loop. The same happens with DerelictSFML.load().


More info, please. Which compiler? What's the command line? Are you using 32-bit or 64-bit version of CSFML 1.6 (I don't see a 64-bit Windows binary on the site, but...)?
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
AGear2Ax



Joined: 10 Jun 2012
Posts: 6

PostPosted: Wed Jun 13, 2012 5:55 am    Post subject: Reply with quote

I'm using dmd on windows. The libraries are the 32-bit ones (They are the only ones avaible "out-of-the-box" for use) and I compile the program and run it on Windows 7 of 64-bits (on the list of process, it appears as app.exe*32 meaning that I'm running a 32-bit program on a 64-bit OS) So when the program start it stops on the DerelictSFMLWindow.load() function.

I still have problems compiling on linux... I'm missing a linker flag of something?

Code:
agear2ax@Xwain-RV415 ~/ProjectsD/sfml_test $ dmd main.d -L-lDerelictUtil -L-lDerelictSFMLSystem -L-lDerelictSFMLWindow -L-ldl
/home/agear2ax/Derelict2/lib/libDerelictSFMLSystem.a(system.o): In function '_D8derelict4sfml6system12_staticDtor2FZv':
derelict/sfml/system.d:(.text._D8derelict4sfml6system12_staticDtor2FZv+0x5): undefined reference to _D8derelict4util6loader15SharedLibLoader19 isAutoUnloadEnabledFZb
...
(omitted almost all output due to problems posting it, but all errors are similar to this)
...
collect2: ld returned with exit code 1
--- errorlevel 1
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Jun 13, 2012 6:06 am    Post subject: Reply with quote

AGear2Ax wrote:
I'm using dmd on windows. The libraries are the 32-bit ones (They are the only ones avaible "out-of-the-box" for use) and I compile the program and run it on Windows 7 of 64-bits (on the list of process, it appears as app.exe*32 meaning that I'm running a 32-bit program on a 64-bit OS) So when the program start it stops on the DerelictSFMLWindow.load() function.


I really have no idea. My wife's laptop runs 64-bit windows 7. I've got some time tomorrow, so I'll see about getting something up and running on it and see if I can reproduce this. It would be helpful if you could post the minimal amount of code that makes it hang along with the exact command line you are using. Also, which version of DMD?

Quote:

I still have problems compiling on linux... I'm missing a linker flag of something?

Code:
agear2ax@Xwain-RV415 ~/ProjectsD/sfml_test $ dmd main.d -L-lDerelictUtil -L-lDerelictSFMLSystem -L-lDerelictSFMLWindow -L-ldl
/home/agear2ax/Derelict2/lib/libDerelictSFMLSystem.a(system.o): In function '_D8derelict4sfml6system12_staticDtor2FZv':
derelict/sfml/system.d:(.text._D8derelict4sfml6system12_staticDtor2FZv+0x5): undefined reference to _D8derelict4util6loader15SharedLibLoader19 isAutoUnloadEnabledFZb
...
(omitted almost all output due to problems posting it, but all errors are similar to this)
...
collect2: ld returned with exit code 1
--- errorlevel 1


Yeah, DMD uses the gcc toolchain under the hood and the gcc linker is picky about the order in which libraries are specified on the command line. The general rule is this: if lib A uses lib B, the the link order should be A then B.

DerelictUtil is used by both SFMLSystem and SFMLWindow, and libdl is used by DerelictUtil. So the order should be like this:

Code:

dmd main.d -L-lDerelictSFMLSystem -L-lDerelictSFMLWindow -L-lDerelictUtil -L-ldl


It doesn't matter about the System & Window libs... either could come before the other since they have no dependency on each other. But they both need to come before DerelictUtil and it needs to be before libdl. That should fix this particular error at least.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
AGear2Ax



Joined: 10 Jun 2012
Posts: 6

PostPosted: Wed Jun 13, 2012 8:54 am    Post subject: Reply with quote

aldacron wrote:
Yeah, DMD uses the gcc toolchain under the hood and the gcc linker is picky about the order in which libraries are specified on the command line. The general rule is this: if lib A uses lib B, the the link order should be A then B.

DerelictUtil is used by both SFMLSystem and SFMLWindow, and libdl is used by DerelictUtil. So the order should be like this:

Code:

dmd main.d -L-lDerelictSFMLSystem -L-lDerelictSFMLWindow -L-lDerelictUtil -L-ldl


It doesn't matter about the System & Window libs... either could come before the other since they have no dependency on each other. But they both need to come before DerelictUtil and it needs to be before libdl. That should fix this particular error at least.


Yeah! That fixed it! Thanks! But it seems that for every problem solved, another one appears >.< I'll try recompiling CSFML because it keeps throwing Seg Faults whenever I use functions like sfColor_FromRGBA or sfVideoMode_GetDesktopMode or sfVideoMode_GetMode... And when the window starts it starts in fullscreen when it should appear as a Window, and it says for some reason that the video modes 640x480x24 and 800x600x24 aren't supported (in windows 32bit it work perfectly fine)

For the Win64 problem, I use DMD 2.059 and this to compile:
Code:
dmd test.d DerelictUtil.lib DerelictSFMLSystem.lib DerelictSFMLWindow.lib

The -L/subsystem:windows isn't passed in order to see the console for debug output and see if the program is running.

The contents of the file are just:
Code:
import derelict.util.loader;
import derelict.sfml.window;
import derelict.sfml.system;

void main()
{
   DerelictSFMLSystem.load();
   DerelictSFMLWindow.load();
}


Sorry for so many problems and thanks for your help.

Edit: Yeah, on Linux it seems the SFML and CSFML library are kinda broken... I have used the ones on the repos and re-compiling... And even writing C or C++ apps, none of them works due to missing symbols on loading or undefined references.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Jun 13, 2012 7:17 pm    Post subject: Reply with quote

AGear2Ax wrote:
Yeah! That fixed it! Thanks! But it seems that for every problem solved, another one appears >.< I'll try recompiling CSFML because it keeps throwing Seg Faults whenever I use functions like sfColor_FromRGBA or sfVideoMode_GetDesktopMode or sfVideoMode_GetMode... And when the window starts it starts in fullscreen when it should appear as a Window, and it says for some reason that the video modes 640x480x24 and 800x600x24 aren't supported (in windows 32bit it work perfectly fine)


This is because of DMD bugs 5570 and 6348. Until those get fixed, passing/returning structs by value isn't going to happen on 64-bit systems.

Code:

import derelict.util.loader;
import derelict.sfml.window;
import derelict.sfml.system;

void main()
{
   DerelictSFMLSystem.load();
   DerelictSFMLWindow.load();
}


This isn't the source of your problem, but FYI you don't need to import derelict.util.loader. You aren't actually using it.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
AGear2Ax



Joined: 10 Jun 2012
Posts: 6

PostPosted: Wed Jun 13, 2012 7:44 pm    Post subject: Reply with quote

I was about to use the 32-bit versions of the library and using the -m32 flag to compile to see if it finally builds with that... But I was having my doubts about that, thanks for the info!
aldacron wrote:
Code:
import derelict.util.loader;
import derelict.sfml.window;
import derelict.sfml.system;

void main()
{
   DerelictSFMLSystem.load();
   DerelictSFMLWindow.load();
}

This isn't the source of your problem, but FYI you don't need to import derelict.util.loader. You aren't actually using it.

I don't know how import derelict.util.loader end up in the first line... I supposed I was about to test loading symbol by symbol to know where stops the execution.

The code is just that, DerelictSFMLSystem.load(); works perfectly fine if is just that, but my problem is that it enters on DerelictSFMLWindow.load(); and never returns...

Myabe it could help if a know how to depure a program with gdb without the need of an IDE, but I haven't touched that yet (I didn't even bother to see the linker documentation before coming here to ask for help).
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Thu Jun 14, 2012 4:38 am    Post subject: Reply with quote

I've gotten a minimal DMD environment set up on my wife's laptop and this is what I've found. DerelictSFMLWindow.load hangs, whether it's called before/after DerelictSFMLSystem.load or in isolation. But it didn't hang permanently. Every time it was just a few seconds, then the program would crash without any error messages. I added some writelns in. Nothing after DerelictSFMLWindow.load was printed (and nothing before, either, if loaded without DerelictSFMLSystem.load going first).

I also verified that it all works expected on my 32-bit Windows XP. So I can reproduce it, but I'm no closer to understanding it than you are.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
AGear2Ax



Joined: 10 Jun 2012
Posts: 6

PostPosted: Thu Jun 14, 2012 5:59 am    Post subject: Reply with quote

The things that happen... I wonder if it is another bug on dmd... My knowledge is still way too small to help with this. The only thing I think I can try to help, is compiling debug versions and using gdb to see what happens. I'll try to do that when I enough time. Thanks for the help.

BTW, none of this problems are present using SDL + OpenGL? I have chosen SFML over SDL because I feel I can code faster with SFML than SDL, kinda high level vs. low level, even more fast if D is used (and can ease the process of language translation)
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Thu Jun 14, 2012 7:11 am    Post subject: Reply with quote

AGear2Ax wrote:
The things that happen... I wonder if it is another bug on dmd... My knowledge is still way too small to help with this. The only thing I think I can try to help, is compiling debug versions and using gdb to see what happens. I'll try to do that when I enough time. Thanks for the help.


For the Windows problem, gdb won't help since you're using DMD. VisualD would be what I would use. My wife isn't about to let me install that on her laptop, though.

Quote:
BTW, none of this problems are present using SDL + OpenGL? I have chosen SFML over SDL because I feel I can code faster with SFML than SDL, kinda high level vs. low level, even more fast if D is used (and can ease the process of language translation)


I've never personally tested any of this on 64-bit systems, so I have no idea what works and what doesn't. I'm sure there must be others who have used some of Derelict on 64-bit, and I've a feeling the SDL binding would be a likely candidate to have seen some usage. So you may well be safe going that route.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
AGear2Ax



Joined: 10 Jun 2012
Posts: 6

PostPosted: Fri Jun 15, 2012 7:57 pm    Post subject: Reply with quote

isn't gdc for windows too? I though I could use that instead of dmd to be able to use gdb to debug the programs. Personally I feel that visual 2010 is too heavy and the debugger makes part of a bigger package that I will probably never use to the 100% Anyways, I'll try what I can.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Jun 16, 2012 4:58 am    Post subject: Reply with quote

AGear2Ax wrote:
isn't gdc for windows too? I though I could use that instead of dmd to be able to use gdb to debug the programs.


Yes, of course. You can go that route if you want.

Quote:
Personally I feel that visual 2010 is too heavy and the debugger makes part of a bigger package that I will probably never use to the 100% Anyways, I'll try what I can.


I never use GDC, so when I need a debugger I use VisualD. I use it with the free Visual Studio shell, which is fairly lightweight. There are two options for debugging, one using the Visual Studio debugger and the other using Mago. Though, admittedly, I find myself dropping into the debugger much less often with D than I do with C.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group