g++ error signal 11 caught with makefile - makefile

I am using makefiles to build .cpp source code. While building the dependencies for the specified source file,after including 14 header files,I encountered the error given below.
g++ ERROR: signal 11 caught, stop processing
make.exe: *** [folder\cbd\new\debug/new.d] Error 32
Any help on this matter will be helpful.
Thanks and regards,
newbie_in

g++ crashed, nothing wrong with makefiles. The first thing to do, is to update your g++ to the latest version. If that does not help, find the minimal example that reproduces the problem and report it to g++ maintainers. Then as a temporary fix until they fix the bug, you will need to fool around with your new.cpp file, most likely the preprocessing lines, until the error disappears.

Related

CMake: The C Compiler is not able to compile a simple test program

I am trying to cross-compile the Azure IoT SDK C for a Mips processor. Cross-compiling an older version of the same SDK using an older version of CMake (2.8.12.2) works just fine, so I doubt it's the code itself. I am guessing it's the Mips GCC compiler.
Error message:
CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"/usr/local/mipsisa32r2el/r23/bin/mipsisa32r2el-axis-linux-gnu-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/axis/azure-iot-sdk-c/cmake/iotsdk_linux/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_2cc84/fast"
/usr/bin/make -f CMakeFiles/cmTC_2cc84.dir/build.make CMakeFiles/cmTC_2cc84.dir/build
make[1]: Entering directory '/home/axis/azure-iot-sdk-c/cmake/iotsdk_linux/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_2cc84.dir/testCCompiler.c.o
/usr/local/mipsisa32r2el/r23/bin/mipsisa32r2el-axis-linux-gnu-gcc --sysroot=/usr/local/mipsisa32r2el/r23 -o CMakeFiles/cmTC_2cc84.dir/testCCompiler.c.o -c /home/axis/azure-iot-sdk-c/cmake/iotsdk_linux/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_2cc84
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2cc84.dir/link.txt --verbose=1
/usr/local/mipsisa32r2el/r23/bin/mipsisa32r2el-axis-linux-gnu-gcc --sysroot=/usr/local/mipsisa32r2el/r23 -rdynamic CMakeFiles/cmTC_2cc84.dir/testCCompiler.c.o -o cmTC_2cc84
/usr/local/mipsisa32r2el/r23/lib/gcc/mipsisa32r2el-axis-linux-gnu/4.7.2/../../../../mipsisa32r2el-axis-linux-gnu/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_2cc84.dir/build.make:97: recipe for target 'cmTC_2cc84' failed
make[1]: *** [cmTC_2cc84] Error 1
make[1]: Leaving directory '/home/axis/azure-iot-sdk-c/cmake/iotsdk_linux/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_2cc84/fast' failed
make: *** [cmTC_2cc84/fast] Error 2
Unfortunately, I am stuck with the Mips GCC compiler I have. Is there a way to disable this test-program check?
Solution was to add these to the toolchain-file:
SET (CMAKE_C_COMPILER_WORKS 1)
SET (CMAKE_CXX_COMPILER_WORKS 1)
CMake tries to compile an executable using "standard" (as per what CMake thinks is standard) compiler options and tries to run that executable, so to see if the compiler is working. The executable is simple like int main(int argc, char *argv[]) { return argc - 1; }.
You can't do that when cross-compiling. Because usually you can't link with a proper C standard library, you don't have printf, or _start or _exit or similar, passing arguments to main is implementation-defined, or you need a special linker script, or there's no emulator for your architecture, so can't run cross-compiled source on the host, etc... Simply: you usually can't run the cross-compiled executable on the host, and most of the time even the compilation is hard enough to do.
The common solution is to set before project():
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
So that CMake will try to compile a static library not an executable, as explained in cmake docs CMAKE_TRY_COMPILE_TARGET_TYPE. This avoids running the linker and is intended for cross-compiling.
You can set CMAKE_C_COMPILER_WORKS and it will omit the check in CMakeTestCCompiler.cmake, but CMAKE_TRY_COMPILE_TARGET_TYPE is a more proper solution.
Well this problem is really annoying, i faced this issue for 2 day now I got solution.
Let me explain my issue first
When I delete NDK and Cmake from Sdk folder and Run my application then grable install NDK and Cmake again.
Only that time Application run and when try to run again i get this error The C Compiler is not able to compile a simple test program.
Before i was using ndkVersion "22.0.7026061" then change to thisndkVersion "21.1.6352462" and IT WORKED.
I think this is NDK problem and most of answer are outdated try this i hope this will HELP.
If using CMake GUI, you can add a boolean entry named
CMAKE_CXX_COMPILER_FORCED
then set it to True.
This will skip checking process for this build.
Ran into the same problem while re-compiling a project. Turned out that the compiler had been updated in the meantime.
After removing the build directory and creating it again, the compilation completed without errors.

After update to Mac OS 10.8: "Undefined symbols for architecture x86_64"; "clang: error: linker command failed with exit code 1"

