gcc: fatal error: no input files - gcc

I am trying to compile some source code but I presented with the following error output after entering "make":
mpicc -c -O3 -I func_pointer.c
gcc: fatal error: no input files
compilation terminated.
make: *** [func_pointer.o] Error 4
I have seen other threads on this website relating to this error output (1, 2, 3). I was in fact experiencing a similar problem previously, which I think I may have solved, where the "make" command was producing:
make: Circular mod_prec.o <- mod_prec.o dependency dropped.
make: Circular mod_prec.o <- mod_prec.o dependency dropped.
make: Circular mod_prec.o <- mod_prec.o dependency dropped.
/usr/bin/cpp -P -C -traditional -DIFORT -P -C -traditional -DWET_DRY -DMULTIPROCESSOR -DLIMITED_NO -DGCN mod_prec.F > mod_prec.f90
mpif90 -c -O3 -I mod_prec.f90
gfortran: fatal error: no input files
compilation terminated.
make: *** [mod_prec.o] Error 4
I followed the steps suggested on this website, which I think may have addressed that issue (I believe I am progressing further through the makefile). Those steps are as follows:
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ which mpif90
/usr/local/bin/mpif90
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ mpif90 -show
gfortran -I/usr/local/include -pthread -I/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -Wl,--enable-new-dtags -L/usr/local/lib -lmpi_usempi -lmpi_mpifh -lmpi
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ mpif90 -V
gfortran: error: unrecognized command line option ‘-V’
gfortran: fatal error: no input files
compilation terminated.
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ export MPI_LOC=/usr/local
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ export MPI_INCLUDE="$MPI_LOC"/includedan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ export MPI_LIB="$MPI_LOC"/lib
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ export LD_LIBRARY_PATH=$MPI_LIB:$LD_LIBRARY_PATH
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ export LIBMPI="-pthread -Wl -rpath -Wl -Wl,--enable-new-dtags -lmpi -lmpi_usempi -lmpi_mpifh -lmpi"
With an additional step of:
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ make clean
/bin/rm -f *.o *.mod *.f90
Which brought me to where I am currently. My instinct is that the solution to my current problem will be similar to that of my previous problem. However, I am new to linux/c/fortran so I am not sure I fully follow the previous solution. As such the following commands produce the following output:
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ which mpicc
/usr/local/bin/mpicc
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ mpicc -show
gcc -I/usr/local/include -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,--enable-new-dtags -L/usr/local/lib -lmpi
dan#Dan-office ~/FVCOM3.2.2/FVCOM_source $ mpicc -V
gcc: error: unrecognized command line option ‘-V’
gcc: fatal error: no input files
compilation terminated.
Have I failed to correctly define some variables which is leading to this problem? I am conscious that this question is becoming rather long but I can add additional information if it is required such as the makefile (this is long though).

Answering my own question after encountering it again whilst compiling FVCOM on a new hard drive. The issue is, as raised by Etan, the -I flag. In the make.inc file uncomment the LIBDIR and INCDIR variables under local install and comment out the same variables directly above.

Related

How to run the "make" command for YoloV3 Darknet (for Windows)?

