Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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; with 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-linux-gnu/4.4.5/cc1d: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory

With 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?

share|improve this question
up vote 1 down vote accepted

Here you can't even run the compiler executable, because it can't find the libraries it needs. gdc is looking for libmpfr.so.1 and ldc2 is looking for libconfig++.so.8.

If these libraries are still present on your system, perhaps in /home/Code/D/gdc/Bin/usr/local/lib, you can add that directory to the LD_LIBRARY_PATH environment variable (on most unices; on Mac OS X, the variable is called DYLD_LIBRARY_PATH).

LD_LIBRARY_PATH=/home/Code/D/gdc/Bin/usr/local/lib gdc …

You may want to write wrapper scripts to run gdc and ldc2, or put this in your ~/.profile:

export LD_LIBRARY_PATH=/home/Code/D/gdc/Bin/usr/local/lib

If these libraries were in /usr/lib and disappeared in a system upgrade, you'll have to either restore the required versions, or recompile the D tools for the new versions of the libraries.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.