make does not work on raspbian
ktphys opened this issue · 35 comments
I copied the actual version of libserial onto my RPI3 with the actual Raspian version ( Debian GNU/Linux) and gcc etc. all updated.
"configure" works, but not the generated "Makefile".
Here is the output, which marks some problems with the option "CXX":
$ make
make all-recursive
make[1]: Entering directory '/usr/src/libserial-0.6.0rc2'
Making all in src
make[2]: Entering directory '/usr/src/libserial-0.6.0rc2/src'
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -Weffc++ -g -O2 -MT SerialStreamBuf.lo -MD -MP -MF .deps/SerialStreamBuf.Tpo -c -o SerialStreamBuf.lo SerialStreamBuf.cc
../libtool: 1578: ../libtool: preserve_args+= --tag CXX: not found
../libtool: 1: eval: base_compile+= g++: not found
../libtool: 1: eval: base_compile+= -DHAVE_CONFIG_H: not found
../libtool: 1: eval: base_compile+= -I.: not found
../libtool: 1: eval: base_compile+= -I..: not found
../libtool: 1: eval: base_compile+= -Weffc++: not found
../libtool: 1: eval: base_compile+= -g: not found
../libtool: 1: eval: base_compile+= -O2: not found
../libtool: 1: eval: base_compile+= -MT: not found
../libtool: 1: eval: base_compile+= SerialStreamBuf.lo: not found
../libtool: 1: eval: base_compile+= -MD: not found
../libtool: 1: eval: base_compile+= -MP: not found
../libtool: 1: eval: base_compile+= -MF: not found
../libtool: 1: eval: base_compile+= .deps/SerialStreamBuf.Tpo: not found
../libtool: 1: eval: base_compile+= -c: not found
libtool: compile: you must specify a compilation command
libtool: compile: Try `libtool --help --mode=compile' for more information.
Makefile:445: recipe for target 'SerialStreamBuf.lo' failed
make[2]: *** [SerialStreamBuf.lo] Error 1
make[2]: Leaving directory '/usr/src/libserial-0.6.0rc2/src'
Makefile:453: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/src/libserial-0.6.0rc2'
Makefile:357: recipe for target 'all' failed
make: *** [all] Error 2
pi@raspberryKT:/usr/src/libserial-0.6.0rc2 $
Sorry, I'm not familiar enough with gcc on Linux to resolve this problem - could please anybody give me some hint?
Thank you for your help!
Hi @ktphys ,
Can you see which version of GCC you have installed?
gcc -v
If there isn't a version of GCC already installed, try the installing build-essential and g++ and let us know if it fixes anything for you!
sudo apt-get install build-essential g++
-Mark
../libtool: 1: eval: base_compile+= g++: not found
@ktphys It looks like g++
is probably not installed on your system. Please try out the apt-get
command that @mcsauder mentioned:
sudo apt-get install build-essential g++
After that you ought to be able to run the following command to check if g++
is installed and which version you have:
g++ --version
After g++
is installed, please try the build again and let us know how that goes.
Hi @ktphys ,
As CrayzeeWulf mentioned, let us know if installing build-essential and g++ resolves your issue. If it doesn't, comb through the terminal output carefully when you run the first two build commands, and let us know if you see any errors:
make -F Makefist.dist
./configure
Next, can you query your libtool version and location and let us know what they are:
libtool -version
which libtool
My machine's responses to those queries are:
libtool (GNU libtool) 2.4.6
/usr/bin/libtool
If your libtool queries are unsuccessful please install libtool:
sudo apt install libtool-bin
Once you've done all of that let us know if it's still not working and we'll keep digging into it with you.
Thanks for working on it with us!
-Mark
Hi @ktphys ,
Thanks for the information. Please install libtool:
sudo apt install libtool-bin
Let us know if it installs correctly and if that fixes your issue!
-Mark
Hi @ktphys ,
if the libtool queries "libtool -version" and "which libtool" don't return any values, it would seem that your system path might not be recognizing your libtool installation.
Let me know if I am misunderstood and your system is recognizing libtool.
I have found a stack exchange post on that topic here: https://askubuntu.com/questions/625523/libtool-installed-but-not-on-path-after-installation
As suggested in the post, it might also be worth running an apt update and upgrade followed by a reboot, as suggest by a response in that same post.
sudo apt update
sudo apt upgrade
sudo reboot
If your machine is not recognizing libtool, try following the suggestions in the post and let us know if anything there is successful at getting the system to recognize libtool.
While on the topic, I was curious if you might have tried compiling with CMake using the compile.sh script?
Thanks for troubleshooting this with us and reporting your results.
-Mark
P.S. It might also be worth running apt autoremove, clean, and autoclean, then reboot
sudo apt autoremove
sudo apt clean
sudo apt autoclean
sudo reboot
Hi @ktphys ,
Sorry to ask once again, but can you copy/paste the terminal output to the following commands back in this post for me?
libtool -version
which libtool
and also:
whereis libtool
locate libtool
Thanks.
-Mark
Hi @ktphys ,
Can you tell me what shell your machine is using for default:
echo $SHELL
my machine gives: /bin/bash
Hi @ktphys ,
Here are a few links that all seem to point to the issue being the use of a shell less sophisticated than bash, (even though your default shell appears to be bash), and this is the direction I am focusing right now:
If you open up your user profile you might be able to see if your system is utilizing a shell binary from your home directory.
gedit ~/.profile
It would appear to me that the shell mis-match is the likely culprit.
I am a little uncertain if this is correct, but please try adding this line to your configure.ac file:
SHELL = /bin/bash
Let me know that changes anything.
-Mark
Hi @ktphys ,
Apologies, I made a type in my first post and immediately corrected it, but it appears I was too late.
Please use the bash shell: SHELL = /bin/bash
I think that bin/sh is the issue, we need it to use bin/bash. Both the Bourne shell, sh, or dash, which Raspbian uses as well, are both less sophisticated than bash, (Bourne Again SHelll). Neither sh or dash recognize the compund "+=" statements, which is why libtool needs bash.
Work on getting libtool to recognize your bash installation and I think you'll be able to get past this error.
-Mark
Hi again @ktphys ,
There is an outside chance that upgrading your libtool to a newer version could also help this issue. If you are not averse to doing a dist-upgrade to your packages, this might also have an impact.
`sudo apt -y update && sudo apt -y dist-upgrade'
Hi @ktphys ,
Please read through the links I posted:
- https://lists.gnu.org/archive/html/bug-libtool/2011-09/msg00005.html
- https://sourceforge.net/p/libint/tickets/14/
- fangism/hackt#21
From the other posts showing the same errors as you are observing, even though bash is installed, it is not what libtool appears to be using. Hopefully after you read through the links it will make better sense.
Also, here is another instance of the same kind of errors due to the same underlying cause:
-Mark
Hi @ktphys ,
Do you see the same errors if you run
make SHELL=/bin/bash
(Do this after a reboot if you haven't rebooted recently with everything we've attempted.)
Thanks.
-Mark
Also, please copy/paste the terminal output to this post after you run
libtool --help
Thanks!
Hi @ktphys ,
Thanks. That's puzzling. Try running it again with sudo to see if it gets farther with permissions.
It looks like your libtool shell and compiler are set correctly. This is really a tough nut to crack! :)
I'm at a bit of a loss about what to try next with make now that we know libtool has the right shell, (other than "sudo make SHELL=/bin/bash , of course) .
Does the compile.sh script work for you? ./compile.sh
-Mark
Hi @ktphys ,
That's great! It was able to compile everything but the python code successfully. This means that libtool was choosing the wrong shell, although I have absolutely no idea why the permissions error showed up.
The reason it is failing in the sip directory is likely because you need to install python-sip
sudo apt install python-sip-dev
Hi again @ktphys ,
The file compile.sh is in your top level libserial directory, it is a bash script that simply contains instructions you can run yourself from the terminal:
mkdir -p build
cd build
cmake ..
cmake -G Sublime\ Text\ 2\ -\ Unix\ Makefiles ..
cd ..
make -j3 -C build
You can run the script by ./compile.sh
Hi @ktphys ,
Here is a link to the CMake compile script file.
I would appear that you have everything installed properly at this point and should be able to use LibSerial. If you were only interested in the current release, there is a release package that can be installed using apt:
sudo apt install libserial-dev
which will give you the same functionality as the master branch of the git repo minus some documentation updates. We are working toward a new release candidate from the c++14 branch that eventually will be ableto be installed from apt as well.
Your case was pretty tricky, and although I have updated the documentation to include the additional packages your installation required, I'm not sure how to enforce this through the makefiles. Would you be willing to try inserting the line
SHELL=/bin/bash
into first the configure.ac file, and then the Makefile.am at the top level to see if it allows you success? If you can test a way to get this into the make files that functions we would be happy to include that in the repo.
Thanks for your work on this, and thanks for reporting the issue.
Let me know once you would like to close the issue!
-Mark
Hi @ktphys ,
Here is the file in the repo. I do not know why you are missing some of the files in the repo. It seems like you might be best served by checking out a fresh clone of the repository.
Please open a terminal, navigate to your libserial directory, enter the list command, ls
, and copy/paste the terminal output back here. Once you have inspected the list of available files, compare it to the list of files on the repo. If you are missing any of the files at all, (even one), you need to fix your repo. If you are not missing any of the files, please locate configure.ac and compile.sh and work on the previous instructions we discussed.
Thanks!
Aha! I see why you don't have some of the files, you didn't clone the repo, you downloaded the release candidate package.
Please clone the repo and work with the latest code.
-Mark
P.S.
Clone using ssh: git clone git@github.com:crayzeewulf/libserial.git
Clone using https: git clone https://github.com/crayzeewulf/libserial.git