Thread overview
Can't seem to compile on Arch Linux with gdc
March 31
Trying to compile an empty main file:

$ cat main.d
void main() {}

$ gdc main.d
gdc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found
compilation terminated.

----
From http://forum.dlang.org/thread/uthyqncmcqbnvwqzcykh@forum.dlang.org

$ gdc -fno-lto -fno-use-linker-plugin main.d
ld: -f may not be used without -shared

----
Trying again with shared

$ gdc -fno-lto -fno-use-linker-plugin -shared main.d
ld: cannot find crtbeginS.o: No such file or directory
ld: cannot find -lgcc

----
Trying again with link debug on:

$ gdc -fno-lto -fno-use-linker-plugin -shared -Xlinker --verbose main.d
...
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/libgcc_s.so failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/libgcc_s.a failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libgcc_s.so succeeded
opened script file /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libgcc_s.so
opened script file /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libgcc_s.so
attempt to open libgcc_s.so.1 failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/libgcc_s.so.1 failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libgcc_s.so.1 succeeded
libgcc_s.so.1 (/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libgcc_s.so.1)
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/libgcc.so failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/libgcc.a failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libgcc.so failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libgcc.a failed
attempt to open /lib/../lib/libgcc.so failed
attempt to open /lib/../lib/libgcc.a failed
attempt to open /usr/lib/../lib/libgcc.so failed
attempt to open /usr/lib/../lib/libgcc.a failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../libgcc.so failed
attempt to open /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../libgcc.a failed
attempt to open /usr/x86_64-pc-linux-gnu/lib64/libgcc.so failed
attempt to open /usr/x86_64-pc-linux-gnu/lib64/libgcc.a failed
attempt to open /usr/lib/libgcc.so failed
attempt to open /usr/lib/libgcc.a failed
attempt to open /usr/local/lib/libgcc.so failed
attempt to open /usr/local/lib/libgcc.a failed
attempt to open /usr/x86_64-pc-linux-gnu/lib/libgcc.so failed
attempt to open /usr/x86_64-pc-linux-gnu/lib/libgcc.a failed
ld: cannot find -lgcc

----
The installed version of gcc on my system is gcc version 6.3.1 20170306 (GCC)

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 6.3.1 20170306 (GCC)

----
The LDC version is based on gcc 6.2.1

$ gdc -v
Using built-in specs.
COLLECT_GCC=gdc
Target: x86_64-pc-linux-gnu
Configured with: /build/gdc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-shared --enable-static --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-default-pie --disable-multilib --disable-werror --enable-languages=d gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
gcc version 6.2.1 20160830 (GCC)

----
libgcc.{a|so} does not exist on my system but libgcc_s.{a|so} does.

$ find /usr -name "libgcc*"
find: ā€˜/usr/share/polkit-1/rules.dā€™: Permission denied
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/libgcc_eh.a
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/libgcc.a
/usr/lib/libgccpp.so.1.0.3
/usr/lib/libgccpp.so
/usr/lib/libgccpp.so.1
/usr/lib/libgcc_s.so
/usr/lib/libgcc_s.so.1
/usr/lib32/libgcc_s.so
/usr/lib32/libgcc_s.so.1

I can add a symbolic link to /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/libgcc.a in /usr/lib but is this the right fix?

Guillaume
April 01
Am Fri, 31 Mar 2017 09:11:06 +0000
schrieb Guillaume Chatelet <chatelet.guillaume@gmail.com>:

> I can add a symbolic link to /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/libgcc.a in /usr/lib but is this the right fix?

This is because the GCC package in archlinux has been updated to GCC 6.3.1 but GDC has not been updated and was built with GCC 6.2.1. Unfortunately Dicebot stopped maintaining the D packages for Archlinux. I'm not sure about other packages, but the GDC package is currently orphaned (no maintainer)...

As a workaround you can simply rebuild the GDC package using the PKGBUILD and bump the GCC version.

-- Johannes

April 01
On Friday, 31 March 2017 at 22:23:01 UTC, Johannes Pfau wrote:
> Am Fri, 31 Mar 2017 09:11:06 +0000
> schrieb Guillaume Chatelet <chatelet.guillaume@gmail.com>:
>
>> I can add a symbolic link to /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/libgcc.a in /usr/lib but is this the right fix?
>
> This is because the GCC package in archlinux has been updated to GCC 6.3.1 but GDC has not been updated and was built with GCC 6.2.1. Unfortunately Dicebot stopped maintaining the D packages for Archlinux. I'm not sure about other packages, but the GDC package is currently orphaned (no maintainer)...
>
> As a workaround you can simply rebuild the GDC package using the PKGBUILD and bump the GCC version.
>
> -- Johannes

Will do. Thanks!