gcc available, but not installed in fedora - linux

I installed gcc using sudo yum install gcc then I try compile c program it say gcc command not found then I try to update the gcc using sudo yum update gcc then it say Page(s) gcc available, but not installed I try to find an answer in google, but I'm unable to fined the solution. please can anyone help me ?

These steps might help check what the cause could be.
rpm -q gcc --> check if gcc is installed and managed by yum/rpm
which gcc --> check if gcc is in your search path for executables
gcc --version --> check if gcc works in the simplest way (perhaps the error came from incorrect source file path passed to it)

Finally I found the answer, first I did yum update audit then I install gcc using yum install gcc it works fine, thank you for your help

Related

How to fix 'Unable to locate package' error in apt-cyg

Im using Cygwin and I need to install a g++ compiler, so I tried with apt-cyg.
It returns an error that happens with some packages but not with others. For instance, I could install git package, which I found in blogs that talk about this topic to try it as an example. However, when trying g++:
$ apt-cyg install g++
Installing g++
Unable to locate package g++
What is going on?
First, I would suggest you use the standard Cygwin setup-x86_64.exe (or its 32-bit version if appropriate) rather than apt-cyg. Scanning the "Devel" category in setup, you will see a package gcc-g++, which is what you want.
The answer from #varro is correct. However, if you wish to use apt-cyg, you should take advantage of it's search capabilities.
apt-cyg search g++
returns gcc-g++.
Thus, you can execute the following apt-cyg command to install g++:
apt-cyg install gcc-g++

How to change the GCC version

I just install a kali-linux, and trying to play with it.
I did use ubuntu before. That cause some problems with different gcc version when I am trying to use some code what I build in my old Ubuntu.
I check the gcc -v; the kali give me
gcc version 6.1.1 20160802(Debian 6.1.1-11)
and ubuntu give me
gcc version 5.4.0 20160609 (ubuntu 5.4.0-6ubuntu1~16.04.2)
I am not sure if my code doesn't compile because of this or not. But just want to check.
how can I remove Debian's gcc and switch to ubuntu one?
May be i'm not much familiar with debian. But with Ubuntu, i've followed this and changed the gcc version. May be this will help.
Change default gcc version
You can use this command to install gcc versions.
sudo apt-get install gcc-4.3 gcc-4.4
Once installed, you have to update the alternatives with the variant gcc versions. Using
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 10
You can choose which version of gcc, you can use by this command.
sudo update-alternatives --config gcc

gcc-arm-linux-gnueabi command not found

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

Formats Error (could not find ldd binary)!

I'm using CentOS5 and trying to install a script that requires ldd.
I've tried:
yum install gcc glibc glibc-common
yum update gcc glibc glibc-common
Yum reinstall yum gcc glibc glibc-common
The first two say it's already installed, the latter obviously just reinstalls without error.
So my problem is the script I'm using (AVS) still claims the ldd binary is missing.
Is there a default directory where it should be installed? I have the following files:
ld
ldd
lddlibc4
In both /usr/bin and /usr/local/bin
Any help is greatly appreciated.
ldd is not a binary, it is a Text file, with bash script inside. You should debug your script (AVS) or contact with its author.
You may have removed ldd executable manually and yum/rpm can not detect that. You can download the "glibc-common" rpm package from some mirror and reinstall it by force.

"/usr/bin/ld: cannot find -lz"

I am trying to compile Android source code under Ubuntu 10.04. I get an error saying,
/usr/bin/ld: cannot find -lz
Can you please tell me how can I fix it? What does cannot find -lz mean? Here's the full error message:
external/qemu/Makefile.android:1101: warning: overriding commands for target `external/qemu/android/avd/hw-config-defs.h'
external/qemu/Makefile.android:933: warning: ignoring old commands for target `external/qemu/android/avd/hw-config-defs.h'
host SharedLib: libneo_cgi (out/host/linux-x86/obj/lib/libneo_cgi.so)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.a when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/lib/libneo_cgi.so] Error 1
And my GCC version output:
scheung#scheung-virtual-box:/media/EXTDIV/mydroid$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I already have the zlib1g-dev library installed:
$ sudo apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
zlib1g-dev is already the newest version.
(I get that from this link.)
I had the exact same error, and like you, installing zlib1g-dev did not fix it. Installing lib32z1-dev got me past it. I have a 64 bit system and it seems like it wanted the 32 bit library.
For x64 install zlib1g-dev.
sudo apt-get install zlib1g-dev
I don't need all the x86 libs ;)
sudo apt-get install libz-dev in ubuntu.
I just encountered this problem and contrary to the accepted solution of "your make files are broken" and "host includes should never be included in a cross compile"
The android build includes many host executables used by the SDK to build an android app.
In my case the make stopped while building zipalign, which is used to optimize an apk before installing on an android device.
Installing lib32z1-dev solved my problem, under Ubuntu you can install it with the following command:
sudo apt-get install lib32z1-dev
I had the exact same error, Installing zlib-devel solved my problem,
Type the command and install zlib package.
On linux:
sudo apt-get install zlib*
On Centos:
sudo yum install zlib*
Another possible cause: You've passed --static to the linker, but you only have a dynamic version of libz (libz.so), but not a version that can be statically linked (libz.a).
Try one of those three solution. It must work :) :
sudo apt-get install zlib1g-dev
sudo apt-get install libz-dev
sudo apt-get install lib32z1-dev
In fact what is missing is not the lz command, but the development files for the zlib library.So you should install zlib1g-devlib for ex to get it.
For rhel7 like systems the package is zlib-devel
It means you asked it to include the library 'libz.a' or 'libz.so' containing a compression package, and although the compiler found some files, none of them was suitable for the build you are using.
You either need to change your build parameters or you need to get the correct library installed or you need to specify where the correct library is on the link command line with a -L/where/it/is/lib type option.
This will show you clues about why the linker doesn't want the installed library:
LD_DEBUG=all make ...
I had the same problem in a different context: my system /lib/libz.so.1 had unsatisfied dependencies on libc because I was trying to relink on a different version of the OS.
for opensuse 12.3 (Dartmouth) (i586)
sudo zypper install zlib-devel zlib-devel-static
Others have mentioned that lib32z-dev solves the problem, but in general the required packages can be found here:
http://source.android.com/source/initializing.html
See "Installing required packages"

Resources