Two different symlinks to the `make` binary: Why different results on invocation? - bash

Setup: macOS, bash, inside tmux. I use make installed via homebrew.
When running make with my Makefile, I get
protoc -I=foo/bar/proto --cpp_out=foo/bar/proto foo/bar/proto/foo.proto
make: *** No rule to make target 'foo/bar/proto/foo.pb.h', needed by 'proto'. Stop.
make: *** Waiting for unfinished jobs....
When I instead run gmake, the program is successful:
protoc -I=foo/bar/proto --cpp_out=foo/bar/proto foo/bar/proto/foo.proto
protoc -I=foo/bar/proto --python_out=foo/bar/proto foo/bar/proto/foo.proto
But the binaries are exactly the same:
$> readlink -f `which make`
/usr/local/Cellar/make/4.2.1_1/bin/gmake
$> readlink -f `which gmake`
/usr/local/Cellar/make/4.2.1_1/bin/gmake
How is this possible?
It was suggested that this question is a duplicate, which doesn't seem to be the case. I am aware, that the system-make is not necessarily GNU make or not a current version. But as proven above, the two commands refer to the exact same binary.

Related

Cygwin doesn't make an executable when expected

I'm running Cygwin on Windows 7 and trying to build a program I downloaded. I cd to where I have my file.tar.gz and type
tar -xvf file.tar.gz
and Cygwin successfully spits out a list of what's in there. (point of confusion: for some reason, -xvzf doesn't work, even though the file claims to be zipped. Also, I expected there to be an untarred folder put somewhere in my directory, but there's not.)
Then I type
make
and get
c++ -O -c gmm.c -o gmm.o
make: c++: No such file or directory
make: *** [makefile:19: gmm.o] Error 127
I expected this to create a gmm.exe (according to the documentation of this program). What's going on?
As #stark mentioned you are missing the C++ compiler.
To find in which package is, use cygcheck -p to ask the Cygwin Webserver
$ cygcheck -p bin/c++
Found 17 matches for bin/c++
...
binutils-2.35.2-1 - binutils: GNU assembler, linker, and similar utilities
...
gcc-g++-10.2.0-1 - gcc-g++: GNU Compiler Collection (C++)
gcc-g++-7.4.0-1 - gcc-g++: GNU Compiler Collection (C++)
...
After you install the gcc-g++ package, you will have the program c++
in the standard directory for programs
$ cygcheck -l "gcc-g++" |grep "usr/bin/c++"
/usr/bin/c++.exe

How to install catdoc on Mac (without using macports)

background
I really would like to search for a term in a directory full of Word docs. So I stumbled across this lovely solution. However this solution requires that catdoc is installed on mac.
what I have tried
now homebrew obviously doens't have catdoc:
$ brew install catdoc
Updating Homebrew...
Error: No available formula with the name "catdoc"
==> Searching for a previously deleted formula...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
macports does, but I use homebrew and It's not a good idea to have both on my machine.
So I did what any self respecting semi-programmer would do: try to install it from source:
$ ./configure
see outpout
$ ./make
see output
the last part of ./make gives me this
1 warning generated.
gcc -o catppt catppt.o pptparse.o charsets.o substmap.o fileutil.o confutil.o numutils.o ole.o -lm
echo "#! /usr/bin/wish" >wordview
echo set charset_lib "\"/usr/local/share/catdoc\"">>wordview
cat wordview.tcl >>wordview
chmod 0755 wordview
touch build
make[1]: Nothing to be done for `all'.
then when i run make install i get this
make: `install' is up to date.
and obviously catdoc doesn't work:
$ which catdoc
>> nothing
Question
How can I install this?
You could just use the built-in textutil to convert MS-Word documents to text:
textutil -stdout -cat txt SomeFile.doc
or
textutil -stdout -cat txt *.doc
To build catdoc / catppt / xls2csv on Mac OS X (macos)
tested with catdoc-0.95 on Mac OS X 10.9.5
Configuration
First, unless your documents are likely to be written in a Cyrillic language, start with:
$ ./configure --with-input=cp1252 --with-output=mac-roman
(if you are more likely to encounter files from Windows)
... or ...
$ ./configure --with-input=mac-roman --with-output=mac-roman
(if you are more likely to encounter files from MacOS)
Building
$ make all (or just $ make)
Installation
make --directory=src install; make --directory=doc install; make --directory=charsets install
This should compensate for the error you received, abbood. It appears the primary Makefile isn't running the install portion of the three subdirectories, for some reason. If a permissions error is reported, precede the above command with "sudo".
I don't believe this should be necessary, but I'm not familiar enough with makefiles to provide a more proper (textbook) fix.
One can, of course, get the same effect by:
$ cd src
$ make install
$ cd ../doc
$ make install
$ cd ../charsets
$ make install
$ cd ..
Cleanup
To remove all files created by make, type:
$ make clean
To remove all files created by make as well as those created by ./configure, type
$ make distclean

make[1]: exec(f77) failed (No such file or directory) on DragonFly BSD

I get this error when trying to compile html-xml-utils-6.9 on DragonFly BSD. Funny thing is, when doing grep -r f77 in the source directory, the result is empty. So no such option is in the constructed Makefile after ./configure.
This is my configure output: http://pastebin.com/4tKEXQKG
I tried to do alias f77="gfortran48", but the problem remains. gfortran48 is an installed compiler, I've checked with man gfortran48.
My full error output:
/home/olle2/Downloads/html-xml-utils-6.9$ make
make all-am
f77 -O -c html.e
make[1]: exec(f77) failed (No such file or directory)
*** Error code 1
Stop.
make[1]: stopped in /home/olle2/Downloads/html-xml-utils-6.9
*** Error code 1
Stop.
make: stopped in /home/olle2/Downloads/html-xml-utils-6.9
Any ideas?
Related thread: make: f77: No such file or directory
Aliases aren't available to non-interactive shells generally so an alias isn't the right solution to this problem.
The default FC make variable is f77 so that is likely what is in use in the makefile. This also indicates your solution.
Try make FC=gfortran48 or similar.
Solved with this line:
./configure LDFLAGS="-L/usr/local/lib -liconv" && gmake && echo $?
(gmake instead of make gives saner error messages.)
Thanks to #dragonflybsd IRC channel!

How to run makefile in Cygwin

I am trying to run Makefile in cygwin.
Error msg:
$ make /cygdrive/d/IoT/trunk/Macchina/TestBed/Makefile
make.exe: *** No rule to make target `/cygdrive/d/IoT/trunk/Macchina/TestBed/Makefile'. Stop.
You don't give make the makefile as an argument like that.
cd to that directory and run make.
Or if that makefile is intended to be used from other directories as well then you can try make -f /cygdrive/d/IoT/trunk/Macchina/TestBed/Makefile.

Why does make tell me "Command not found"?

I have the following simple makefile:
all:
fat_imgen.exe
Where fat_imgen.exe is an executable in the same directory as the makefile. When I try and run this however this happens:
>make
fat_imgen.exe
make: fat_imgen.exe: Command not found
make: *** [all] Error 127
If I run fat_imgen from that same command prompt then it starts as expected - why can't make find fat_imgen.exe?
This is all running under Mingw / Windows.
When using a simple commend like the name of an executable, GNU make will start the executable directly. If the directory where the executable is found is not in the PATH/path, make will fail.
If you put the directory in the path, your makefile should work normally.
Also, as suggested in a comment by #AlexFarber, by adding './' GNU make will assume a more complex command (since not all shells are created equal), and hand the command over to the configured shell. That will work, since the shell is created in the directory where the command is then found.

Resources