What is the make: *** [test] Error 10 signify? - c

I run a program using Makefile and it is giving me a strange error, although successfully executed. make: *** [test] Error 10
Here is my Makefile code
30
31 test:
32 # echo
33 # echo "Testing Electric Fence."
34 # echo "After the last test, it should print that the test has PASSED."
35 ./eftest
36 ./tstheap 3072
37 # echo
38 # echo "Starting test for time-interval-measurement."
39 export EF_ERRTRACK_START=3; export EF_ERRTRACK_END=5; ./time-interval-measurement-test
40 # echo
41 # echo "Electric Fence confidence test PASSED."
42 # echo
On execution:
Time interval measurement test: PASSED
make: *** [test] Error 10
-bash-3.2# make test

To workaround that (in case you cannot modify the (return/exit) behaviour of your binaries) use
./exec || /bin/true
.

[foo] Error NN’
These errors are not really make errors at all. They mean that a program that make invoked as part of a recipe returned a non-0 error code (‘Error NN’), which make interprets as failure, or it exited in some other abnormal fashion (with a signal of some type). See Errors In Recipes.
If no ** * is attached to the message, then the subprocess failed but the rule in the makefile was prefixed with the - special character, so make ignored the error.
http://www.gnu.org/s/hello/manual/make/Error-Messages.html
So one of your commands is returning a non-zero error code.

One of your command exits with error. Not echo, the other ones. Check them.

Related

How can I get Shake to print errors only once?

If I ever have an error during a build, I see it twice
# ghc (for _build/lib/WCLoan.o)
# ghc (for _build/lib/WCLoan.o)
[2 of 2] Compiling WCLoan ( src/WCLoan.hs, _build/lib/WCLoan.o )
src/WCLoan.hs:18:1: error:
Parse error: module header, import declaration
or top-level declaration expected.
|
18 | imAnError
| ^^^^^^^^^
Error when running Shake build system:
* _build/lib/WCLoan.o
user error (Development.Shake.cmd, system command failed
Command: ghc -this-unit-id wcloan-0.0.1 src/WCLoan.hs -outputdir_build/lib -isrc:app:test -dynamic-too -O2 -j12 -fPIC -Werror -Wall -package-name wcloan-0.0.1 '-package base
-4.12.0.0' '-package calc-0.0.1' '-package vector-0.12.0.3'
Exit code: 1
Stderr:
src/WCLoan.hs:18:1: error:
Parse error: module header, import declaration
or top-level declaration expected.
|
18 | imAnError
| ^^^^^^^^^
)
I see that the error occurs during build, then is also shown under the line
Error when running Shake build system:
Is there anything I can do to have it show only once?
The error messages are coming from two distinct locations:
The first one is being printed by a command that Shake runs and writes to stderr with an error message. When you do cmd ... Shake defaults to EchoStderr True (print out the stderr stream to the console), but you can pass EchoStderr False to not echo the stderr.
The second is an exception being bubbled up by Haskell, as a ShakeException, which then gets printed out at the end, and includes the stderr. When you do cmd ... Shake defaults to WithStderr True to include the stderr in the exception, and you can pass WithStderr False to not include the stderr in the exception.
However, because of the way Shake works, you may find that the error message comes out quite a long way before the end of the full Shake command. Therefore, I recommend leaving WithStderr as it is, if you do want to see stderr only once.

AOSP Build TARGET_PRODUCT fails

