Linux: no such file or directory - linux

I am new in Linux, can anyone tell me which directory the computer search for "ansinist.h"? Below is the syntax:
USER#USER-PC /cygdrive/f/Dataset_extract/500ppi-Legacy/SRC/BIN/TXT2NIST
$ make -f makefile.mak
gcc -ansi -O2 -I/include -L/lib -c txt2nist.c
txt2nist.c:15:22: fatal error: ansinist.h: No such file or directory
#include <ansinist.h>
^
compilation terminated.
makefile.mak:53: recipe for target 'txt2nist.o' failed
make: *** [txt2nist.o] Error 1

This answer could help you. In general case, be sure that you have installed the libraries that you're going to use in your project.

To find the file ansinist.h
sudo find / -name ansinist.h
And please paste your output here but you should be sure you installed all the required libraries first..

1)if your header file is in current directory then use #include "ansinist.h"
because this syntax search directly into current directory.
2)if your header file is in /usr/include/ then #include< ansinist.h>
because this syntax first search into /usr/include/ then current directory.
3)also you can use #include < /path/ansinist.h>
where path=path where is header file.
4)if above things will not work then please give value of #echo $PATH for next i can help you.

Related

clang complete add path to includes

I have simple question today. I'm using this vim config - https://github.com/gergap/vim
The problem is with clang completion. It works but when I want to add more includes to get better completion then nothing is happening - it won't detect new headers.
Get #include <sys/types.h> for example. This is what I've added to .clang_complete file placed in directory where my main.c is placed:
-I/usr/include/x86_64-linux-gnu/sys/
which I found by invoking
find /usr/include/ -name types.h
What can be wrong? Could you show me some working .clang_complete files with includes to unix headers? Maybe I'll find problem in that way.
This is the output from gcc with -v flag:
/usr/lib/gcc/x86_64-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
To investigate, run your gcc (or clang) with the -v option. This will display the search path used while compiling. On my system (FreeBSD) a simple compile without -I options prints
#include "..." search starts here:
#include <...> search starts here:
/usr/include/clang/3.4.1
/usr/include
End of search list.
That should give you an idea what directories to add to .clang_complete. Important: order matters!

Latest linux kernel installation issue(rm: invalid option -- '0')

I have clone the latest linux source from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
And compile this kernel using (make O=/usr/local/kernel).
But when i install the kernel the following error getting,
# make O=/usr/local/kernel modules_install install
make[1]: Entering directory `/usr/local/kernel'
rm: invalid option -- '0'
Try 'rm --help' for more information.
make[1]: *** [_modinst_] Error 1
make: *** [sub-make] Error 2
I faced the same issue today (24/1/20) and after a bit of searching, I decided to remove the # in front of each line in modinst target in Makefile. The problem was immediately visible to me. If you add space in extra version, the space will appear in your folder name. So, if you write extra version as
EXTRAVERSION= -test[un-noticed-space-here]
Your module folder name will also have that space. To avoid it, I tried the following
Made sure that there are no spaces at the end of version lines in Makefile
Did "make kernelversion" and made sure that it is devoid of any space character
Did a
echo -n `make kernelversion`| wc
and reconfirmed above point by comparing wc output and the count of characters from previous step

Unable to find header file

I intend to include net/ip6_checksum.h in my code, but the compilation fails because the file is not found.
Searching for the file on the system shows:
$ find /usr -name ip6_checksum.h
/usr/src/linux-headers-3.2.0-52/include/net/ip6_checksum.h
/usr/src/linux-headers-3.2.0-54/include/net/ip6_checksum.h
The makefile looks for headers under /usr/lib
How do I include the file in my code?
Thanks!
You just need to add -I/usr/src/linux-headers-3.2.0-54/include to your compilation command.

No rule to make target `–f'

