View previous topic :: View next topic |
Author |
Message |
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Tue Aug 10, 2004 7:33 am Post subject: The 'getting derelict to work on linux' thread |
|
|
Ok. First off, I'm using code from the first release. When the second release comes out, I'll use that
Second off, I hope that part of the std.loader on linux problem will be resolved by Walter because I made a little bug report here http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/1331
Third off, I converted the windows makefile to a linux makefile. I just replaced the '.'s with '_'s and changed the direction of the \ to /.
Now I'm trying to compile SDL.
Code: |
make sdl
dmd -c src/derelict/sdl/active.d src/derelict/sdl/audio.d src/derelict/sdl/byteorder.d src/derelict/sdl/cdrom.d src/derelict/sdl/cpuinfo.d src/derelict/sdl/endian.d src/derelict/sdl/error.d src/derelict/sdl/events.d src/derelict/sdl/joystick.d src/derelict/sdl/keyboard.d src/derelict/sdl/keysym.d src/derelict/sdl/loadso.d src/derelict/sdl/mouse.d src/derelict/sdl/mutex.d src/derelict/sdl/rwops.d src/derelict/sdl/sdl.d src/derelict/sdl/sdlversion.d src/derelict/sdl/syswm.d src/derelict/sdl/thread.d src/derelict/sdl/timer.d src/derelict/sdl/types.d src/derelict/sdl/video.d -v -debug -Isrc -odobj/sdl
parse active
parse audio
parse byteorder
parse cdrom
parse cpuinfo
parse endian
parse error
parse events
parse joystick
parse keyboard
parse keysym
parse loadso
parse mouse
parse mutex
parse rwops
parse sdl
parse sdlversion
parse syswm
parse thread
parse timer
parse types
parse video
semantic active
semantic audio
semantic byteorder
semantic cdrom
semantic cpuinfo
semantic endian
semantic error
semantic events
identifier 'SDL_SysWMinfo' is not defined
make: *** [sdl] Error 1
|
and I get that error. Any suggestions? Well I have to get going now bye. [/code] |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Tue Aug 10, 2004 12:59 pm Post subject: |
|
|
The problem was that SDL_SysWMinfo was declared in a version(Windows) block, while the function SDL_GetWMInfo was not. The fix is in svn. There are two affected files:
sdl.d
syswm.d
I strongly recommend again that you use the latest svn rather than the 0.1 release |
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Tue Aug 10, 2004 7:52 pm Post subject: |
|
|
Fine, I give in. I'll use the latest greatest svn. Until then... (i'm busy atm) |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Wed Aug 11, 2004 6:22 am Post subject: |
|
|
I should mention that the fix I put in is temporary. The Linux version of SDL declares SDL_SysWMinfo with an XEvent member. Since I don't have a working linux partition atm, I looked up XEvent through Google. This is what I found:
Code: |
typedef union _XEvent {
int type; /* must not be changed */
XAnyEvent xany;
XKeyEvent xkey;
XButtonEvent xbutton;
XMotionEvent xmotion;
XCrossingEvent xcrossing;
XFocusChangeEvent xfocus;
XExposeEvent xexpose;
XGraphicsExposeEvent xgraphicsexpose;
XNoExposeEvent xnoexpose;
XVisibilityEvent xvisibility;
XCreateWindowEvent xcreatewindow;
XDestroyWindowEvent xdestroywindow;
XUnmapEvent xunmap;
XMapEvent xmap;
XMapRequestEvent xmaprequest;
XReparentEvent xreparent;
XConfigureEvent xconfigure;
XGravityEvent xgravity;
XResizeRequestEvent xresizerequest;
XConfigureRequestEvent xconfigurerequest;
XCirculateEvent xcirculate;
XCirculateRequestEvent xcirculaterequest;
XPropertyEvent xproperty;
XSelectionClearEvent xselectionclear;
XSelectionRequestEvent xselectionrequest;
XSelectionEvent xselection;
XColormapEvent xcolormap;
XClientMessageEvent xclient;
XMappingEvent xmapping;
XErrorEvent xerror;
XKeymapEvent xkeymap;
long pad[24];
} XEvent;
|
So in order to implement syswm.d for Linux, all of the XWindow events will need to be declared somewhere. I don't see them in Phobos. And I don't have the xlib headers available right now (I suppose I'll have to download them). At any rate, it's not a priority, but it's something that will eventually need to be done for completeness. |
|
Back to top |
|
|
andy
Joined: 15 Mar 2004 Posts: 71
|
Posted: Wed Aug 11, 2004 9:51 am Post subject: |
|
|
blarg. Don't do that. Nobody cares about all the X crap, and even if they did, that's another project all its own.
Just do
Code: | typedef void XEvent; |
_________________ "Complacency is a far more dangerous attitude than outrage." - Naomi Littlebear |
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Wed Aug 18, 2004 6:05 am Post subject: |
|
|
i just used the same code for linux as it uses windows and did
Code: |
version (Windows)
{
import std.c.windows.windows;
}
version (linux)
{
alias void* HWND;
alias uint UINT;
alias uint WPARAM;
alias uint LPARAM;
}
struct SDL_SysWMinfo
{
// this is named 'version' in SDL_syswm.h, but since version is a keyword
// it 'ver' will have to do
SDL_version ver;
HWND window;
version(Windows)
{
HGLRC hglrc;
}
}
|
it compiles. however, i've run into a bit of a snag.
#1) i can't get access to the internet without dialing long distance
#2) std.loader in linux doesn't work
i havn't checked out the latest dmd release i'll go do that now k bye
when i get to college on the 30th i better have internet access : ) |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Wed Aug 18, 2004 11:00 am Post subject: |
|
|
clayasaurus wrote: | i just used the same code for linux as it uses windows |
That works for now. Andy's solution would have been just as good. I (or we) will really need to figure out a solution to this. Someone, somewhere will surely want to manipulate an SDL_SysWMinfo object at some point and will gripe that it's broken on Linux.
Quote: |
#2) std.loader in linux doesn't work
|
When are they ever going to get this sorted, I wonder? I've been meaning to go in and look over std.loader again anyway. There were issues with the class version (not that I plan to use it) that I requested be fixed. Never heard anything after Matthew asked for my suggestions. If it hasn't been fixed yet I might just do it myself and submit it to the NG, along with a request that it be compiled into the Linux version of Phobos.
Thanks for all the work you are putting in on this! |
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Thu Aug 19, 2004 8:42 am Post subject: yay! |
|
|
ok. the problems are now fixed
#1) i got connected to my local ISP (finally)
#2) std.loader does work in linux if you do...
version(Linux) --> version(linux)
compile it into phobos
add -L-ldl as the linker option
I got sdl to compile with my syswm hack and i got sdl bitmap example up and running in linux!
edit: oh yea and add
version(linux)
{
hsdl = ExeModule_Load("libSDL.so");
}
in sdl.d
oh, and i just tried to run sdlsem but it seg faults. hrm...
edit: i got the sdlglglu test working
edit: FYI... libGL.so libGLU.so libSDL_image.so
edit: upon recompiling phobos, it made it so every time i use the ~= operator it crashes. so i have to figure out how to recompile phobos without this problem.
update: since i can't recompile phobos with std.loader, i just added loader.o to my objects and I can now run ClayTek 3D on linux. |
|
Back to top |
|
|
barrett9h
Joined: 02 May 2005 Posts: 26 Location: Brazil
|
Posted: Mon May 02, 2005 8:44 pm Post subject: svn password |
|
|
I want to get the svn source, but svn asks for a password. |
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
|
Back to top |
|
|
barrett9h
Joined: 02 May 2005 Posts: 26 Location: Brazil
|
Posted: Mon May 02, 2005 10:18 pm Post subject: |
|
|
Sorry, I was trying 'svn import'. I'm new to svn. Now it worked.
But I still can't put it to work on Linux.
I ran 'make -f Makefile.linux' on the derelict/trunk/DerelictSDL dir, and it worked.
Now what do I do?
I tried to compile a simple program using it, but:
Code: | $dmd main.d libderelictUtil.a libderelictSDL.a
gcc main.o -o main libderelictUtil.a libderelictSDL.a -lphobos -lpthread -lm
libderelictSDL.a(sdl.o)(.data+0x50): undefined reference to `_ModuleInfo_8derelict4util6loader'
|
main.d is:
Code: | import derelict.sdl.sdl;
int main(char args[][])
{
DerelictSDL_Load();
return 0;
}
|
|
|
Back to top |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Tue May 03, 2005 7:59 am Post subject: |
|
|
Here is a step by step guide of what you can do : )
#1) make a directory called 'project'
#2) inside 'project', make a directory called 'derelict'
#3) copy or move the derelict/trunk/DerelictUtil/util/ folder into your 'project/derelict/util', notice it has loader and exception.d in it
#4) copy or move the derelict/trunk/DerelictSDL/derelict/sdl into your 'project/derelict/sdl', notice it has all the SDL code in it
#5) get a hold of the build source over at http://www.dsource.org/projects/build , compile it and get a binary, read over the docs if you want, you'll see build is a makefile replacement that automatically figures everything out for you
#6) copy your newly created 'build' binary to your 'project' folder
#7) copy main.d to your 'project' folder
#8) from the command line, enter your project folder, and type the command "./build main.d -L-ldl -L-lpthread -CFPATH/etc/ -g -debug -Rn", notice, it is best to put this command inside a compiling script, so you just have to run ./compile for it to work. -ldl is linux's dynamic loading library, CFPATH is where your dmd.conf is, -Rn says not to use builds response file (it doesn't work on linux), and -g -debug just compiles the debug code, if you want you can add a -cleanup to remove any .o files it created, or a -O -release for optimized release code.
#9) it should work, post any more questions comments here |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Tue May 03, 2005 9:12 am Post subject: |
|
|
barrett9h wrote: | Sorry, I was trying 'svn import'. I'm new to svn. Now it worked.
But I still can't put it to work on Linux.
I ran 'make -f Makefile.linux' on the derelict/trunk/DerelictSDL dir, and it worked.
Now what do I do?
I tried to compile a simple program using it, but:
Code: | $dmd main.d libderelictUtil.a libderelictSDL.a
gcc main.o -o main libderelictUtil.a libderelictSDL.a -lphobos -lpthread -lm
libderelictSDL.a(sdl.o)(.data+0x50): undefined reference to `_ModuleInfo_8derelict4util6loader'
|
main.d is:
Code: | import derelict.sdl.sdl;
int main(char args[][])
{
DerelictSDL_Load();
return 0;
}
|
|
Did you also build DerelictUtil? I see you are trying to link to libDerelictUtil.a, but you don't mention building it. Undefined references at the link step normally mean that the object file in question (in this case, derelict.util.loader) isn't on the link path - which in this case it should be if you actually have built DerelictUtil. |
|
Back to top |
|
|
|