Compiling With LDC2 and GDC
I had ldc2 and gdc compiled from source and working up until a month ago. Nothing has changed, except I can't remember the variable(s) I would set in the terminal to get ldc2 and gdc to work.
I get the following errors when trying to compile D source code;
gdc:
$ /home/Code/D/gdc/Bin/usr/local/bin/gdc -o t4 t4.d /home/Code/D/gdc/Bin/usr/local/bin/../libexec/gcc/x86_64-unknown-li开发者_如何学编程nux-gnu/4.4.5/cc1d: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory
ldc2:
$ /home/Code/D/ldc2/bin/ldc2 -o t4 t4.d /home/Code/D/ldc2/bin/ldc2: error while loading shared libraries: libconfig++.so.8: cannot open shared object file: No such file or directory
I can't remember if it was just an addition to PATH or something to DFLAGS. Any ideas?
EDIT: Recompiling both LDC2 and GDC solved the problem, but I still don't know why I was getting the errors.
The error with LDC means that you (re)moved libconfig++ after you compiled it. PATH
and DFLAGS
are unrelated, but as Dan noted in his answer, LD_LIBRARY_PATH
can be used to add extra locations to the search path.
If you want to have a self-contained installation for whatever reason, you can set the RPATH to the bin
directory and copy libconfig++ there, as it is done when building the binary packages: https://github.com/ldc-developers/ldc-scripts/blob/master/ldc2-packaging/2-build-ldc.sh#L18.
Same story for the GDC error – it depends on the GNU MPFR library, which was either removed, or replaced with an incompatible version during an upgrade.
This error can occur if the .so
files are not in your $LD_LIBRARY_PATH
, I think.
精彩评论