I'm getting this error while linking a C++ code.
I'm using g++ cross compiler for arm and building it on a Ubuntu machine.
Do I have to pass any flags or include some library?
Related
I have a C++ project with CMake build system. When I compile using GCC it compiles fine. But when I tried to use NDK toolchain, it shows the following error.
Linking CXX executable ../bin/my_app
/opt/r19c/linux-x86_64/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld:
cannot find -lpthread
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
How can I fix this issue?
Using windows and trying to compile emscripten:
emmake mingw32-make SUBTARGET=pacmantest SOURCES=C:\Users\Adam\Documents\GitHub\mame\drivers\pacman.cpp
I'm not used to compiling C but I have the latest versions installed of GCC and Clang but it's not using them for some reason. It's throwing the following error:
'head' is not recognized as an internal or external command, operable program or batch file.
GCC 2.0.10 detected
clang version 6.0 or later needed.
mingw32-make: *** [makefile:1345: build/projects/sd1/mamepacmantest/gmake-asmjs/makefile] Error -1
I have been working this problem for more than a week. I installed the free version of QT off the QT site. I am trying to set up a cross compile environment for a Beaglebone Black ARM 8 platform. I have set up the compiler options using GNU ARM 6.3.0 GNU compiler -- The same compiler that is on my BBB. I successfully created the cross-compile environment and the Beaglebone device. The connect test worked correctly as well.
Here is the simple C++ application that I am trying to compile,
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
Here is what my QT gcc compile options look like,
Here is my kit setup,
Here is my device setup,
When I build the default QT simple application I get these errors,
Running Windows Runtime device detection.
C:/Qt/5.11.0/winrt_armv7_msvc2015/bin/winrtrunner.exe --list-devices
Found 2 Windows Runtime devices.
Running "C:\Program Files (x86)\CMake\bin\cmake.exe -E server "--pipe=\.\pipe{2e664e46-cacb-46ae-b680-ed9c235dc502}" --experimental" in C:\Users\Stephen\AppData\Local\Temp\QtCreator-WLEKuI\qtc-cmake-IDzcFnnJ.
Starting to parse CMake project, using: "-DCMAKE_CXX_COMPILER:STRING=C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-g++.exe", "-DCMAKE_C_COMPILER:STRING=C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe", "-DCMAKE_PREFIX_PATH:STRING=", "-DQT_QMAKE_EXECUTABLE:STRING=".
The C compiler identification is GNU 6.3.0
The CXX compiler identification is GNU 6.3.0
Check for working C compiler: C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe
Check for working C compiler: C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/SysGCC/beaglebone-6.3.0/bin/arm-linux-gnueabihf-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Stephen/AppData/Local/Temp/QtCreator-WLEKuI/qtc-cmake-IDzcFnnJ/CMakeFiles/CMakeTmp
Run Build Command:"C:/PROGRA~2/Ninja/ninja.exe" "cmTC_c3136"
[1/2] Building C object CMakeFiles/cmTC_c3136.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_c3136.exe
FAILED: cmTC_c3136.exe
cmd.exe /C "cd . && C:\SysGCC\beaglebone-6.3.0\bin\arm-linux-gnueabihf-gcc.exe CMakeFiles/cmTC_c3136.dir/testCCompiler.c.obj -o cmTC_c3136.exe -Wl,--out-implib,libcmTC_c3136.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ."
c:/sysgcc/beaglebone-6.3.0/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: unrecognized option '--major-image-version'
c:/sysgcc/beaglebone-6.3.0/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: use the --help option for usage information
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
The build seems to issues a command to the GCC compiler suite to an executable called ld.exe. I verified the path to ld.exe and it is indeed in the directory and handles my "ld --version" command.The error messages show ld.exe '--major-image-version' and fails. ld.exe does not support --major-image-version. Not sure why it is issuing this command to ld.exe.
I know these compilers work as I have manually compiled this program using g++ 6.3.0 compiler. Any suggestions?
A make argument is wrong. Specifically:
unrecognized option '--major-image-version'
You should remove the argument "--major-image-version" from your project's Makefile LFLAGS.
On windows there are 3 makefiles, Makefile, Makefile.debug and Makefile.release
Remove the argument from the one matching your current build config.
I am trying to compile Caffe with OpenBLAS in Ubuntu 16.04. I had downloaded and compile OpenBLAS with make NO_AFFINITY=1 USE_OPENMP=1
OpenBLAS compilation is fine and all its tests are also run
OpenBLAS build complete. (BLAS CBLAS LAPACK LAPACKE)
OS ... Linux
Architecture ... x86_64
BINARY ... 64bit
C compiler ... GCC (command line : gcc)
Fortran compiler ... GFORTRAN (command line : gfortran)
Library Name ... libopenblas_sandybridgep-r0.2.20.dev.a (Multi threaded; Max num-threads is 4)
Use OpenMP in the multithreading. Because of ignoring OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS flags,
you should use OMP_NUM_THREADS environment variable to control the number of threads.
However linking with OpenBLAS libs in Caffe install is giving the following error
Linking CXX executable upgrade_net_proto_binary
/opt/OpenBLAS/lib/libopenblas.so: undefined reference to `GOMP_parallel#GOMP_4.0'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_net_proto_binary.dir/build.make:129: recipe for target 'tools/upgrade_net_proto_binary' failed
make[2]: * [tools/upgrade_net_proto_binary] Error 1
CMakeFiles/Makefile2:403: recipe for target 'tools/CMakeFiles/upgrade_net_proto_binary.dir/all' failed
make[1]: * [tools/CMakeFiles/upgrade_net_proto_binary.dir/all] Error 2
Most likely the reason is that you're linking to the compiled OpenBLAS instead of installing it and linking to the installation. After you run make, you should run make install PREFIX=/path/to/install/OpenBLAS, and then you should link to the installed version.
I tried to compile a Thor library. It depends on SFML. I didnt had any problem with compiling SFGUI which also depends on SFML. Previously I used exactly the same toolchain. Everything worked fine
CMake gui errors:
The C compiler identification is unknown
The CXX compiler identification is GNU 4.9.2
Check for working C compiler: E:/Programs_Portable/Dev-Cpp/minGW32/bin/gcc.exe
Check for working C compiler: E:/Programs_Portable/Dev-Cpp/minGW32/bin/gcc.exe -- broken
CMake Error at C:/CMake/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "E:/Programs_Portable/Dev-Cpp/minGW32/bin/gcc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeTmp
Run Build
Command:"E:/Programs_Portable/Dev-Cpp/minGW32/bin/mingw32-make.exe"
"cmTC_6b11a/fast"
E:/Programs_Portable/Dev-Cpp/minGW32/bin/mingw32-make.exe -f
CMakeFiles\cmTC_6b11a.dir\build.make CMakeFiles/cmTC_6b11a.dir/build
mingw32-make.exe[1]: Entering directory
'D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_6b11a.dir/testCCompiler.c.obj
E:\Programs_Portable\Dev-Cpp\minGW32\bin\gcc.exe -o
CMakeFiles\cmTC_6b11a.dir\testCCompiler.c.obj -c
D:\Michal\Pliki\thor-v2.0-sdk\build\CMakeFiles\CMakeTmp\testCCompiler.c
<built-in>: internal compiler error: Segmentation fault
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://sourceforge.net/projects/mingw-w64> for instructions.
CMakeFiles\cmTC_6b11a.dir\build.make:64: recipe for target
'CMakeFiles/cmTC_6b11a.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_6b11a.dir/testCCompiler.c.obj]
Error 1
mingw32-make.exe[1]: Leaving directory
'D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeTmp'
makefile:125: recipe for target 'cmTC_6b11a/fast' failed
mingw32-make.exe: *** [cmTC_6b11a/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:42 (project)
Configuring incomplete, errors occurred!
See also "D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeOutput.log".
See also "D:/Michal/Pliki/thor-v2.0-sdk/build/CMakeFiles/CMakeError.log".
I tried compiling simple int main(){}. gcc works.
All paths are as intended. (Btw I don't use DevCpp, its just the path to the compiler).
I am surprised because g++ works, CMake is able to display identification but apparently not for gcc
Thanks for any help
The message appears on Solus OS if you don't install the essential build packages.
CMake Error at /usr/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
You have to install the packages, using
sudo eopkg it -c system.devel
Then it works fine.
Fixed now by upgrading my GCC from 4.9.2 to 4.9.3. No more problems with crashing, however apparently there was a change related to C++11 standard and I need to manually edit CMakeLists.txt to change flag -std=c++11 to -std=gnu++11 when compiling any library and any program
MinGW / CxxTest bizarre errors
Edit: Switching/updating MinGW distro solved all problems. I tried updating the compiler to 7.2+/8.0+ versions and got rid of all confiuration problems. Likely it was a corrupted installaton or some older version bug