I've gotten a place of equipment from a supplier and it uses an old version of Debian Linux - I would like to install g++ on it so I can compile locally a program I'm using on other platforms (I understand the process of cross-compiling is complex and difficult).
However, I don't what apt-get to update any components on the device as there are hardware specific drivers/applications that have been provided by the manufacturer. How can I tell apt-get to install whatever version of g++ is already compatible with the OS?
Thanks for your help.
Edit:
I should add, the platform has a MIPS processor, which I don't see in the -arch options. Thanks for the help so far though.
Also, for the possibly of cross-compiling, I'm going from a Ubuntu laptop to the MIPS debian system.
check it may work
apt-get install gcc g++ gfortran
Related
So I'm not entirely new to Linux, but still struggle with its very many quirks and oddities.
I have an installation document for a complicated piece of software that I need to install on a Debian Bullseye machine. Unfortunately that document was written for CentOS and I now have to try that on Debian.
For some reason I first have to install gcc in its latest version, download the gcc version 5.4.0 and then use the latest gcc version to compile the 5.4.0 gcc version (would be great if somebody could explain to me why on earth anybody would want to compile a tool rather than just install it).
There was a call to a config script in the downloaded gcc files, followed by a make command, which according to the CentOS way I had to call like this:
cd gcc-5.4.0/
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++
make
That fails, it takes absolutely forever to finish and tells me at the end dereferencing pointer to incomplete type 'struct ucontext'. I should mention that I have my doubts about whether or not that zlib thing causes trouble, since the recommended zlib-devel is not available on Debian, I optet for something that I assumed would be equivalent on Debian, which would be zlib1g-dev, which was already pre-installed.
Is there a standard way to install gcc 5.4.0 on Debian? Of course I've tried to just install it in the specified version using sudo apt install gcc=5.4.0, which doesn't work because it seems that it is not available. I've tried to find on packages.debian.com what versions are available, but this website is such a delight that it is not possible for me to figure that out.
How would you normally install gcc in a specific version on Debian?
I am using Ubuntu for developing my c++ and others software .But the annoying thing about Ubuntu is most of the repositories it has are not the latest version .For example gcc compiler which I from
sudo apt-get install build-essential
Have version 4.6.x which not the latest version. I know Some people may say that I can Install GCC from the source and its not a problem .
But I want to know , Is there a Linux Distribution which already have all the latest repositories?
Arch Linux prides itself on having the bleeding edge in its distribution. The downside is that things sometimes break between releases, so if you aren't at least slightly confident in using Linux + the command line it isn't necessarily for you.
From where I can download the POSIX pthread library? I want to use pthread for both Windows (using gcc in MingW) and Linux. I found a link in sourceforge.net but it looks it is for Windows. Any help? Thanks!
Default installation of MinGW does not include pthread library. You must install additional packages: mingw32-libpthreadgc-dll, mingw32-libpthreadgc-dev.
Do not forget to install gcc compiler. The example of compile command:
gcc file_name.c -Wall -pthread -o file_name
To install new packages, you should use console command mingw-get or GUI packet manager.
If you’re using Ubuntu, you must execute of following command:
sudo apt-get install libc6 libc6-dev -y
There isn't a specific pthread library. Posix defines the interfaces that each system library must follow. Must modern linux distros will have libpthread installed or you can download it with youre package manage. On windows In is usually better to use the windows api as there is no explicit support for pthreads.
I'm having a hard time trying to install Qt on linux. I downloaded the .run file on the website and installed Qt. However, when I try to compile the default Hello World project using Qtcreator, I get the following :
error cannot find -lGL
I was able to solve the problem by issuing the command :
sudo apt-get install libqt4-dev
But, I'm not satisfied with the solution as I want to use Qt5 and the name of the lib I downloaded implies version 4. Can someone explain what is going on and tell me if my solution is correct? If not, what should I do to get a working Qt on Linux.
Additional question
The correct answer, as provided by LtWorf, was to install libgl-dev. For future problems of this sort, can someone tell me how I should have guessed that I had to download this particular library? And why are there some libs with -dev at the end? What do they provide?
Well it is trying to link with libgl and doesn't find it. You should install libgl-dev.
-l is a linker option, it tells the linker to use a certain library.
For example you can have -lmagic meaning that you want to use libmagic.
Normally all libraries are called libsomething, and on debian you will find 3 packages called:
libsomething
libsomething-dbg
libsomething-dev
The 1st one is the library, the second one is the library compiled with the debug symbols, so you can make sense of stacktraces more easily, and the final one is the development package, it contains the .h files so you can link to the library.
sudo apt-get install libgl-dev
On Fedora 17, I did:
sudo yum install mesa-libGL-devel
Do you have libgl-dev installed? If not install it and it should work.
Those other posters are correct, but on some systems, the lib to install is named differently. I just dealt with a 32bit Ubuntu 14.04.5 LTS system, and libgl-dev was not available.
Instead, I needed to install the libgl1-mesa-dev package via:
sudo apt-get install libgl1-mesa-dev
I am trying to install the gnu arm toolchain for ubuntu. I first downloaded the tar from CodeSourcery. However when I go into the bin folder, I cannot run any of the binaries. I have tried with ./ and without and putting it in the PATH and it keeps telling me "Command not Found" yet the file is there in the folder right in front of me. Then I tried sudo apt-get install gcc-arm-linux-gnueabi except after it says it has installed successfully, I cannot find it with whereis gcc-arm-linux-gnueabi. Can anyone help?
fixed, using:
sudo apt-get install gcc-arm*
Are you compiling on a 64-bit OS? Try:
sudo apt-get install ia32-libs
I had the same problem when trying to compile the Raspberry Pi kernel. I was cross-compiling on Ubuntu 12.04 64-bit and the toolchain requires ia32-libs to work on on a 64-bit system.
See http://hertaville.com/2012/09/28/development-environment-raspberry-pi-cross-compiler/
CodeSourcery convention is to use prefix arm-none-linux-gnueabi- for all executables, not gcc-arm-linux-gnueabi that you mention. So, standard name for CodeSourcery gcc would be arm-none-linux-gnueabi-gcc.
After you have installed CodeSourcery G++, you need to add CodeSourcery directory into your PATH.
Typically, I prefer to install CodeSourcery into directory like /opt/arm-2010q1 or something like that. If you don't know where you have installed it, you can find it using locate arm-none-linux-gnueabi-gcc, however you may need to force to update your locate db using sudo updatedb before locate will work properly.
After you have identified where your CodeSourcery is installed, add it your PATH by editing ~/.bashrc like this:
PATH=/opt/arm-2010q1/bin:$PATH
Also, it is customary and very convenient to define
CROSS_COMPILE=arm-none-linux-gnueabi-
in your .bashrc, because with CROSS_COMPILE defined, most tools will automatically use proper compiler for ARM compilation without you doing anything.
if you are on 64 bit os then you need to install this additional libraries.
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
got the same error when trying to cross compile the raspberry pi kernel on ubunto 14.04.03 64bit under VM. the solution was found here:
-Install packages used for cross compiling on the Ubuntu box.
sudo apt-get install gcc-arm-linux-gnueabi make git-core ncurses-dev
-Download the toolchain
cd ~
git clone https://github.com/raspberrypi/tools
-Add the toolchain to your path
PATH=$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
notice the x64 version in the path command
I was also facing the same issue and resolved it after installing the following dependency:
sudo apt-get install lib32z1-dev
If you are on a 64bit build of ubuntu or debian (see e.g. 'cat /proc/version') you should simply use the 64bit cross compilers, if you cloned
git clone https://github.com/raspberrypi/tools
then the 64bit tools are in
tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64
use that directory for the gcc-toolchain.
A useful tutorial for compiling that I followed is available here Building and compiling Raspberry PI Kernel (use the -x64 path from above as ${CCPREFIX})
You have installed a toolchain which was compiled for i686 on a box which is running an x86_64 userland.
Use an i686 VM.
Its a bit counter-intuitive. The toolchain is called gcc-arm-linux-gnueabi. To invoke the tools execute the following: arm-linux-gnueabi-xxx
where xxx is gcc or ar or ld, etc
try the following command:
which gcc-arm-linux-gnueabi
Its very likely the command is installed in /usr/bin.
I had to cross compile C code in Ubuntu for ARM. This worked for me:
$ sudo apt install gcc-arm-none-eabi
Later, tested it on the qemu emulator
#Install qemu
sudo apt-get install qemu qemu-user-static qemu-system-arm
#Cross compile "helloworld.c"
$ arm-none-eabi-gcc --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lm -lrdimon -Wl,--end-group helloworld.c -o helloworld
#Run
qemu-arm-static helloworld