I'm trying to build an external tool with AOSP. My OS is Linux, Distribution ArchLinux (i3wm), but to compile AOSP I use Ubuntu in Docker (https://android.googlesource.com/platform/build/+/master/tools/docker)
First step:
# init repo
repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r36 --depth=1
repo sync
. build/envsetup.sh # set up environment
lunch aosp_arm-eng # select target to build
Second step: select tool and build
cd external/selinux
mma -j48
Output:
ninja: error: unknown target 'MODULES-IN-'
15:41:55 ninja failed with: exit status 1
make: *** [run_soong_ui] Error 1
make: Leaving directory `/home/user/aosp'
#### make failed to build some targets (6 seconds) ###
Another tool
cd external/wpa_supplicant_8
mma -j48
Output:
ninja: error: unknown target 'MODULES-IN-external-wpa_supplicant_8'
15:41:55 ninja failed with: exit status 1
make: *** [run_soong_ui] Error 1
make: Leaving directory `/home/user/aosp'
#### make failed to build some targets (2 seconds) ###
This happens with any aosp generic target:
Lunch menu... pick a combo:
1. aosp_arm-eng # fails
2. aosp_arm64-eng # fails
3. aosp_mips-eng # fails
4. aosp_mips64-eng # fails
5. aosp_x86-eng # fails
6. aosp_x86_64-eng # fails
7. full_fugu-userdebug # works
8. aosp_fugu-userdebug # works
9. car_emu_arm64-userdebug # fails
10. car_emu_arm-userdebug # fails
11. car_emu_x86_64-userdebug # fails
12. car_emu_x86-userdebug # fails
13. mini_emulator_arm64-userdebug # fails
14. m_e_arm-userdebug # fails
15. m_e_mips64-eng # fails
16. m_e_mips-userdebug # fails
17. mini_emulator_x86_64-userdebug # fails
18. mini_emulator_x86-userdebug # fails
19. aosp_dragon-userdebug # works
20. aosp_dragon-eng # works
21. aosp_marlin-userdebug # works
22. aosp_marlin_svelte-userdebug # works
23. aosp_sailfish-userdebug # works
24. aosp_angler-userdebug # works
25. aosp_bullhead-userdebug # works
26. aosp_bullhead_svelte-userdebug # works
27. hikey-userdebug # works
I want to compile some binary tools in all arch: arm, arm64, x86 and x86_64.
Why aosp_arm-eng does not work? Or how can I change the CPU architecture from non generic aosp target?
Using tapas does not work.
You probably need to make a full AOSP build before trying to use mm... shortcuts - looks like some build script files were not generated yet.
clear all the binaries from /out dir with make clean command & then try to make a full build
Actually there is no need to do a full build. Just open your Android.mk or Android.bp of the module you want to build, and look for variable MODULE_NAME.
Then from the root of the project make
mm $MODULE_NAME
It should build all the dependencies you need first.
I suggest that use the mmm command for building. Also make sure that the directory you are pointing to contains a Android.bp or Android.mk
mmm /external/selinux
Also I suggest to clean the outputs by remove the out directory or simply run:
make clean
If still you have that problem, remove the --depth=1 argument on repo init and sync it again. that argument limits the commit fetching from remote branch.
Use below commands to compile module from root dir
Goto root dir
make clean
source build/envsetup.sh
lunch "select option"
make "module name" -j8

OpenMPI bind() failed on error Address already in use (48) Mac OS X

I have installed OpenMPI and tried to compile/execute one of the examples delivered with the newest version.
As I try to run with mpiexec it says that the address is already in use.
Someone got a hint why this is always happening?
Kristians-MacBook-Pro:examples kristian$ mpicc -o hello hello_c.c
Kristians-MacBook-Pro:examples kristian$ mpiexec -n 4 ./hello
[Kristians-MacBook-Pro.local:02747] [[56076,0],0] bind() failed on error Address already in use (48)
[Kristians-MacBook-Pro.local:02747] [[56076,0],0] ORTE_ERROR_LOG: Error in file oob_usock_component.c at line 228
[Kristians-MacBook-Pro.local:02748] [[56076,1],0] usock_peer_send_blocking: send() to socket 19 failed: Socket is not connected (57)
[Kristians-MacBook-Pro.local:02748] [[56076,1],0] ORTE_ERROR_LOG: Unreachable in file oob_usock_connection.c at line 315
[Kristians-MacBook-Pro.local:02748] [[56076,1],0] orte_usock_peer_try_connect: usock_peer_send_connect_ack to proc [[56076,0],0] failed: Unreachable (-12)
[Kristians-MacBook-Pro.local:02749] [[56076,1],1] usock_peer_send_blocking: send() to socket 20 failed: Socket is not connected (57)
[Kristians-MacBook-Pro.local:02749] [[56076,1],1] ORTE_ERROR_LOG: Unreachable in file oob_usock_connection.c at line 315
[Kristians-MacBook-Pro.local:02749] [[56076,1],1] orte_usock_peer_try_connect: usock_peer_send_connect_ack to proc [[56076,0],0] failed: Unreachable (-12)
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------
--------------------------------------------------------------------------
mpiexec detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:
Process name: [[56076,1],0]
Exit code: 1
--------------------------------------------------------------------------
Thanks in advance.
Okay.
I have now changed the $TMPDIR environment variable with export TMPDIR=/tmp and it works.
Now it seems to me that the OpenMPI Session folder was blocking my communication. But why did it?
Am I missing something here?