After running the ./make.exe command (By using GNUWin32), I get the following error:
mkdir -p obj
mkdir -p backup
A subdirectory or file -p already exists.
Error occurred while processing: -p. make: *** [backup] Error 1
After rerunning the command, I get a different error:
mkdir -p results
A subdirectory or file -p already exists.
Error occurred while processing: -p.
make: *** [results] Error 1
Then I get the same error no matter how many times I repeat the make command:
gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o
process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/gemm.o] Error 2
As I am a beginner, can you please provide detailed instructions on how I can fix the problem?
These problems:
mkdir -p obj
mkdir -p backup
A subdirectory or file -p already exists.
Error occurred while processing: -p. make: *** [backup] Error 1
are caused by the fact that you have asked Make to execute, on Windows,
a makefile that was written to work on Linux or some other Unix-like operating system.
In Unix-like operating systems, the command:
mkdir -p obj
means: Create a directory called obj with no error if it already exists. In
Windows it means: Create a directory called -p and then a directory called obj.
So when mkdir -p obj has created the directories -p and obj, the command:
mkdir -p backup
fails because:
A subdirectory or file -p already exists.
The Unix/Linux makefile has no intention of creating a directory called -p, but on Windows
that is what it does.
There is little point in your attempting to fix this specific error. It is just the
first of indefinitely many errors that will result from attempting to execute a Unix/Linux
makefile on Windows. You need a makefile that was written to run on
Windows, or to write one yourself, or to find a way of building the software on Windows that does not use Make.
This problem:
gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o
process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/gemm.o] Error 2
is caused by the fact that you have not installed the GCC C compiler
gcc on your computer, or if you have, the directory where it resides is not in your PATH. So Make cannot find
it to perform the essential business of compiling and linking your software.
Here is a popular Windows port of GCC
Your makefile has been written for Linux and is not directly portable to Windows.
The issue is that ‘mkdir’ is conflicting with CMD’s built-in function that doesn’t support the same command line options (as explained by Mike Kinghan).
A simple workaround is to replace any occurrence of mkdir in your makefile with $(MKDIR) and to add at the very beginning:
MKDIR := “$(shell which mkdir)”
Of course this requires that you install which and CoreUtils (that provides mkdir). Note the double quotes to avoid any issues with white space on the path to mkdir.
Last but not least you will also need gcc which you can get here or there for example.

fatal error: png.h: No such file or directory(MiddleBury Evaluation)

I am testing stereo algorithm in MiddleBury Stereo Evaluation
One of step was to compile the tools in code/as follows.
cd code/imageLib
make
cd ..
make
cd ..
In this case, there is error in first make as follows,
$ make
g++ -O3 -W -Wall -g -c -o ImageIOpng.o ImageIOpng.cpp
ImageIOpng.cpp:19:17: fatal error: png.h: No such file or directory
compilation terminated.
make: *** [<builtin>: ImageIOpng.o] Error 1
and, regarding second make,
$ make
g++ -g -O3 -W -Wall -IimageLib ii.cpp -LimageLib -lImg.i686-g -lpng -lz -o ii
/usr/lib/gcc/i686-pc-cygwin/5.4.0/../../../../i686-pc-cygwin/bin/ld: cannot find -lImg.i686-g
/usr/lib/gcc/i686-pc-cygwin/5.4.0/../../../../i686-pc-cygwin/bin/ld: cannot find -lpng
collect2: error: ld returned 1 exit status
make: *** [<builtin>: ii] Error 1
In previous step, make worked fine.
So, what was the problem? I downloaded sample algorithm and did not edit/change contents in any file.
png.h is part of libpng16-devel and the specific include
directory must be added to the include path of your project.
$ cygcheck -l libpng16-devel |grep png.h
/usr/include/libpng16/png.h

cgywin64: make -f Makefile

I'm trying to use mpi-ikl-simplemkl-1.0 (http://www.mloss.org/software/view/174/)
I'm using Windows 8.1 and I've installed cgywin64. When I type (on cgywin bash screen):
make -f Makefile
The result is:
gcc-4.2 -03 -ffast-math -fomit-frame-pointer -fPIC -c -o svm.o svm.cpp
gcc-4.2: error: spawn: No such file or directory
makefile:32: recipe for target 'svm.o' failed
make: *** [svm.o] Error 1
What should I do?
The internet wisdom seems to be that you should do one of:
Remove /bin from PATH
Remove /usr/bin from PATH
Reinstall gcc (possibly remove all versions of gcc first)

How to run "gmake install"?

