RejectedSoftware Forums

Sign up

Pages: 1 2

LDC

According to the GitHub/rejectedsoftware/dub there is "Support for DMD,
GDC and LDC (common DMD flags are translated automatically)." Please
elaborate because I don't exactly understand what that means. I've to to
install LDC and use it instead of DMD but this doesn't seem to help
because after changing the second to last line of dub/build.sh to:

ldc2 -ofbin/dub -g -d-debug -w -property -Isource $* $LIBS source/app.d

I get a slew of linker errors:

andrew@goldeneye:~/dub$ ./build.sh
bin/dub.o: In function _Dmain':<br>/home/andrew/dub/source/app.d:79: undefined reference to <br>D3dub8internal10vibecompat4core3log11setLogLevelFNbE3dub8internal10vibecompat4core3log8LogLevelZv'
/home/andrew/dub/source/app.d:97: undefined reference to
`
D3dub9compilers8compiler11getCompilerFAyaZC3dub9compilers8compiler8Compiler'
/home/andrew/dub/source/app.d:108: undefined reference to
_D3dub3dub3Dub7__ClassZ'<br>/home/andrew/dub/source/app.d:108: undefined reference to <br>D3dub3dub3Dub6vtblZ'
/home/andrew/dub/source/app.d:108: undefined reference to
`
D3dub3dub3Dub6initZ'
/home/andrew/dub/source/app.d:108: undefined reference to
`_D3dub3dub23defaultPackageSuppliersFZAC3dub15packagesupplier15PackageSupplier'
/home/andrew/dub/source/app.d:108: undefined reference to
`_D3dub3dub3Dub6
ctorMFAC3dub15packagesupplier15PackageSupplierZC3dub3dub3Dub'
/home/andrew/dub/source/app.d:122: undefined reference to
_D3dub8internal10vibecompat4inet4path4Path6__initZ'<br>/home/andrew/dub/source/app.d:122: undefined reference to <br>D3dub8internal10vibecompat4inet4path4Path6_initZ'
...
...
[SNIP]

My guess is this is due to ldc2 lacking automatic dependency
resolution that rdmd has.

Please confirm that this is the case or point me in the right direction
if I have missed something important regarding configuring dub to use
with LDC.

Thanks,
Andrew

Re: LDC

On Sat, 04 May 2013 22:47:42 -0400, Andrew Edwards wrote:

According to the GitHub/rejectedsoftware/dub there is "Support for DMD,
GDC and LDC (common DMD flags are translated automatically)." Please
elaborate because I don't exactly understand what that means. I've to to
install LDC and use it instead of DMD but this doesn't seem to help
because after changing the second to last line of dub/build.sh to:

ldc2 -ofbin/dub -g -d-debug -w -property -Isource $* $LIBS source/app.d

I get a slew of linker errors:

(...)

My guess is this is due to ldc2 lacking automatic dependency
resolution that rdmd has.

Please confirm that this is the case or point me in the right direction
if I have missed something important regarding configuring dub to use
with LDC.

Thanks,
Andrew

Currently the support is only for building projects (using "dub --compiler=ldc2"). The dub build script is supposed to be redone to work without rdmd, though, and at that occation I'll also add support for other compilers. For now, if you have rdmd installed (AFAIK it's just a single D file that needs to be compiled), this should work:

rdmd --compiler=ldmd --build-only -ofbin/dub -g -debug -w -property -Isource $* $LIBS source/app.d

(or maybe that's "ldmd2", not sure)

Re: LDC

On 5/5/13 3:44 AM, Sönke Ludwig wrote:

On Sat, 04 May 2013 22:47:42 -0400, Andrew Edwards wrote:

According to the GitHub/rejectedsoftware/dub there is "Support for DMD,
GDC and LDC (common DMD flags are translated automatically)." Please
elaborate because I don't exactly understand what that means. I've to to
install LDC and use it instead of DMD but this doesn't seem to help
because after changing the second to last line of dub/build.sh to:

ldc2 -ofbin/dub -g -d-debug -w -property -Isource $* $LIBS source/app.d

I get a slew of linker errors:

(...)

My guess is this is due to ldc2 lacking automatic dependency
resolution that rdmd has.

Please confirm that this is the case or point me in the right direction
if I have missed something important regarding configuring dub to use
with LDC.

Thanks,
Andrew

Currently the support is only for building projects (using "dub --compiler=ldc2"). The dub build script is supposed to be redone to work without rdmd, though, and at that occation I'll also add support for other compilers. For now, if you have rdmd installed (AFAIK it's just a single D file that needs to be compiled), this should work:

 rdmd --compiler=ldmd --build-only -ofbin/dub -g -debug -w -property -Isource $* $LIBS source/app.d

So if I understand you correctly, I need to compile and install rdmd.
This, along with the currently installed LDC2 compiler will do the trick
once I modify dub/build.sh match above line of code.

