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

Linker problems - newbie's question

 
Post new topic   Reply to topic     Forum Index -> FastCGI4D
View previous topic :: View next topic  
Author Message
pawel.mucha



Joined: 19 Dec 2007
Posts: 2

PostPosted: Wed Dec 19, 2007 6:00 am    Post subject: Linker problems - newbie's question Reply with quote

Now, I admit I'm far from being a pro in this matter. I've always worked with interpreted languages, so I've never had problems with any compiler/linker. I fell in love with D though, and now I have.
I tried to compile the SimpleLoop example. DMD has no problems with compiling, but GCC does not want to link the .o file.
When I try to do it (either by dmd or manually), it says:

Code:
> gcc SimpleLoop.o -o SimpleLoop -m32 -Xlinker -L/usr/bin/lib -lphobos -lpthread -lm -lfcgi
SimpleLoop.o:(.data+0x30): undefined reference to `_D4fcgi7Request12__ModuleInfoZ'
collect2: ld returned 1 exit status


It seems like importing Request.d and Conduit.d causes this problem (of coz the latter creates a slightly different message).

I have the newest version of libfcgi, Tango, DMD, almost the newest GCC (4.2.1), my OS is openSUSE 10.3. Maybe this info will be useful for someone:

Code:
> nm SimpleLoop.o
         U _D10ModuleInfo6__vtblZ
00000000 D _D10SimpleLoop12__ModuleInfoZ
         U _D4fcgi7Request12__ModuleInfoZ
00000000 T _Dmain
         U _Dmodule_ref
00000000 R _deh_beg
00000000 R _deh_end
         U _main
00000000 t gcc2_compiled.

> file SimpleLoop.o
SimpleLoop.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped


So... am... help?
Back to top
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Wed Dec 19, 2007 7:14 am    Post subject: Reply with quote

Pawel, this is a typical "problem" in the D world (and really in C/C++ too, but the build systems there tend to hide it for you). What is happening is that the files you compile, imports other D files, and these are the ones the linker miss. So in essence, you need the object files for all your own files _and_ all the imported files. These can be put into libraries that are automatically picked up by the compiler, but easier still is often using a tool like dsss/rebuild (see the DSSS project here at dsource). Using this tool instead of the compiler itself, should result in what you want because it analyze the sources, finds the dependencies needed, compiles them and links them in.
Back to top
View user's profile Send private message
pawel.mucha



Joined: 19 Dec 2007
Posts: 2

PostPosted: Wed Dec 19, 2007 8:49 am    Post subject: Reply with quote

Thanks larsivi -- that was very helpful.

In case anybody reads this -- it seems like the newest tango.io.Conduit abstract class has a new method toUtf8(), which needs to be added in fcgi.Conduit and fcgi.InternalConduit in order to make them work as a normal, not abstract classes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> FastCGI4D 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