After updating a new Mac (OS 10.8), my colleague and I are unable to compile a C++ code that we have been using. We are not experienced with coding and would be very grateful if someone could point us in the right direction at a newbie level. We see that there are many posts on this type of error, but if any of them are relevant, we don't see how, except that the posts all seem to say that this is likely to be a linker problem.
When we do "make," there is a lot of output. The first part is this:
Us$ make g++ -o ourProg 1.o main.o 2.o -L/Prog/libraries
-L/Prog/support_libraries -l_codea -l_codeb ... Undefined symbols for architecture x86_64:
The final part is this:
ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation) make: ***
[ourProg] Error 1
Unfortunately, a condition of using the code is that we can't post it online, so it may be that there is not enough information that anyone can help.
The thing that stands out for me is that it looks like Clang is being used for linking, even though we have specifically said we want g++ to be used for compiling. In the makefile, we have said:
CC = g++
(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
Thanks everyone; the problem is solved. I'm not sure whether to indicate this anywhere in the question, sorry. I'd like to describe how we fixed it, in case any other newbies are having trouble understanding the more sophisticated posts on this problem!
First, we followed the advice here by updating to OS 10.9 and installing the new command line tools. Then we came across a forum post that discussed where the linking problem comes from. In OS 10.8 and 10.9, the C++ default standard libraries are different. So we first added a new include to our makefile:
/usr/bin/clang++
Then we added to the compiler flag line and the libraries:
-stdlib=libstdc++

Can binutils Be Built Without libiberty? Or Can report_times Be Disabled?

TLDR: Getting fatal error 'failed to get process times' on cross-native build of gcc. Can I remove report_times code from gcc.c OR use gcc command line option to disable report_times OR build gcc without libiberty (which contains pex_get_times used by report_times
DETAIL
After beating my head against various problems I've (finally) successfully used the Android NDK standalone toolchain to build binutils 2.23 and gcc 4.70.
My current problem is getting it to run on my device.
I've written a standard 'hello world' (copied from here) to test gcc on my device. When I run:
arm-linux-eabi-gcc hello.c -o hello
or:
arm-linux-eabi-gcc hello.c
I get the following error:
arm-linux-eabi-gcc: fatal error: failed to get process times: No such file or directory.
Google did not return much except for links to gcc.c source. Examining the source, I found the error in a function (module? extension?) called report_times. The error is returned by the function (module? extension?) pex_get_times....I'm guessing it does so if it can't get the process times.
The pex_get_times function (module? extension? I'm not sure what it is) is defined in libiberty. I can use --disable-build-libiberty, but it doesn't help for the host (my NookHD) gcc build.
My question(s):
Can this portion of gcc.c be safely (and easily) removed...i.e. the report_times function and everything associated with it?
or
Is there a command line option to tell arm-linux-eabi-gcc NOT to use report_times?
or
Is there a way to disable build of libiberty for host/target for both gcc and binutils, and would that fix the error?
As always...I'll keep researching while awaiting an answer.
Found this about an hour after posting this question. Maybe two.
Apparently report_times is part of debugging symbols (?) for GCC. To exclude report_times (which causes the 'failed to get process times' from the original question) you have to build the non-debug...or release...version of gcc.
To do this, I used info from this link: http://www-gpsg.mit.edu/~simon/gcc_g77_install/build.html
BUT, I omitted the -g from the LIBCXXFLAGS and LIBCFLAGS and I added LIBCPPFLAGS without -g just in case. Ran make DESTDIR=/staging/install/path install-host, tarballed and transferred to device. No more 'failed to get process times' error.
I am seeing another error, but it is not related to this question

Disable warnings being treated as errors (cc1.exe)

I am developing a BREW application. When compiling the application to get a MOD file, I am continuously getting this error:
cc1.exe: warnings being treated as errors
I want to disable this warning. I have googled it, and many say disabling -werror will help, but how can I do that?
The compiler is CodeSourcery ARM.
You need to remove -Werror from CFLAGS, CPPFLAGS etc.; these are usually set in Makefile's or build scripts.
However, I'd strongly advice to fix the actual warnings instead, which will produce more stable and error-free code.
Run this Command in Terminal to say, not to consider warning as error
make CFLAGS="-Wno-error=format-truncation"

CROSS-COMPILE FOR MIPS PROCESSOR

i have developed an application for android platform.It is for ARM processor.It's working fine.I want to try the same application on Android running on MIPS(32 bit) processor.I tried to cross-compile the application but could not generate the shared library.I am using MIPS ndk and android source code customized for MIPS processor.While generating static library , it is not showing any errors but while generating the shared library,i am getting following errors:
/home/user/android-ndk-r7m/toolchains/mips-linux-android-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/mips-linux-android/4.4.3/../../../../mips-linux-android/bin/ld: /home/user/workspace/testing/ccl_obj/libccl.a(teccl_call_initiate.o): relocation R_MIPS_HI16 against `__gnu_local_gp' can not be used when making a shared object; recompile with -fPIC
/home/user/workspace/testing/ccl_obj/libccl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: * [obj/local/mips-r2/libhello-jni.so] Error 1
Please suggest any solution.
Thanks
The error seems to suggest what to do.
When compiling your source code, add the -fPIC compiler flag.
Just in case if somebody face this problem.run
make clean
make
I got similar problem today and running clean resolved my problem.

Resources