Make: Command not found, but command exists? - linux

So I have a make file which uses arm-eabi-none-xxx commands, but when I run make I get a "Command not Found" error:
bash-4.2$ make
arm-none-eabi-as -I source/ source/mailbox.s -o build/mailbox.o
make: arm-none-eabi-as: Command not found
make: *** [build/mailbox.o] Error 127
Weird bit, is the command exists and is in my path (the following is in the same directory as the makefile):
bash-4.2$ arm-none-eabi-as --version
GNU assembler (Sourcery G++ Lite 2008q3-66) 2.18.50.20080215
This assembler was configured for a target of `arm-none-eabi'.
And I can run the command that make is running:
bash-4.2$ arm-none-eabi-as -I source/ source/mailbox.s -o build/mailbox.o
bash-4.2$ ls build/
README mailbox.o
So. I read that make uses the shell to execute commands if ./ is in the current path, so I've tried that but no good. Originally I couldn't run arm-none-eabi-as at all as it's a 32-bit binary and I'm running on a 64 bit system (Slackware 14.0) but I followed the instructions here to install the 32-bit libraries etc..
So the question... what stupid schoolboy mistake am I making?

Did you run 'make' as sudo, or root? In that case, it doesn't work for me.
What I had to do was mkdir a 'build' folder, and simply run 'make'. It worked.

Related

Error while creating rpm package using rpmbuild from spec file

I want to build a rpm package from a spec file(hello-world.spec).The command and error output are given below
Command1:
rpmbuild -ba hello-world.spec
ErrorOutput1:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.z4GoQn
+ umask 022
+ cd /root/rpmbuild/BUILD
+
: not foundm-tmp.z4GoQn: 28: /var/tmp/rpm-tmp.z4GoQn:
error: Bad exit status from /var/tmp/rpm-tmp.z4GoQn (%prep)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.z4GoQn (%prep)
Content of my spec file is
Name: hello-world
Version: 1
Release: 1
Summary: Most simple RPM package
License: FIXME
%description
This is my first RPM package, which does nothing.
%prep
# we have no source, so nothing here
%build
cat > hello-world.sh <<EOF
#!/usr/bin/bash
echo Hello world
EOF
%install
mkdir -p %{buildroot}/usr/bin/
install -m 755 hello-world.sh %{buildroot}/usr/bin/hello-world.sh
%files
/usr/bin/hello-world.sh
%changelog
# let's skip this for now
My System/software details are
OS: Ubuntu 16.04
RPM version:4.12.0.1
The list of contents in rpmbuild folder is
Command2:
:~/rpmbuild# ls
Output2:
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
Can anybody help on this issue?
Check how your files is being generated. If you are passing files from windows to Linux, usually, there are different EOL for the files. We had a similar issue, I recommend you to change all the files to Unix format. I'm sharing with you how to reproduce your issue, if you edit that file in a Linux environment, like "nano", the problem disappears.

possible missing library when running cmake

I am trying to install a program on my machine (running Linux), but I get the following error when I run make:
Starting build...
Working Directory : /home/laptop/mplabs_test
Build Type :
Generating OMP binary...
/bin/sh: 1: Syntax error: "&" unexpected
make: *** [lbs3d] Error 2
What is wrong, am I missing a library?
You can control the shell that make uses for executing recipes by setting the SHELL variable in the makefile.
If that makefile uses bash-specific features then it should be setting SHELL=/bin/bash already. Since it appears it isn't doing that you get to do that yourself instead.
Either modify the makefile in question or use
make SHELL=/bin/bash
instead of just running make.
The problem is that the Makefile uses bash specific syntax (|&) but the commands are executed by /bin/sh, which does not point to /bin/bash.
On my computer (Ubuntu 14.04):
ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Sep 16 2014 /bin/sh -> dash
A solution could be to let the symbolic link /bin/sh point to /bin/bash:
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh

Without admin prevlieges, how do I find the directories searched by ld?

How do I find the directories searched in by the GNU linker, without admin privileges?
I can get the listing in the following way:
$ sudo ldconfig -v 2>/dev/null | grep -v ^$'\t'
/lib/i386-linux-gnu:
/usr/lib/i386-linux-gnu:
/usr/local/lib:
/lib/x86_64-linux-gnu:
/usr/lib/x86_64-linux-gnu:
/usr/lib/fglrx:
/usr/lib32/fglrx:
/lib32:
/usr/lib32:
/lib:
/usr/lib:
/usr/lib/i386-linux-gnu/sse2: (hwcap: 0x0000000004000000)
this solution came from: How to print the ld(linker) search path
However, on a machine where I do not have admin privileges, this will not work. I assume that’s because ldconfig is located in /sbin/. I download glibc and installed it locally to create another version of ldconfig. I guess that was silly though because the local version gives me:
/usr/local/lib:
/usr/local/lib64:
Is it still possible to get all the directories as a non-admin?
There doesn't appear to be any helpful ld flags, or environment variables to do the job.
Just because ldconfig is in sbin doesn't mean it can't be run as a normal user. Simply use that command and specify the full path to ldconfig:
/sbin/ldconfig -v 2>/dev/null | grep -v ^$'\t'

linuxfromscratch: Can't do make menuconfig for linux installing

On this chapter http://www.linuxfromscratch.org/lfs/view/stable/chapter08/kernel.html
root#host# chroot "$LFS" /usr/bin/env -i \
> HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
> PATH=/bin:/usr/bin:/sbin:/usr/sbin \
> /bin/bash --login
root:/# cd sources/linux-3.2.6
root:/sources/linux-3.2.6# make mrproper
CLEAN scripts/basic
CLEAN scripts/kconfig
CLEAN include/config
root:/sources/linux-3.2.6# make menuconfig
HOSTCC scripts/basic/fixdep
gcc: error trying to exec 'as': execvp: No such file or directory
make[1]: *** [scripts/basic/fixdep] Error 1
make: *** [scripts_basic] Error 2
Why am i gettting such error?
Updating
Got the answer, it is binutils installation related, may be corrupted installation of binutis.
http://www.linuxquestions.org/questions/linux-software-2/gcc-error-trying-to-exec-%27as%27-execvp-no-such-file-or-directory-906750/
`gcc: error trying to exec 'cc1': execvp: No such file or directory` When compile program with `popen` in php
You need to install GNU Binutils package.
http://www.gnu.org/software/binutils/

Where can I get the files to install f2c on redhat linux?

I am looking for an rpm or simple install instructions for getting f2c to work on my redhat linux os. I am new to linux and it is difficult finding something like this on google.
(The goal is to use f2c to convert a simple fortran77 file to c, then compile)
Does anybody have any suggestions?
Getting the source with rsync (recommended):
$ rsync -avz netlib.org::netlib/f2c/src f2c
Getting the sources via FTP:
$ mkdir -p f2c/src
$ cd f2c/src
$ ftp ftp.netlib.org
ftp> cd f2c
ftp> prompt
ftp> mget *
To build the sources, in the f2c/src directory do:
$ make -f makefile.u
To install the binary, copy it to a directory in your $PATH:
$ mkdir -p /usr/local/bin /usr/local/man/man1
$ cp f2c /usr/local/bin
$ cp f2c.1t /usr/local/man/man1
To compile Fortran programs you will also need libf2c:
$ mkdir libf2c
$ cd libf2c
$ unzip ../libf2c.zip
$ make -f makefile.u
$ make -f makefile.u install LIBDIR=/usr/local/lib
libf2c is a combination of the libF77 and libI77 libraries. You can install these libraries separately and then link with "-lF77 -lI77". Assuming f2c/src is available from the current directory, save libF77 and libI77 and do the following (not necessary if you have already installed libf2c above):
$ sh libf77
$ sh libi77
$ cd libF77
$ make CFLAGS=-I../f2c/src
$ make install LIBDIR=/usr/local/lib
$ cd ../libI77
$ make CFLAGS=-I../f2c/src
$ make install LIBDIR=/usr/local/lib
The fc shell script is a nice frontend to use with f2c. Save it somewhere and do:
$ cp fc /usr/local/bin/f77
$ chmod 755 /usr/local/bin/f77
I renamed it to f77 to avoid conflicts, since fc is a bash builtin. The fc script expects libf2c rather than libF77 and libI77, so you have to edit it and replace "-lf2c" with "-lF77 -lI77" if you have installed these libraries instead of libf2c above.
Finally, to compile your program you can do:
$ f77 source.f -o binary
Also check out the f2c parent directory. It contains getopt.c, f2c.pdf and some other stuff that may be useful.
For more further information about f2c consult the readme (less f2c/src/readme) and the manpage (man f2c). For further information about the fc script look at the comments at the beginning of the file.
You can get a precompiled f2c package from ATrpms: http://atrpms.net/name/f2c/
It does include both the headers (such as f2c.h) and the library (libf2c) in standard directories, so you shouldn't have any trouble compiling after that.
Otherwise, you could try to compile directly with a free Fortran compiler; try gfortran. If not installed, it's in package gcc-gfortran, so you can install it with the command: yum install gcc-gfortran.

Resources