(or maybe that's "ldmd2", not sure)

I use the command "ldc2" to invoke the LDC compiler.

I've tried this suggestion but still encountered some issues. There are
far less errors though, and these errors seem specifically related to curl:

/usr/lib/x8664-linux-gnu/libphobos2.a(curl.o): In function
`
D3std3net4curl4Curl19sharedStaticCtor28FZv':
std/net/curl.d:(.text.
D3std3net4curl4Curl19sharedStaticCtor28FZv+0xf):
undefined reference to `curl
globalinit'
/usr/lib/x86
64-linux-gnu/libphobos2.a(curl.o): In function
_D3std3net4curl4Curl19_sharedStaticDtor29FZv':<br>std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor29FZv+0x5): <br>undefined reference to curlglobalcleanup'
/usr/lib/x8664-linux-gnu/libphobos2.a(curl1535140.o): In function
`
D3std3net4curl4HTTP4Impl6dtorMFZv':
std/net/curl.d:(.text._D3std3net4curl4HTTP4Impl6
dtorMFZv+0x19):
undefined reference to curl_slist_free_all'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1535_140.o): In function <br>D3std3net4curl4HTTP3dupMFZS3std3net4curl4HTTP':
std/net/curl.d:(.text.
D3std3net4curl4HTTP3dupMFZS3std3net4curl4HTTP+0x72):
undefined reference to curl_slist_append'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1535_140.o): In function <br>D3std3net4curl4HTTP19clearRequestHeadersMFZv':
std/net/curl.d:(.text.
D3std3net4curl4HTTP19clearRequestHeadersMFZv+0x25):
undefined reference to curl_slist_free_all'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1535_140.o): In function <br>D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv':
std/net/curl.d:(.text.
D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv+0x76):
undefined reference to curl_slist_append'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_153b_432.o): In function <br>D3std3net4curl4Curl10initializeMFZv':
std/net/curl.d:(.text.
D3std3net4curl4Curl10initializeMFZv+0x47):
undefined reference to curl_easy_init'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_153c_149.o): In function <br>D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl':
std/net/curl.d:(.text.
D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl+0x2b):
undefined reference to curl_easy_duphandle'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1540_37c.o): In function <br>D3std3net4curl4Curl8shutdownMFZv':
std/net/curl.d:(.text.
D3std3net4curl4Curl8shutdownMFZv+0x1a): undefined
reference to curl_easy_cleanup'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1542_14c.o): In function <br>D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv':
std/net/curl.d:(.text.
D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv+0x3d):
undefined reference to curl_easy_setopt'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1543_14c.o): In function <br>D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv':
std/net/curl.d:(.text.
D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv+0x2a):
undefined reference to curl_easy_setopt'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1544_14c.o): In function <br>D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv':
std/net/curl.d:(.text.
D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv+0x2a):
undefined reference to curl_easy_setopt'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1545_207.o): In function <br>D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv':
std/net/curl.d:(.text.
D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv+0x25):
undefined reference to curl_easy_setopt'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_1546_2fb.o): In function <br>D3std3net4curl4Curl7performMFbZi':
std/net/curl.d:(.text.
D3std3net4curl4Curl7performMFbZi+0x1f): undefined
reference to curl_easy_perform'<br>/usr/lib/x86_64-linux-gnu/libphobos2.a(curl_153e_4a1.o): In function <br>D3std3net4curl4Curl11errorStringMFiZAya':
std/net/curl.d:(.text.
D3std3net4curl4Curl11errorStringMFiZAya+0x11):
undefined reference to `curleasystrerror'

Thanks,
Andrew

Re: LDC

On Sun, 05 May 2013 04:52:20 -0400, Andrew Edwards wrote:

On 5/5/13 3:44 AM, Sönke Ludwig wrote:

So if I understand you correctly, I need to compile and install rdmd.
This, along with the currently installed LDC2 compiler will do the trick
once I modify dub/build.sh match above line of code.

(or maybe that's "ldmd2", not sure)

I use the command "ldc2" to invoke the LDC compiler.

I've tried this suggestion but still encountered some issues. There are
far less errors though, and these errors seem specifically related to curl:

(...)

Did you specify "-lcurl" on the ldc2 command line? Looks like the linker didn't link against libcurl.a.

Anyway, I sped up making the new build script a bit and tested it successfully on CentOS 6.2 with the LDC HEAD/LLVM 3.2. It should also detect LDC automatically now. The new build script is in the latest git HEAD version.

Re: LDC

On Sun, 05 May 2013 04:52:20 -0400, Andrew Edwards wrote:

...

Difference between ldc2 and ldmd(2) is that latter is a wrapper on top of former that accepts parameters with a same syntax dmd does. It greatly simplifies life for generic build tool like dub.

Re: LDC

On Mon, 06 May 2013 06:24:13 GMT, Sönke Ludwig wrote:

On Sun, 05 May 2013 04:52:20 -0400, Andrew Edwards wrote:

On 5/5/13 3:44 AM, Sönke Ludwig wrote:

So if I understand you correctly, I need to compile and install rdmd.
This, along with the currently installed LDC2 compiler will do the trick
once I modify dub/build.sh match above line of code.

(or maybe that's "ldmd2", not sure)

I use the command "ldc2" to invoke the LDC compiler.

I've tried this suggestion but still encountered some issues. There are
far less errors though, and these errors seem specifically related to curl:

(...)

Did you specify "-lcurl" on the ldc2 command line? Looks like the linker didn't link against libcurl.a.

Anyway, I sped up making the new build script a bit and tested it successfully on CentOS 6.2 with the LDC HEAD/LLVM 3.2. It should also detect LDC automatically now. The new build script is in the latest git HEAD version.

Sorry, I just realized that the linker errors are most probably actually the symptom of the missing "--no-as-needed" workaround. The latest version should work, though.

Re: LDC

On 5/8/13 5:12 AM, Sönke Ludwig wrote:

On Mon, 06 May 2013 06:24:13 GMT, Sönke Ludwig wrote:

On Sun, 05 May 2013 04:52:20 -0400, Andrew Edwards wrote:

On 5/5/13 3:44 AM, Sönke Ludwig wrote:

So if I understand you correctly, I need to compile and install rdmd.
This, along with the currently installed LDC2 compiler will do the trick
once I modify dub/build.sh match above line of code.

(or maybe that's "ldmd2", not sure)

I use the command "ldc2" to invoke the LDC compiler.

I've tried this suggestion but still encountered some issues. There are
far less errors though, and these errors seem specifically related to curl:

(...)

Did you specify "-lcurl" on the ldc2 command line? Looks like the linker didn't link against libcurl.a.

Anyway, I sped up making the new build script a bit and tested it successfully on CentOS 6.2 with the LDC HEAD/LLVM 3.2. It should also detect LDC automatically now. The new build script is in the latest git HEAD version.

Sorry, I just realized that the linker errors are most probably actually the symptom of the missing "--no-as-needed" workaround. The latest version should work, though.

I updated dub and tried again. It did detect ldc2 during the build but
still resulted in failure because of the same curl linker errors. All
I'm doing at this point is running the dub build script so didn't think
I needed to supply "-lcurl" argument but I tried it anyway and the
result was:

andrew@goldeneye:~/dub$ ./build.sh -lcurl
Running ldmd2...
ldc2: Unknown command line argument '-lcurl'. Try: '/usr/local/bin/ldc2
-help'
ldc2: Did you mean '-c'?

I'm running Ubuntu 12.10 but I don't thing that should matter.

Any ideas?

Thanks,
Andrew

Re: LDC

On 5/7/13 7:12 AM, Dicebot wrote:

On Sun, 05 May 2013 04:52:20 -0400, Andrew Edwards wrote:

...

Difference between ldc2 and ldmd(2) is that latter is a wrapper on top of former that accepts parameters with a same syntax dmd does. It greatly simplifies life for generic build tool like dub.

Ok. Got it. Thanks for the clarification.

Andrew

Re: LDC

On Wed, 08 May 2013 06:51:11 -0400, Andrew Edwards wrote:

I'm running Ubuntu 12.10 but I don't thing that should matter.

Turns out that I have tested only the combinations CentOS+LDC and Ubuntu+DMD, but Ubuntu+LDC needed the equivalent build fix as Ubuntu+DMD (putting phobos before libcurl on the linker command line). The current HEAD now also builds Ubuntu+LDC successfully (tested on 12.04, but 12.10 shouldn't make a difference in this case).

Re: LDC

On 5/8/13 8:37 AM, Sönke Ludwig wrote:

On Wed, 08 May 2013 06:51:11 -0400, Andrew Edwards wrote:

I'm running Ubuntu 12.10 but I don't thing that should matter.

Turns out that I have tested only the combinations CentOS+LDC and Ubuntu+DMD, but Ubuntu+LDC needed the equivalent build fix as Ubuntu+DMD (putting phobos before libcurl on the linker command line). The current HEAD now also builds Ubuntu+LDC successfully (tested on 12.04, but 12.10 shouldn't make a difference in this case).

Progress! :)

andrew@goldeneye:~/dub$ ./build.sh
Running ldmd2...
DUB has been built as bin/dub.

You may want to run
sudo ln -s /home/andrew/dub/bin/dub /usr/local/bin
now.

But still not there yet:

andrew@goldeneye:~/dub$ cd ../dtutor
andrew@goldeneye:~/dtutor$ dub
Illegal instruction (core dumped)

To complicate things a bit am not on Ubuntu 13.04. Trying everything I
can to make this work. Thanks for your assistance.

Regards,
Andrew

Pages: 1 2