digitalmars.D - Manually linking druntime and phobos2
- Michel Fortin (16/16) Jul 23 2010 When manually calling the linker, which libraries should be linked with
- Lars T. Kyllingstad (9/24) Jul 23 2010 It seems that at least parts of druntime gets included in the Phobos
- Leandro Lucarella (14/41) Jul 23 2010 If it's not there, you should linkk the final program agains both
- Steven Schveighoffer (8/20) Jul 23 2010 This is what happens. How should it be? Does it matter? Everything is...
- Sean Kelly (2/5) Jul 23 2010 This is largely a historical artifact, though I do still sometimes link ...
-
Steven Schveighoffer
(5/11)
Jul 23 2010
AFAIK, the libdruntime.a in the
/lib dir is unused, and probably i...
When manually calling the linker, which libraries should be linked with a d object file? If I run dmd with the -v option on Mac OS X, I notice dmd issues the following linker command: gcc test.o -o test -m32 -Xlinker -L/Library/Compilers/dmd2/osx/bin/../lib -lphobos2 -lpthread -lm which includes library phobos2 but not druntime. I've made D for Xcode link both phobos2 and druntime in the final executable; this cause no problem on Mac OS X 10.6 (Snow Leopard) but I have a user on 10.5 (Leopard) who gets duplicate symbols in druntime and phobos2 because of this. So now I wonder, is druntime included into the phobos2 library? Is this how it should be? -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Jul 23 2010
On Fri, 23 Jul 2010 06:50:08 -0400, Michel Fortin wrote:When manually calling the linker, which libraries should be linked with a d object file? If I run dmd with the -v option on Mac OS X, I notice dmd issues the following linker command: gcc test.o -o test -m32 -Xlinker -L/Library/Compilers/dmd2/osx/bin/../lib -lphobos2 -lpthread -lm which includes library phobos2 but not druntime. I've made D for Xcode link both phobos2 and druntime in the final executable; this cause no problem on Mac OS X 10.6 (Snow Leopard) but I have a user on 10.5 (Leopard) who gets duplicate symbols in druntime and phobos2 because of this. So now I wonder, is druntime included into the phobos2 library? Is this how it should be?It seems that at least parts of druntime gets included in the Phobos library. Here is the line (200) from the Phobos makefile that builds the file libphobos2.a: $(DMD) $(DFLAGS) -lib -of$ $(DRUNTIME) $(D_FILES) $(OBJS) The variable $(DRUNTIME) contains the path to libdruntime.a. If it is removed, Phobos still compiles just fine, so I suspect it shouldn't be there. -Lars
Jul 23 2010
Lars T. Kyllingstad, el 23 de julio a las 12:39 me escribiste:On Fri, 23 Jul 2010 06:50:08 -0400, Michel Fortin wrote:If it's not there, you should linkk the final program agains both libraries. The way it is now is like phobos2 included all druntime's .o files on it. I remember some discussion about this (joining phobos and druntime in the same lib) a while ago... -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- ¿Cómo estais? ¿Cómo os senteis hoy 29 del membre de 1961 día en que conmemoreramos la nonésima setima nebulización del martir Peperino Pómoro junto al Rolo Puente en la ciudad de Jadad? -- Peperino PómoroWhen manually calling the linker, which libraries should be linked with a d object file? If I run dmd with the -v option on Mac OS X, I notice dmd issues the following linker command: gcc test.o -o test -m32 -Xlinker -L/Library/Compilers/dmd2/osx/bin/../lib -lphobos2 -lpthread -lm which includes library phobos2 but not druntime. I've made D for Xcode link both phobos2 and druntime in the final executable; this cause no problem on Mac OS X 10.6 (Snow Leopard) but I have a user on 10.5 (Leopard) who gets duplicate symbols in druntime and phobos2 because of this. So now I wonder, is druntime included into the phobos2 library? Is this how it should be?It seems that at least parts of druntime gets included in the Phobos library. Here is the line (200) from the Phobos makefile that builds the file libphobos2.a: $(DMD) $(DFLAGS) -lib -of$ $(DRUNTIME) $(D_FILES) $(OBJS) The variable $(DRUNTIME) contains the path to libdruntime.a. If it is removed, Phobos still compiles just fine, so I suspect it shouldn't be there.
Jul 23 2010
On Fri, 23 Jul 2010 06:50:08 -0400, Michel Fortin <michel.fortin michelf.com> wrote:When manually calling the linker, which libraries should be linked with a d object file? If I run dmd with the -v option on Mac OS X, I notice dmd issues the following linker command: gcc test.o -o test -m32 -Xlinker -L/Library/Compilers/dmd2/osx/bin/../lib -lphobos2 -lpthread -lm which includes library phobos2 but not druntime. I've made D for Xcode link both phobos2 and druntime in the final executable; this cause no problem on Mac OS X 10.6 (Snow Leopard) but I have a user on 10.5 (Leopard) who gets duplicate symbols in druntime and phobos2 because of this. So now I wonder, is druntime included into the phobos2 library? Is this how it should be?This is what happens. How should it be? Does it matter? Everything is linked statically anyways. If it was a dynamic lib, then we need to address it. What I find odd is that libdruntime.a is in the lib subdir even though it's never used. -Steve
Jul 23 2010
Steven Schveighoffer Wrote:What I find odd is that libdruntime.a is in the lib subdir even though it's never used.This is largely a historical artifact, though I do still sometimes link druntime explicitly to test without Phobos.
Jul 23 2010
On Fri, 23 Jul 2010 10:48:11 -0400, Sean Kelly <sean invisibleduck.org> wrote:Steven Schveighoffer Wrote:AFAIK, the libdruntime.a in the <arch>/lib dir is unused, and probably is not tested on releases, so it would be a good idea not to include it. -SteveWhat I find odd is that libdruntime.a is in the lib subdir even though it's never used.This is largely a historical artifact, though I do still sometimes link druntime explicitly to test without Phobos.
Jul 23 2010