Compilation problems with GDC/GCC

Johannes Pfau via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 14 11:00:22 PDT 2017


Am Fri, 14 Apr 2017 13:03:22 +0000
schrieb DRex <armstronga94 at hotmail.com>:

> On Friday, 14 April 2017 at 12:01:39 UTC, DRex wrote:
> >
> > the -r option redirects the linked object files into another 
> > object file, so the point being I can pass a D object and a C 
> > object to the linker and produce another object file.
> >
> > As for linking D files, do you mean passing the druntime 
> > libraries to ld?  I used gdc -v and it gave me a whole bunch of 
> > info, it showed the an entry 'LIBRARY_PATH' which contains the 
> > path to libgphobos and libgdruntime as well as a whole bunch of 
> > other libs, i'm assuming that is what you are telling me to 
> > pass to the linker?  
> 
> I have tried passing libgphobos2.a and libgdruntime.a (and at one 
> point every library in the folder I found those two libs in) to 
> ld to link with my D source, but it still throws a billion 
> 'undefined reference' errors.
> 
> I really need help here, I have tried so many different things 
> and am losing my mind trying to get this to work.
> 
> the problem I have with passing the -r option to ld through gdc 
> is that -Wl is looking for libgcc_s.a which doesnt even exist on 
> the computer, which is annoying

GDC should generally only need to link to -lgdruntime (and -lgphobos
if you need it). However, if you really link using ld you'll have to
provide the C startup files, -lc and similar stuff for C as well, which
gets quite complicated.

You'll have to post the exact commands you used and some
of the missing symbol names so we can give better answers.

-- Johannes



More information about the Digitalmars-d-learn mailing list