Debugging seg fault (can't modify source code or makefile)

I'm trying to debug a seg fault in C in a research code. I cannot modify the source code/makefile. Since I can't modify the makefile (i.e., recompile the program) and the executable was not compiled with the -g option, I assume that throws gdb debugging out the window? Or is there a way to use gdb without compiling the executable using -g?
I could request to make changes to the source code, but I am almost certain the seg fault is due to one of my input files, so it shouldn't be a source code problem.
Someone had suggested I use "strace," which I am not very familiar with. Here is the end of the output when I strace'd my program:
close(27) = 0
munmap(0x2abe4843d000, 65536) = 0
write(2, "==== backtrace ====\n", 20==== backtrace ====
) = 20
write(2, " 2 0x00000000000597bc mxm_handle"..., 113 2 0x00000000000597bc mxm_handle_error() /var/tmp/OFED_topdir/BUILD/mxm-3.3.3055/src/mxm/util/debug/debug.c:641
) = 113
write(2, " 3 0x000000000005992c mxm_error_"..., 121 3 0x000000000005992c mxm_error_signal_handler() /var/tmp/OFED_topdir/BUILD/mxm-3.3.3055/src/mxm/util/debug/debug.c:616
) = 121
write(2, " 4 0x00000037ccc326a0 killpg() "..., 37 4 0x00000037ccc326a0 killpg() ??:0
) = 37
write(2, " 5 0x00000000004ec6ef interpLema"..., 99 5 0x00000000004ec6ef interpLemansToMopar_linear() /home/dzdang/w16/sources/mopar_bc_interp.c:559
) = 99
write(2, " 6 0x000000000040c4ee main() /h"..., 68 6 0x000000000040c4ee main() /home/dzdang/w16/sources/lemans.c:611
) = 68
write(2, " 7 0x00000037ccc1ed5d __libc_sta"..., 48 7 0x00000037ccc1ed5d __libc_start_main() ??:0
) = 48
write(2, " 8 0x0000000000403c99 _start() "..., 37 8 0x0000000000403c99 _start() ??:0
) = 37
write(2, "===================\n", 20===================
) = 20
brk(0x2958000) = 0x2958000
tgkill(15432, 15432, SIGSEGV) = 0
rt_sigreturn(0x3c48) = 46993935941696
--- SIGSEGV (Segmentation fault) # 0 (0) ---
+++ killed by SIGSEGV +++
Segmentation fault
Any ideas what this means? Or any suggestions on how to debug?
"...but I am almost certain the seg fault is due to one of my input files"
Then your debugging should concentrate on your input files. Is there a specification of the input?
If you have many input files and checking the files manually would be unfeasible, you could write a validator in C that checks all the input files for the proper format and reports erors. With those validated files the program in question won't crash anymore (hopefully).
(EDIT)
As for the debugging of the inputs, try a minimal input and expand that untill you are at the complete input. Somewhere a crash will occur that may give you have an indication.
I assume that throws gdb debugging out the window?
I am almost certain the seg fault is due to one of my input files, so it shouldn't be a source code problem.
You are making a lot of unwarranted assumptions.
A SIGSEGV is always a source code problem: invalid input should produce an error, not a crash.
The output from strace that you show contains file and line info, which usually means that the program is in fact compiled with -g.
GDB is perfectly capable of debugging programs compiled without -g, but it requires a skilled operator.
The program appears to self-report an error of some kind. Unfortunately you've removed all the relevant parts of that error, and show only the stack trace (which doesn't mean anything without the earlier output).
What you should do:
Stop making unwarranted assumptions and guesses.
Edit your question (or start a new one), showing the error that the program actually reports.
Run the program under GDB, and observe that you can in fact see file / line info, and likely parameter and local variable values.
Read the source, understand how and why it may crash, examine variables at point of crash, understand the cause (i.e. actually debug the problem).

rc.local is not running on raspberry pi's startup

I'm trying to run a simple C code when the pi boots, so I followed the steps on the documentation (https://www.raspberrypi.org/documentation/linux/usage/rc-local.md), but when I start it, it shows this error:
Failed to start etc/rc.local compatibility.
See 'systemctl status rc-local.service' for details.
I do as it says and I receive this:
rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; static)
Drop-In: /etc/systemd/system/rc-local.service.d
ttyoutput.conf
Active: failed (Result: exit-code) since Tue 2015-12-08 10:44:23 UTC; 2min 18s ago
Process: 451 ExecStart=/etc/rc.local start (code=exit, status=203/EXEC)
My rc.local file looks like this:
./home/pi/server-starter &
exit 0
Can anyone show me what I'm doing wrong?
You have to refer to your script using an absolute path.
/home/pi/server-starter &
Notice the absence of the . in comparison to your solution.
Also, you may have to add a reference to the shell right at the beginning of your rc.local.
#!/bin/sh -e
/home/pi/server-starter &
exit 0
to run a script shell "in a script shell" use this :
sh -c /absolute/path/to/script;
to run this script in background use this :
sh -c /absolute/path/to/script &;
Don't forget exit 0 at the end of the file

Resources