I'm fairly new to using "make" for anything, but I am forced to try and build some binaries with it for some C files (the code is not mine). It works for most of the files in the directory, but when it reaches the "usb" directory this happens:
make[1]: Entering directory 'C:/bios_memimage/usb'
/bin/rm -fr scraper.bin
process_begin: CreateProcess(NULL, /bin/rm -fr scraper.bin, ...) failed.
make (e=2): The system cannot find the file specified.
Makefile:10: recipe for target 'scraper.bin' failed
make[1]: *** [scraper.bin] Error 2
make[1]: Leaving directory 'C:/bios_memimage/usb'
Makefile.mingw:14: recipe for target 'subdirusb' failed
make: *** [subdirusb] Error 2
I'm unfamiliar with what "bin/rm -fr" means, and looking for it has not yielded much of anything. I can tell it's not creating the process, but what, exactly is it failing to find? And is there a remedy for it?
That line tries to delete certain filenames during the build.
https://unix.stackexchange.com/questions/153336/what-does-bin-rm-f-file-do-in-unix
Remove those lines in the makefile because they obviously will not work on windows. If the files must be deleted for the build to proceed, then replace the lines with windows equivalents.
Related
I am trying to build a very simple kernel module but I get met with this error:
make -C /lib/modules/5.16.14-051614-generic/build M=/home/nanyo/Documents /ProgrammingEnvs/LinuxKernelDriver modules
make[1]: Entering directory '/usr/src/linux-headers-5.16.14-051614-generic'
make[2]: *** No rule to make target '/home/nanyo/Documents/ProgrammingEnvs/LinuxKernelDriver/hi.o', needed by '/home/nanyo/Documents/ProgrammingEnvs/LinuxKernelDriver/hi.mod'. Stop.
make[1]: *** [Makefile:1852: /home/nanyo/Documents/ProgrammingEnvs/LinuxKernelDriver] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.16.14-051614-generic'
make: *** [Makefile:4: all] Error 2
Here is the Makefile:
obj-m += hi.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean
Although there are similar errors on stack overflow none of them spcifically say no rule to target '.../name.o' needed by '.../name.mod'
I run make like so ~/Documents/ProgrammingEnvs/LinuxKernelDriver$ make. Attempting any of the proposed solutions from other questions with sudo and experimenting with CURDIR and PWD did not help.
I am running on Ubuntu 22.04 jammy, wiht the 5.16.14 kernel (I have to run this kernel as older ones dont seem to work well with my VERY recent hardware)
I have been trying to compile 15 lines of code for 2 days now, HELP! :)
If you ask make to build an object file like hi.o, it will look to find a source file to build the object file from. It won't look for any random source file (what if you had 20 source files? How should it figure out which one you meant?), it will look for a source file based on the name of the object file.
So if you want to compile C code into hi.o, make will look for a source file named hi.c. If you want to compile C++ code into hi.o, make will look for a source file like hi.cpp. If you want to compile Fortran, make will look for hi.f, etc.
Note that Linux systems, unlike Windows and MacOS, use case-sensitive filenames so hi.c, Hi.c, HI.c, etc. are all DIFFERENT files, and hi.o will only match the first one.
If make can't find a source file related to the name of the object file, it's not going to say "well, there's just one source file here, that must be what they meant". That kind of arbitrary behavior is a bad thing in a build tool: make does exactly what you tell it to do, and if it can't it doesn't try to guess what you meant. It gives you an error, like no rule to make target 'hi.o'.
If you wanted to use a different object and source name for some reason you CAN do it, but you have to tell make about it by writing your own explicit rule:
hi.o : mycoolfile.c
<recipe to build hi.o from mycoolfile.c>
Since there's no way the kernel build can know what source file name you might choose, you'll have to write these rules in your own makefile.
Following the official HTK Unix/Linux installation guide, I had similar issues to the ones described in this thread when trying to run make all on HTK. I had initially been looking at the wrong Makefile (/htk-3.4.1/Makefile), as suggested by MadScientist. After fixing the extra indentation on line 77 in the correct Makefile (/htk-3.4.1/HLMTools/Makefile) generated by running ./configure --prefix=/tmp, the HTK compile error:
Makefile:77: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
has disappeared, but I am still unable to compile on make all:
$ make all
(cd HTKTools && make all) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory '/home/zeesy/htk-3.4.1/HTKTools'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/zeesy/htk-3.4.1/HTKTools'
(cd HLMTools && make all) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;
make[1]: Entering directory '/home/zeesy/htk-3.4.1/HLMTools'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/zeesy/htk-3.4.1/HLMTools'
Prior to make all, running ./configure --prefix=/tmp results in the error:
config.status: WARNING: HLMTools/Makefile.in seems to ignore the --datarootdir setting
for HTKLib, HLMLib, HTKTools and HLMTools. It also resets line 77 of the Makefile to quadruple indented tabs.
I have gcc-multilib installed. Based on this post, I installed libc6:i386 zlib1g:i386 lib32ncurses5 and lib32z1 in order to run this 32bit program on a 64bit computer.
Has anyone run into this problem? Step 4 of the VoxForge HTK install guide suggests that gcc 3.4 compiler compatibility modules are required.
As suggested by MadScientist, I was at first looking at the wrong Makefile. I had been looking at /htk-3.1.4/Makefile, when the file that needed to be edited was /htk-3.1.4/HLMTools/Makefile. A case of not reading the error messages thoroughly.
After getting the same error message for line 77
missing separator (did you mean TAB instead of 8 spaces?).
I ran Spaces to Tabs in Atom, and corrected the quadruple tab in the default Makefile.
The make all command initially ran successfully, but as I was unable to access ls /tmp/bin.linux I attempted make all again and received the second error message
make[1]: Nothing to be done for 'all'
The fix for this was to run make clean (see this post). However, Nikolay Shmyrev has pointed out that this error means that everything has compiled, there for there is 'nothing to be done'.
I'm now having problems accessing /tmp/bin.linux but will deal with that elsewhere.
SUMMARY: The make[1]: Nothing to be done for 'all' error means that everything has already compiled.
After I configured the cmake file for portmidi, and proceeded to use make to make the necessary files, I encountered this error during compilation:
- Build files have been written to: /home/mycomputername
/Desktop/portmedia/portmidi
[ 2%] Linking C shared library /Release/libpmjni.so
/usr/bin/x86_64-linux-gnu-ld: cannot open output file /Release/libpmjni.so: No such file or directory
collect2: error: ld returned 1 exit status
pm_common/CMakeFiles/pmjni.dir/build.make:251: recipe for target '/Release/libpmjni.so' failed
make[2]: *** [/Release/libpmjni.so] Error 1
CMakeFiles/Makefile2:87: recipe for target 'pm_common/CMakeFiles/pmjni.dir/all' failed
make[1]: *** [pm_common/CMakeFiles/pmjni.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
I'm quite confused. I've tried to insert the flags -fpic in the cxx-flags section of ccmake and change the default java install paths to no avail. Quite frankly, I think it has to do with the messing up of execution order, but I don't know where.
Any help will be greatly appreciated.
Apparently, there was some configuring to do in the directories that CMake points to in ccmake configuration. I just redownloaded the files and unzipped it into a newly made portmedia directory. Also, to make sure that you don't get any hiccups in making pm_defaults, refer to Nate's answer. To quote:
Apparently, one of the Makefiles generated by ccmake is broken. I was able to fix the issue by running
sed -i 's/pm_java\/pm_java/pm_java/' build.make
in the pm_java/CMakeFiles/pmdefaults_target.dir/ subdirectory of the
project after running ccmake . (on Ubuntu, though). (The sed
command replaces all occurrences of pm_java/pm_java by pm_java.)
Everything compiles, and I can even run pmdefaults from the
Release directory using
java -Djava.library.path=. -jar pmdefaults.jar
I need to link libpotrace and compile it into libgerbv. What should I write in Makefile.am? I tried various things like LDADD, LIBDIR, LDFLAGS etc., but I was not successful.
How my structure look like:
gerbv/gerbv-test -> files from git, master brach
gerbv/libs/potrace/potrace-test -> potrace -> files from sourceforge.com, latest release
I use Debian Jessie, I can compile both programs separately, both I did not figured out, how can I link potrace to gerbv and compile it. The header file (.h) is included properly, but I haven't had any success with linking .so or .a/la lib. Even no success with installed potrace in /usr/local/lib or /usr/lib.
Can anyone direct me? The best will be if you can download both programs, compile it without error and then write what you put into the gerbv/src/makefile.Am.
UPDATED
I dowloaded clean releases and did this ONLY this modifies:
/root/NBP/gerbv/gerbv-test/src/Makefile.am
added
libgerbv_la_LIBADD = libpotrace.la # src/Makefile.am:84: error: use 'libgerbv_la_LIBADD', not 'libgerbv_la_LDADD'
libgerbv_la_LIBDIR = /root/NBP/gerbv/libs/potrace/potrace-old/src/.libs
#libgerbv_la_DEPENDENCIES = libpotrace.la
/root/NBP/gerbv/gerbv-test/src/exportimage.c
added at the top
#include "../../libs/potrace/potrace-test/src/potracelib.h"
added into void exportimage_render_to_surface_and_destroy(...), this will test, if the shared lib is properly linked. exportimage.c is part of libgerbv where I need to include libpotrace.
char *v = potrace_version();
After doing this modifications I build it via:
libpotrace
root:~/NBP/gerbv/libs/potrace/potrace-test# autoreconf && ./configure --with-libpotrace && make
runs without a problem...
gerbv/libgerbv
root:~/NBP/gerbv/gerbv-test# autoreconf && ./configure && make
This results with:
...
make[3]: Entering directory '/root/NBP/gerbv/gerbv-test/src'
make[3]: *** No rule to make target 'libpotrace.la', needed by 'libgerbv.la'. Stop.
make[3]: Leaving directory '/root/NBP/gerbv/gerbv-test/src'
Makefile:498: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/root/NBP/gerbv/gerbv-test/src'
Makefile:472: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/NBP/gerbv/gerbv-test'
Makefile:401: recipe for target 'all' failed
make: *** [all] Error 2
Solved with this Makefile.am addition:
libgerbv_la_LIBADD = ../../libs/potrace/potrace/src/libpotrace.la
libgerbv_la_DEPENDENCIES = ../../libs/potrace/potrace/src/libpotrace.la
I am compiling a c project, everything is OK when commands, as aclocal, .../configure, so on.
when I run "make" command, it shows an error
lgomp -lrt -lpthread -fopenmp
make[3]: Leaving directory `/home/develop/slim/src'
make[2]: Leaving directory `/home/develop/slim/src'
make[1]: Leaving directory `/home/develop/slim/src'
Making all in lib
make[1]: Entering directory `/home/develop/slim/lib'
Cannot execute /home/develop/slim//bin/lmntal
make[1]: *** [array2D.il] Error 1
make[1]: Leaving directory `/home/develop/slim/lib'
make: *** [all-recursive] Error 1
I think "Cannot execute /home/develop/slim//bin/lmntal" is the problem. I am new at those stuff.
could anyone tell me how to fix the problem?
Thanks in advance
If it is someone elses code, you may need to set an environment variable or something similar.
The first thing to do is check the file is there:
ls /home/develop/slim/bin/lmntal
Then check permissions if it is there.
ls -ltr /home/develop/slim/bin/lmntal
Its very hard to give advise without the make file though.