I have a cross-compiler in my home folder on Ubuntu 13.10 (64-bit). I downloaded it here at the bottom of the page where it says "Prebuilt Toolchains". When I try to compile something it gives me this:
cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
After goggling a little I found this. I tried the commands the author wrote to enter; but they will not help me, since I am having this problem with a cross-compiler from the home dictionary, not the system compiler. Can anyone help?
EDIT: Here is the file I am trying to cross-compile:
void print(char *message, int line,int ch){
char *vm=(char *)0xb8000;
int i=(line*80*2);
i=i+(ch*2);
while(*message!=0){
if (*message=='\n'){line++;
i=(line*80*2);}
else {vm[i]=*message;
i++;
vm[i]=0x07;
i++;} *message++;}}
void kernel_main(){
print("Hello!\nHow do you like my kernel?",0,0);}
I also have an assembly file written in AT&T syntax that calls kernel_main().
I solved cc1: error while loading shared libraries: libmpc.so.2
as follows:
Install libmpc3
via repo and make symlink (dirty method, but worked):
sudo apt-get install libmpc*
or (if toolchain for i386):
sudo apt-get install libmpc*:i386
in /usr/lib/i386-linux-gnu
for i386 or in /usr/lib/x86_64-linux-gnu
for amd64:
sudo ln -s libmpc.so.3.0.0 libmpc.so.2
Could you find libmpc.so.3 in /usr/lib or /usr/lib64? If you found it or the same thing, you need replace it with libmpc.so.2 file. That file can find in different Linux version lower.
My error disappeared after I had issued the following commands:
export LD_LIBRARY_PATH="/usr/local/lib"
sudo ldconfig
ldconfig
is the magic.
version 2 of libmpc (i.e. libmpc.2.dynlib) is build from versions 0.7 - 0.9 of the source (find the download archives at www.multiprecision.org). Versions earlier than 0.9 appear to be incompatible with newer versions of GMP so I'd try building that one first. I was able to build and use 0.9 on my OsX El Capitan system after installing gcc 4.8, gmp, and mpfr:
brew tap homebrew/versions
brew install gcc48
brew install gmp
brew install mpfr
Then in the mpc-0.9 dirctory:
./configure --with-gmp=/usr/local/Cellar/gmp/6.1.0 --with-mpfr=/usr/local/Cellar/mpfr/3.1.3
make
sudo make install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With