I am now installing a code on my mac.
The code is from here. Look for "Benchmark and Boundary Detection Code" in this page.
In the readme file, it says:
(1) For the image and segmentation reading routines in the Dataset
directory to work, make sure you edit Dataset/bsdsRoot.m to point to
your local copy of the BSDS dataset.
(2) Run 'gmake install' from this directory to build everything. You
should then probably put the lib/matlab directory in your MATLAB path.
(3) Read the Benchmark/README file.
For the 1st step, I did as suggested.
For the 2nd step, I am pretty confused. I ran command gmake install in MATLAB, however, I got:
gmake
Undefined function or variable 'gmake'.
Actually, before running MATLAB, I installed gmake port through macports.
I just did it in terminal, however, this is what I got...
hou229:segbench yaozhongsong$ cd /Users/yaozhongsong/Documents/MATLAB/segbench
hou229:segbench yaozhongsong$ sudo gmake install
gmake[1]: execvp: ../Util/gethosttype: Permission denied
gmake[1]: Entering directory `/Users/yaozhongsong/Documents/MATLAB/segbench/Util'
GNUmakefile-library:26: *** mexSuffix not defined. Stop.
gmake[1]: Leaving directory `/Users/yaozhongsong/Documents/MATLAB/segbench/Util'
hou229:segbench yaozhongsong$
In MATLAB, I also did like this:
!gmake install
/bin/bash: gmake: command not found
How to do the 2nd step in readme file?
Thanks in advance!
#Amro
hou229:segbench yaozhongsong$ cd /Users/yaozhongsong/Documents/MATLAB/segbench
hou229:segbench yaozhongsong$ sudo gmake install
Password:
gmake[1]: execvp: ../Util/gethosttype: Permission denied
gmake[1]: Entering directory `/Users/yaozhongsong/Documents/MATLAB/segbench/Util'
mkdir -p ../lib/matlab
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c Exception.cc -o build//Exception.o
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c String.cc -o build//String.o
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c Random.cc -o build//Random.o
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c Timer.cc -o build//Timer.o
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c Matrix.cc -o build//Matrix.o
Matrix.cc:13:21: error: ieee754.h: No such file or directory
Matrix.cc: In function ‘double nextpow2(double)’:
Matrix.cc:86: error: ‘ieee754_double’ was not declared in this scope
Matrix.cc:86: error: expected `;' before ‘val’
Matrix.cc:87: error: ‘val’ was not declared in this scope
Matrix.cc:88: error: ‘IEEE754_DOUBLE_BIAS’ was not declared in this scope
Matrix.cc: At global scope:
Matrix.cc:48: warning: ‘snan’ defined but not used
Matrix.cc:49: warning: ‘inf’ defined but not used
gmake[1]: *** [build//Matrix.o] Error 1
gmake[1]: Leaving directory `/Users/yaozhongsong/Documents/MATLAB/segbench/Util'
For the "mexSuffix not defined" error, first run mexext inside MATLAB, take that output (I suspect it is mexmaci64), edit the file Util/GNUmakefile-library and add the following at line 24:
mexSuffix := mexmaci64
replace the value with the one you get from mexext
Note: I haven't tested any of this, I am on a Windows machine..
You need to run gmake from the Terminal (command line), not in MATLAB.

make library not found

I'm trying to compile a program using a third party library, Omnet++ in my case. Apparently "make" does not find a library, but the path it uses is correct as you can see (in the sense that I can see the library under omnet++ source tree)
pv135168:basic Bob$ opp_makemake
Creating Makefile in /Users/Bob/Code/network_sim/basic... Makefile created, running "make depend" to add dependencies... opp_makedep -Y --objdirtree -I. -f Makefile -P\$O/ -- ./*.cc
pv135168:basic Bob$ make
g++ -c -g -Wall
-fno-stack-protector -m32 -DHAVE_PCAP -DXMLPARSER=libxml
-DWITH_PARSIM -DWITH_NETBUILDER -I.
-I/Users/Bob/Code/omnetpp-4.1/include -o out/gcc-debug//txc1.o txc1.cc g++ -m32 -Wl,-rpath,/Users/Bob/Code/omnetpp-4.1/lib -Wl,-rpath,. -o out/gcc-debug//basic out/gcc-debug//txc1.o -Wl,-all_load
-L"/Users/Bob/Code/omnetpp-4.1/lib/gcc"
-L"/Users/Bob/Code/omnetpp-4.1/lib" -u _tkenv_lib -lopptkenvd
-loppenvird -lopplayoutd -u _cmdenv_lib -loppcmdenvd -loppenvird
-loppsimd -lstdc++
ld: library not found for -lopptkenvd
collect2: ld returned 1 exit status make: *** [out/gcc-debug//basic]
Error 1 pv135168:basic Bob$
It's looking in the following directories for a file called libopptkenvd.dylib or libopptkenvd.a:
/Users/Bob/Code/omnetpp-4.1/lib/gcc
/Users/Bob/Code/omnetpp-4.1/lib
Is that file in one of those directories (or in the standard directories like /usr/lib)? I don't see an indication of that in your output.

Resources