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.
Related
I am trying to cross-compile the Linux kernel for the beaglebone black on Ubuntu 22.04 using the command line below:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- bb.org_defconfig
I get the following error:
HOSTCC scripts/basic/fixdep
/bin/sh: 1: gcc: not found
make[2]: *** [scripts/Makefile.host:90: scripts/basic/fixdep] Error 127
make[1]: *** [Makefile:467: scripts_basic] Error 2
make: *** [Makefile:633: include/config/auto.conf.cmd] Error 2
As a result of various searches, I have verified that I have arm-linux-gnueabi-gcc in /bin:
/bin$ find . -maxdepth 1 -name "*gcc*" -print
./arm-linux-gnueabi-gcc-ranlib-11
./arm-linux-gnueabihf-gcc
./arm-linux-gnueabi-gcc-11
./arm-linux-gnueabi-gcc-nm
./arm-linux-gnueabihf-gcc-nm
./arm-linux-gnueabi-gcc-ranlib
./arm-linux-gnueabi-gcc-nm-11
./arm-linux-gnueabihf-gcc-ranlib
./arm-linux-gnueabihf-gcc-ar-11
./arm-linux-gnueabihf-gcc-ranlib-11
./arm-linux-gnueabihf-gcc-11
./arm-linux-gnueabi-gcc-ar
./arm-linux-gnueabihf-gcc-nm-11
./arm-linux-gnueabi-gcc
./arm-linux-gnueabihf-gcc-ar
./arm-linux-gnueabi-gcc-ar-11
that my path includes /bin:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
What am I missing?
In short: When cross-compiling Linux kernel, you need not only a cross-compiler, but a compiler (gcc) for your host too.
When build the Linux kernel and modules, the build system not only compiles binaries for the target platform, but also executes some programs on these binaries. These programs are shipped with the Linux kernel sources as sources, so for build these programs host compiler is needed.
By the way, a line started with HOSTCC means that exactly host compiler is used for that operation.
I'm doing some experiment on rpi4, and trying to reproduce this kernel module from github https://github.com/sysprog21/dont-trace on my rpi4. I encounter this problem:
make -C /lib/modules/`uname -r`/build M=/home/ubuntu/dont-trace modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.65-rt49-preemptrt-full-raspi'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110
You are using: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
CC [M] /home/ubuntu/dont-trace/dont_trace.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:289: /home/ubuntu/dont-trace/dont_trace.o] Error 126
make[2]: *** Deleting file '/home/ubuntu/dont-trace/dont_trace.o'
make[1]: *** [Makefile:1896: /home/ubuntu/dont-trace] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.65-rt49-preemptrt-full-raspi'
make: *** [Makefile:7: all] Error 2
The kernel here is cross-compiled from x86 server and do show above. I was wondering how to solve this problem & what's the root cause. I can make it on x86 server. It should be something fundamental knowledge I don't understand. Thks!
it seems work this time
My solution might be a bit workaround, but it works. I follow the clues /bin/sh: 1: scripts/basic/fixdep: Exec format error. So I copy the source code to local raspberry pi, and make modules_prepare to construct complete /scripts, then move it into /lib/modules/`uname -r\`/build. It remain the gcc version warning, but work properly.
Got below error when installing gtk+-3.0.5 from source code on CentOS Linux release 7.1.1503.
Error msg:
/usr/bin/ld: queryimmodules.o: undefined reference to symbol
'g_module_close' /usr/bin/ld: note: 'g_module_close' is defined in DSO
/lib64/libgmodule-2.0.so.0 so try adding it to the linker command line
/lib64/libgmodule-2.0.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
Environment:
[root#localhost gtk+-3.0.5]# cat /etc/*release CentOS Linux release
7.1.1503 (Core)
CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.1.1503 (Core) CentOS Linux release 7.1.1503
(Core)
[root#localhost gtk+-3.0.5]# uname -a Linux localhost.localdomain
3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
https://developer.gnome.org/gtk3/stable/gtk-building.html
./configure --prefix=/opt/gtk
GTK+ 3.0.5
GDK backends: x11 X11 extensions: XKB XI2 XFIXES DAMAGE
Print backends: file lpr Dynamic modules: yes Included
immodules: none PackageKit support: yes Introspection: no
Debugging: minimum Documentation: no
Make
... CCLD libgtk-3.la CC queryimmodules.o CCLD
gtk-query-immodules-3.0 /usr/bin/ld: queryimmodules.o: undefined
reference to symbol 'g_module_close' /usr/bin/ld: note:
'g_module_close' is defined in DSO /lib64/libgmodule-2.0.so.0 so try
adding it to the linker command line /lib64/libgmodule-2.0.so.0: could
not read symbols: Invalid operation collect2: error: ld returned 1
exit status make[4]: * [gtk-query-immodules-3.0] Error 1 make[4]:
Leaving directory /root/gtk/gtk+-3.0.5/gtk' make[3]: ***
[all-recursive] Error 1 make[3]: Leaving directory
/root/gtk/gtk+-3.0.5/gtk' make[2]: * [all] Error 2 make[2]: Leaving
directory /root/gtk/gtk+-3.0.5/gtk' make[1]: *** [all-recursive]
Error 1 make[1]: Leaving directory/root/gtk/gtk+-3.0.5' make: ***
[all] Error 2
# yum install gtk3-devel ... will provide version -3.8.8-10.el7
? Why do you want to use an old version ? Time stamp = 23 March 2011 !
When I try to run clang as my C compiler I get an error (I think a linker error)
Compilation started at Sun Nov 11 14:34:55
make -k
clang -std=c99 -ggdb -o0 -Wall -Werror helloworld.c -o helloworld
clang: warning: unknown platform, assuming -mfloat-abi=soft
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [helloworld] Error 1
Compilation exited abnormally with code 2 at Sun Nov 11 14:34:56
I actually re-installed the Raspbian image thinking that the problem would go away but it persists. Raspbian version is the latest Raspbian Wheezy hard float ABI (2012-10-28).
As you've essentially figured out, the installed clang is unusably broken. If you installed this through a package manager, complain to whoever distributes the package, because they clearly didn't bother testing it.
Hi I'm trying to build sqlcipher on ubuntu (11.10 minimal). On Mac OS X I had no problems though.
I followed the instructions from sqlcipher.net. First step was configure. I tried to execute configure with the following command:
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
but I got the following error message: "configure: error: C compiler cannot create executables"
In the config.log some lines caught my eyes but I don't know how to fix it:
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
configure:2544: $? = 0
configure:2551: gcc -V >&5
gcc: error: unrecognized option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2555: $? = 4
configure:2578: checking for C compiler default output file name
configure:2600: gcc -DSQLITE_HAS_CODEC -lcrypto conftest.c >&5
/usr/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status
Has anybody successfully build sqlcipher on ubuntu yet? Regards
You will need to install the GNU compiler toolchain in order to build from source. Execute the following command in a terminal.
$ sudo apt-get install build-essential