Difference between revisions of "Installing LDC on Gentoo"
Klickverbot (talk | contribs) (Created page with "There is a Gentoo portage overlay for the LDC compiler officially supported by the developers. To use it, simply add the URL for the overlay to <tt>/etc/layman/layman.cfg<...") |
m (Fixed citation) |
||
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | There is a Gentoo portage overlay for the [[LDC]] compiler officially supported by the developers. To use | + | There is a Gentoo portage overlay for the [[LDC]] compiler officially supported by the developers. You can add the overlay with layman. If you do not have layman yet then install it with |
+ | |||
+ | <pre> | ||
+ | emerge -av layman | ||
+ | </pre> | ||
+ | |||
+ | After that you have to add to <tt>/etc/portage/make.conf</tt> the following line: | ||
+ | |||
+ | <pre> | ||
+ | source "/var/lib/layman/make.conf" | ||
+ | </pre> | ||
+ | |||
+ | To use the [[LDC]] overlay, simply add our URL to <tt>/etc/layman/layman.cfg</tt>: | ||
<pre> | <pre> | ||
overlays : http://www.gentoo.org/proj/en/overlays/repositories.xml | overlays : http://www.gentoo.org/proj/en/overlays/repositories.xml | ||
https://raw.github.com/ldc-developers/gentoo-overlay/master/overlays.xml | https://raw.github.com/ldc-developers/gentoo-overlay/master/overlays.xml | ||
+ | </pre> | ||
+ | |||
+ | Then update the overlay list | ||
+ | |||
+ | <pre> | ||
+ | layman -L | ||
+ | </pre> | ||
+ | |||
+ | and add the [[LDC]] overlay: | ||
+ | |||
+ | <pre> | ||
+ | layman -a ldc | ||
+ | </pre> | ||
+ | |||
+ | To emerge [[LDC]] you simply type: | ||
+ | |||
+ | <pre> | ||
+ | emerge -av ldc2 | ||
+ | </pre> | ||
+ | |||
+ | Currently the [[LDC]] packages are marked as unstable. If you do not accept unstable packages globally then you have to add to <tt>/etc/portage/package.keywords</tt> the entry | ||
+ | |||
+ | <pre> | ||
+ | dev-lang/ldc2 ** | ||
+ | </pre> | ||
+ | |||
+ | == Hardened Gentoo == | ||
+ | Hardened Gentoo (and derivatives such as Sabayon) use a version of GCC that requires PIC executables and libraries. As LDC uses GCC for linking, this will result in errors such as: | ||
+ | <pre> | ||
+ | $ ldc2 test.d | ||
+ | /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: test.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC | ||
+ | test.o: could not read symbols: Bad value | ||
+ | collect2: error: ld returned 1 exit status | ||
+ | Error: /usr/bin/gcc failed with status: 1 | ||
+ | </pre> | ||
+ | |||
+ | This can be fixed by compiling Phobos with [https://github.com/ldc-developers/ldc/issues/630 BUILD_SHARED_LIBS] (which is currently unsupported and broken), or by using an alternate linker. e.g. | ||
+ | <pre> | ||
+ | env CC=/usr/bin/clang ldc2 test.d | ||
</pre> | </pre> | ||
== Resources == | == Resources == | ||
+ | [https://wiki.gentoo.org/wiki/Dlang Official Dlang overlay] | ||
+ | |||
[https://github.com/ldc-developers/gentoo-overlay Overlay repository on GitHub] | [https://github.com/ldc-developers/gentoo-overlay Overlay repository on GitHub] | ||
+ | |||
+ | [http://wiki.gentoo.org/wiki/Overlay Gentoo wiki on overlays] | ||
[[Category:LDC]] | [[Category:LDC]] |
Latest revision as of 14:40, 22 June 2014
There is a Gentoo portage overlay for the LDC compiler officially supported by the developers. You can add the overlay with layman. If you do not have layman yet then install it with
emerge -av layman
After that you have to add to /etc/portage/make.conf the following line:
source "/var/lib/layman/make.conf"
To use the LDC overlay, simply add our URL to /etc/layman/layman.cfg:
overlays : http://www.gentoo.org/proj/en/overlays/repositories.xml https://raw.github.com/ldc-developers/gentoo-overlay/master/overlays.xml
Then update the overlay list
layman -L
and add the LDC overlay:
layman -a ldc
To emerge LDC you simply type:
emerge -av ldc2
Currently the LDC packages are marked as unstable. If you do not accept unstable packages globally then you have to add to /etc/portage/package.keywords the entry
dev-lang/ldc2 **
Hardened Gentoo
Hardened Gentoo (and derivatives such as Sabayon) use a version of GCC that requires PIC executables and libraries. As LDC uses GCC for linking, this will result in errors such as:
$ ldc2 test.d /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: test.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC test.o: could not read symbols: Bad value collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1
This can be fixed by compiling Phobos with BUILD_SHARED_LIBS (which is currently unsupported and broken), or by using an alternate linker. e.g.
env CC=/usr/bin/clang ldc2 test.d