gcc compiler not found - rhel

When I check location of gcc I get correct output. But when I try to get gcc version I get command not found.
I have added the path to $PATH
echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/ptladmin/bin:/usr/libexec/gcc
whereis gcc
gcc: /usr/libexec/gcc
gcc --version
-bash: gcc: command not found
I am trying to install a pakcage I keep getting configure: error: no acceptable C compiler found in $PATH
uname -a
Linux deehxpy011ccpra 2.6.18-419.el5 #1 SMP Wed Feb 22 22:40:57 EST 2017 x86_64 x86_64 x86_64 GNU/Linux

Related

Python: Unable to install TA-lib in Oracle AArch64 VM ubuntu

I unable to Ta-lib, a module for technical analysis in python3 in an always free ARM 64(AArch64) Amepere processor with Ubuntu 20 from Oracle cloud. To verify if the steps I followed are correct, I manage to install successfully in a X64 VM with AMD processor. Thus, I tink AArch64 may need some tweak to install Ta-lib.
The steps I used are below (https://sachsenhofer.io/install-ta-lib-ubuntu-server/)
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure
make
sudo make install
The error I found in my Ubuntu terminal for ./configure as below
<pre>
ta-lib-0.4.0-src.tar.gz 100%[=====================================================================================================>] 1.27M --.-KB/s in 0.03s
2021-09-02 09:32:28 (47.0 MB/s) - ‘ta-lib-0.4.0-src.tar.gz’ saved [1330299/1330299]
<font color="#55FF55"><b>ubuntu#algo3</b></font>:<font color="#5555FF"><b>~</b></font>$ tar -xzf ta-lib-0.4.0-src.tar.gz
<font color="#55FF55"><b>ubuntu#algo3</b></font>:<font color="#5555FF"><b>~</b></font>$ cd ta-lib/
<font color="#55FF55"><b>ubuntu#algo3</b></font>:<font color="#5555FF"><b>~/ta-lib</b></font>$ sudo ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking build system type... ./config.guess: unable to guess system type
This script, last modified 2006-07-02, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
and
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
If the version you run (./config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches#gnu.org> in order to provide the needed
information to handle your system.
config.guess timestamp = 2006-07-02
uname -m = aarch64
uname -r = 5.8.0-1037-oracle
uname -s = Linux
uname -v = #38~20.04.1-Ubuntu SMP Fri Jul 16 00:56:44 UTC 2021
/usr/bin/uname -p = aarch64
/bin/uname -X =
hostinfo =
/bin/universe =
/usr/bin/arch -k =
/bin/arch = aarch64
/usr/bin/oslevel =
/usr/convex/getsysinfo =
UNAME_MACHINE = aarch64
UNAME_RELEASE = 5.8.0-1037-oracle
UNAME_SYSTEM = Linux
UNAME_VERSION = #38~20.04.1-Ubuntu SMP Fri Jul 16 00:56:44 UTC 2021
configure: error: cannot guess build type; you must specify one
<font color="#55FF55"><b>ubuntu#algo3</b></font>:<font color="#5555FF"><b>~/ta-lib</b></font>$
</pre>
It turns out having an installed x86_64 version of TA-Lib will interfere with the installation of the arm64 version of TA-Lib.
please uninstall the x86_64 version of TA-Lib using brew uninstall ta-lib first before installing the arm64 version of TA-Lib.
Some possible debugging:
➜ which brew
/opt/homebrew/bin/brew
➜ brew --prefix ta-lib
/opt/homebrew/opt/ta-lib
➜ file $(brew --prefix ta-lib)/lib/libta_lib.dylib
/opt/homebrew/opt/ta-lib/lib/libta_lib.dylib: Mach-O 64-bit dynamically linked shared library arm64
➜ which python3
/opt/homebrew/bin/python3
➜ file /opt/homebrew/lib/python3.9/site-packages/talib/_ta_lib.cpython-39-darwin.so
/opt/homebrew/lib/python3.9/site-packages/talib/_ta_lib.cpython-39-darwin.so: Mach-O 64-bit bundle arm64
➜ ~ python3
Python 3.9.2 (default, Mar 26 2021, 15:28:17)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import talib
>>> talib.__ta_version__
b'0.4.0 (Nov 25 2020 22:11:03)'
checking build system type... ./config.guess: unable to guess system type
This script, last modified 2006-07-02, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
and http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
Just download the newsest config.guess config.sub from the source and repeat the configure & make install progress. ta-lib will install successfully.
ta-lib-config --version
0.4.0

Linux does not use the same cc program found in $PATH

I installed another version of gcc (9.2.0) to a non-default folder in my Linux machine and pointed $PATH to that new location. gcc and g++ are working but there is no cc so I made a symlink:
ln -s $HOME/.local/bin/gcc $HOME/.local/bin/cc
I thought cc now points to the correct one
$ ~/.local/bin/cc --version
cc (GCC) 9.2.0
$ which cc
~/.local/bin/cc
but without the full path, cc still uses the old version
$ cc --version
cc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
I could not understand how this could happen. Any help is appreciated.

How to fix exec format error on 64-bit Linux?

I am learning x86_64 assembly. But I have run into the following problem:
I am assembling a program with gcc -g -c exercise1.s -o exercise1.o and linking it with ld -g -o exercise1 exercise1.o -m elf_x86_64
However when I try to run the program I get the following error: bash: ./exercise1: cannot execute binary file: Exec format error
Running uname -a I get Linux lubuntu 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux and arch outputs x86_64.
file outputs exercise1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), corrupted program header size, with debug_info, not stripped.
To me it seems that I am trying to run a 64-bit program on a 64-bit kernel on a 64-bit CPU. Why is it not working?

Error during install of gfortran lapack for JAGS

I am new to Linux and unfamiliar with gfortran.
I am trying to install gfortran lapack (according to instructions here) to install JAGS for R on a Linux Mint 17.2 64 bit machine. My system settings are:
[14:20] ~/lapack-3.6.1$ uname -a
Linux X1Carbon 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
On running make in the lapack directory, this is the error received:
[14:10] ~/lapack-3.6.1$ make
( cd INSTALL; make; ./testlsame; ./testslamch; ./testdlamch; \
./testsecond; ./testdsecnd; ./testieee; ./testversion )
make[1]: Entering directory `/home/joanna/lapack-3.6.1/INSTALL'
gfortran -O2 -mtune=pentium4 -c lsame.f -o lsame.o
f951: error: CPU you selected does not support x86-64 instruction set
make[1]: *** [lsame.o] Error 1
make[1]: Leaving directory `/home/joanna/lapack-3.6.1/INSTALL'
/bin/sh: 1: ./testlsame: not found
/bin/sh: 1: ./testslamch: not found
/bin/sh: 1: ./testdlamch: not found
/bin/sh: 2: ./testsecond: not found
/bin/sh: 2: ./testdsecnd: not found
/bin/sh: 2: ./testieee: not found
/bin/sh: 2: ./testversion: not found
make: *** [lapack_install] Error 127
Other sites such as here reference a similar error but it is to do with a -march=i686 flag which is not present in the gfortran command line that is run.
Could anyone suggest what the problem is and how to fix it? Many thanks in advance.

While building 32-bit executable file in 64-bit Linux I get crt1.o: No such file even with the -m32 flag

My Linux Server information is:
[root#centos nan]# uname -a
Linux centos 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
By default, the gcc will generate the 64-bit executable file, so I use the "-m32" flags to build 32-bit executable file.
After running the following command:
[root#centos nan]# gcc -m32 -o a a.c
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
So how to build 32-bit executable file in 64-bit Linux?

Resources