1

Is it possible to move a compiler that is installed on one system (aarch64 5.4 on Ubuntu 16.04) onto another system off of a home directory? I want to do this because I need to run this compiler on a system that I don't have privileges on.

I've tried it with a helloworld program and gotten it to the link stage but ld is looking for libraries with the original path appended:

{dseltz@ubuntu1604-64:437} aarch64-linux-gnu-g++-5 -isystem/home/dseltz/GNUTest/aarch64-linux-gnu/include/c++/5 -isysroot /home/dseltz/GNUTest -I/home/dseltz/GNUTest/usr/include/c++/5/aarch64-linux-gnu -B/home/dseltz/GNUTest/gcc_exec_files -B/home/dseltz/GNUTest/aarch64-linux-gnu -L/home/dseltz/GNUTest/aarch64-linux-gnu/lib  -L/home/dseltz/GNUTest/x86_64-linux-gnu --sysroot=/home/dseltz/GNUTest/aarch64-linux-gnu/lib -o Helloworld Helloworld.cpp
/home/dseltz/GNUTest/gcc_exec_files/aarch64-linux-gnu/../../aarch64-linux-gnu/bin/ld: cannot find /usr/aarch64-linux-gnu/lib/libc.so.6 inside /home/dseltz/GNUTest/aarch64-linux-gnu/lib
/home/dseltz/GNUTest/gcc_exec_files/aarch64-linux-gnu/../../aarch64-linux-gnu/bin/ld: cannot find /usr/aarch64-linux-gnu/lib/libc_nonshared.a inside /home/dseltz/GNUTest/aarch64-linux-gnu/lib
/home/dseltz/GNUTest/gcc_exec_files/aarch64-linux-gnu/../../aarch64-linux-gnu/bin/ld: cannot find /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 inside /home/dseltz/GNUTest/aarch64-linux-gnu/lib
collect2: error: ld returned 1 exit status

Note these libraries do exist in /home/dseltz/GNUTest/aarch64-linux-gnu/lib.

Any ideas? Just a bad idea?

  • 1
    It would probably be simpler to setup a cross-compiler on your own machine and then copy the cross-compiled program on the target system. – Julie Pelletier Feb 3 '17 at 4:59
  • I think that's what I'm doing. I installed the aarch64 cross compiler on my x64 Ubuntu system. Now I'm trying to move that to another x64 Ubuntu system that I don't have privileges on. – David Seltz Feb 3 '17 at 5:02
  • 1
    I don't think you can just "move" it - it will depend on certain paths where you can't install files on the unpreviliged system. You'll have to recompile it from source with the correct paths for where you want to install it. – dirkt Feb 3 '17 at 9:18
  • Yes, but to install source there are too many things I have to "sudo apt-get install" first. But I think you're right, there are too may hard-coded paths. – David Seltz Feb 3 '17 at 13:25
  • If there is (or you can create) a directory on your own machine whose path exactly matches the path into which you want to install the compiler on the target machine, you could cross-compile into that path on your machine and then copy the entire install directory to the target machine. But you'll also need to cross-compile the libraries which gcc itself depends on, as well as binutils, so it is not going to be simple. – rici Feb 3 '17 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.