I am trying to make a c file like
make –f makefile1
This is my make file:
TestAssn1: test_assign1_1.o dberror.o storage_mgr.o
cc -o TestAssn1 test_assign1_1.o dberror.o storage_mgr.o
test_assign1_1.o: test_assign1_1.c test_helper.h dberror.h storage_mgr.h
cc -c test_assign1_1.c
dberror.o: dberror.c dberror.h
cc -c dberror.c
storage_mgr.o: storage_mgr.c storage_mgr.h dberror.h
cc -c storage_mgr.c
But I only get this message:
make: *** No rule to make target `–f'. Stop.
How should I correct this?
You need to use a normal dash (-), not an en dash, in the command.
My guess is you copied this command from a blog or other web source. Many blog/web frameworks have a bug where they will replace typewriter punctuation with their typographically correct counterparts even within code formatted text.
This is very odd as your make usage is correct per http://linux.die.net/man/1/make
Please try some of the other formats for this option:
-f file, --file=file, --makefile=FILE
Use file as a makefile.
Otherwise, perhaps your make is not the one listed in that man page (which is GNU make).

Make mistaking a path, failing with "No rule to make target"

I'm trying to build trace-cmd.git from source; the worst is, I had already built this once on this same machine, succesfully; however didn't keep any notes, and cannot tell what could have happened in the meantime.
So now I'm trying to rebuild, and I get the dreaded:
trace-cmd$ make
make: *** No rule to make target `/media/disk/trace-cmd/event-parse.c', needed by `event-parse.o'. Stop.
Ok, let's see what the debug says:
trace-cmd$ make -d
...
Successfully remade target file `trace_python_dir'.
Pruning file `tc_version.h'.
Considering target file `libparsevent.a'.
Considering target file `event-parse.o'.
Pruning file `/media/disk/src/trace-cmd/event-parse.c'. ## THIS EXISTS!
Pruning file `.event-parse.d'.
Considering target file `/media/disk/trace-cmd/event-parse.c'. ## THIS DOESN'T???
File `/media/disk/trace-cmd/event-parse.c' does not exist.
...
Trying pattern rule with stem `event-parse.w'.
Trying implicit prerequisite `/media/disk/trace-cmd/SCCS/s.event-parse.w'.
Trying pattern rule with stem `event-parse'.
Rejecting impossible implicit prerequisite `/media/disk/trace-cmd/event-parse.w'.
No implicit rule found for `/media/disk/trace-cmd/event-parse.c'.
Finished prerequisites of target file `/media/disk/trace-cmd/event-parse.c'.
Must remake target `/media/disk/trace-cmd/event-parse.c'.
make: *** No rule to make target `/media/disk/trace-cmd/event-parse.c', needed by `event-parse.o'. Stop.
OK, what is going on? Of course the actual file exists:
trace-cmd$ ls -la /media/disk/src/trace-cmd/event-parse.c
-rw-r--r-- 1 user user 121563 2013-03-20 19:03 /media/disk/src/trace-cmd/event-parse.c
... but this is /media/disk/src/trace-cmd/event-parse.c!! And:
make already found it once;
yet make decided to, for some reason, drop the /src/ from the path,
... and that file obviously doesn't exist:
trace-cmd$ ls /media/disk/trace-cmd/event-parse.c
ls: cannot access /media/disk/trace-cmd/event-parse.c: No such file or directory
Can someone explain me, for what possible reason could make decide to drop a part of the path, such that it cannot find a file, that it originally had a correct reference to?
Got it - thought I'd focus on that .event-parse.d file:
trace-cmd$ head -n 4 .event-parse.d
event-parse.o: /media/disk/trace-cmd/event-parse.c \
/usr/include/stdio.h /usr/include/features.h /usr/include/bits/predefs.h \
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
... and indeed, that is the wrong path there... What happens if I delete this .d file?
trace-cmd$ rm .event-parse.d
trace-cmd$ make
COMPILE FPIC event-parse.o
make: *** No rule to make target `/media/disk/trace-cmd/trace-seq.c', needed by `trace-seq.o'. Stop.
Oh, my. There must be more of them:
trace-cmd$ ls .*.d
.event-parse.d .plugin_kmem.d .trace-filter.d .trace-options.d .trace-seq.d
.kbuffer-parse.d .plugin_kvm.d .trace-ftrace.d .trace-output.d .trace-split.d
.kernel-shark.d .plugin_mac80211.d .trace-graph.d .trace-plot-cpu.d .trace-stack.d
...
... and indeed, there are; apparently cached files from previous compilation, where indeed I compiled in another directory. And if I delete them all:
trace-cmd$ rm .*.d
trace-cmd$ make
...
gcc --shared event-parse.o trace-seq.o parse-filter.o parse-utils.o trace-util.o trace-input.o trace-ftrace.o trace-output.o trace-recorder.o trace-restore.o trace-usage.o trace-blk-hack.o kbuffer-parse.o ctracecmd_wrap.o -o ctracecmd.so
Note: to build the gui, type "make gui"
to build man pages, type "make doc"
Well, that seemingly worked; I'm back to being happy again :)
Cheers!

Resources