QtCreator can't use G++ for cross compiling. Must be a configuration issue - qt-creator

When I try to compile a code for VAR SOM AM33 using QTCreator I get this error:
c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../buscaTexto -I. -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/include/qt5 -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/include/qt5/QtWidgets -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/include/qt5/QtGui -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/include/qt5/QtCore -I. -I. -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++ -o main.o ../buscaTexto/main.cpp
make: c: Command not found
QTCreator's qmake generates a Makefile including this:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../buscaTexto/main.cpp
And $(CXX) is defined as following:
CXX = $(OE_QMAKE_CXX)
I know this is wrong because when I compile this code for PC I haven't any error and the Makefile define CXX as following:
CXX = g++
So It runs:
g++ c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../buscaTexto -I. -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/include/qt5 -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/include/qt5/QtWidgets -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/include/qt5/QtGui -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/include/qt5/QtCore -I. -I. -I/opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++ -o main.o ../buscaTexto/main.cpp
The value of OE_QMAKE_CXX is defined in the file /opt/qt5devtools/sysroots/i686-arago-linux/environment-setup.d/qt5.sh as following:
export OE_QMAKE_CXX=$CXX
Makefile's header includes this:
# Command: /opt/qt5devtools/sysroots/i686-arago-linux/usr/bin/qt5/qmake -spec linux-oe-g++ CONFIG+=debug -o Makefile ../buscaTexto/buscaTexto.pro
the file /opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++/qmake.conf defines:
QMAKE_CXX = $(OE_QMAKE_CXX)
but the file /opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi/usr/lib/qt5/mkspecs/linux-arm-gnueabi-g++/qmake.conf defines:
QMAKE_CXX = arm-linux-gnueabi-g++
I don't know why QtCreator uses linux-oe-g++ because I have configured all for using linux-arm-gnueabi-g++.
Can someone help me?
Thank you.

I've solved this issue. The solution is here:
http://wiki.wandboard.org/index.php/Setup_QT_creator_for_developing_QT_apps_on_wandboard

Related

Caffe-segnet: redefinition of argument 'compiler-bindir'

It's been days trying to compile caffe-segnet, and now stuck at this error, I m using gcc gcc (Ubuntu 4.8.5-4ubuntu8) 4.8.5
to compile caffe-segnet. I'm using Cuda 9.0, cudnn v2 and opencv 3.3.0 as mentionned in the documentation of caffe and opencv. Disabling cudnn or not in the Makefile.config doesn't change anything as mentioned here.
Before that I was using cuda 10.0 and cudnn 7.0 and deleted all because when starting my model there was so many errors. Here is the output error when using make all:
CXX src/caffe/common.cpp
/usr/bin/g++-4.8 src/caffe/common.cpp -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -std=c++11 -MMD -MP -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -c -o .build_release/src/caffe/common.o 2> .build_release/src/caffe/common.o.warnings.txt \
|| (cat .build_release/src/caffe/common.o.warnings.txt; exit 1)
CXX src/caffe/internal_thread.cpp
/usr/bin/g++-4.8 src/caffe/internal_thread.cpp -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -std=c++11 -MMD -MP -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -Wall -Wno-sign-compare -c -o .build_release/src/caffe/internal_thread.o 2> .build_release/src/caffe/internal_thread.o.warnings.txt \
|| (cat .build_release/src/caffe/internal_thread.o.warnings.txt; exit 1)
NVCC src/caffe/layers/upsample_layer.cu
/usr/local/cuda/bin/nvcc -D_FORCE_INLINES -ccbin=/usr/bin/g++-4.8 -Xcompiler -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -std=c++11 -ccbin=/usr/bin/g++-4.8 -Xcompiler -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/local/hdf5 -I/usr/local/hdf5/include -I.build_release/src -I./src -I./include -I/usr/local/cuda/include -M src/caffe/layers/upsample_layer.cu -o .build_release/cuda/src/caffe/layers/upsample_layer.d \
-odir .build_release/cuda/src/caffe/layers
nvcc fatal : redefinition of argument 'compiler-bindir'
Makefile:544: recipe for target '.build_release/cuda/src/caffe/layers/upsample_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/upsample_layer.o] Error 1
and the line 544 in Makefile which the error come from:
...
# cat $#.$(WARNS_EXT)
$(BUILD_DIR)/cuda/%.o: %.cu | $(ALL_BUILD_DIRS)
544> # echo NVCC $<
$(Q)$(CUDA_DIR)/bin/nvcc $(NVCCFLAGS) $(CUDA_ARCH) -M $< -o ${#:.o=.d} \
-odir $(#D)
...
Notice that I tried compiling it with gcc 5 and gcc 7 and the same error occur ! Any idea guys ?
EDIT 1:
I also added this CUSTOM_CXX := /usr/bin/g++-4.8 to Makefile.config
Since no one aswered I finaly found a solution, the error is caused because the same argument is called twice, in my Makefile I added those lines of code:
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) -std=c++11
LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
to avoid this error /usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
In the same file in the complete build flags, we have the same flag:
...
# Complete build flags.
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
# mex may invoke an older gcc that is too liberal with -Wuninitalized
...
what I did is commenting my flag I added:
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
#NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) -std=c++11
LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
and add -std=c++11 argument to NVCCFLAGS in the complete build flags section, it turned to be something like this:
...
# Complete build flags.
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) -std=c++11
# mex may invoke an older gcc that is too liberal with -Wuninitalized
...
Before doing a make all after editing your Makefile, make sure you do a make clean or you'll get the same error !

How to create makefile for compiling multiple programs

I have some problems with creating makefile. I have tried to compile some files from terminal and found right options for gcc to do this.
But I have some troubles with creating one makefile to do all this tasks.
Here are my commands that work.
gcc -c pstree.c -DHAVE_CONFIG_H -I.
gcc -o hello pstree.o -L/usr/lib/ -ltinfo
gcc -c fuser.c -DHAVE_CONFIG_H -I.
gcc -c -o libsignals.a signals.c
gcc -o hello fuser.o -L/usr/lib/ -L. -lsignals
gcc -c -o libsignals.a signals.c
gcc -o hello killall.o -L/usr/lib/ -L. -lsignals
gcc -c killall.c -DHAVE_CONFIG_H -I.
How can I make a Makefile for executing these commands?
killall: hello\ fuser.o
gcc -c -o libsignals.a signals.c
gcc -o hello killall.o -L/usr/lib/ -L. -lsignals
gcc -c killall.c -DHAVE_CONFIG_H -I.
fuser: hello\ pstree.o
gcc -c fuser.c -DHAVE_CONFIG_H -I.
gcc -c -o libsignals.a signals.c
gcc -o hello\ fuser.o -L/usr/lib/ -L. -lsignals
pstree:
gcc -c pstree.c -DHAVE_CONFIG_H -I.
gcc -o hello\ pstree.o -L/usr/lib/ -ltinfo
clean:
rm -rf *.o
I wrote very very dirty you can define cc variable such as:
CC = gcc
CFLAGS = -g -Wall -I.
LIBS = -L/usr/lib/ -lsignals
and so on.....
Mine is very dirty ....
NOTE: Before each line of intending you have to use TAB, not space.
usage :
make clean
make killall

generic makefile to create multiple executable using different flags

I would like to create a generic Makefile that builds several executables using different compiler flags for each executable without using shell commands. The executable file name should be composed from the source file and a unique post fixed name. It should also produce an assembly or preprocessor file per source file if needed.
For the target BIN_BDG_FILES, the "$<" (exercise-1.1.0.c ) is always the first item from the list (exercise-1.1.0.c exercise-1.1.1.c exercise-1.2.0.c exercise-1.2.1.c) as expected. I tried without success to modify the SRC_FILES using the filter-out function. My intent was to remove the first item from the list for each Target, so that the first item corresponds to the correct target. I am not sure this is the correct approach. Your comments are welcome.
i.e.
This is my attempt at using built in make constructs.
$(BIN_DBG_FILES): $(SRC_FILES)
$(CC) $(DBG_CFLAGS) $(IFLAGS) $< -o $#
echo SRC_FILES := $(filter-out $<, $(SRC_FILES))
Makefile
SHELL = bash
SRC_FILES = $(wildcard *.c)
BIN_FILES = $(patsubst %.c,%,$(SRC_FILES))
BIN_DBG_FILES = $(patsubst %.c,%-dbg,$(SRC_FILES))
SRC_PRE = $(patsubst %.c,%-pre,$(SRC_FILES))
CC = gcc
WARNINGS := -Wall
CFLAGS = -O2 -std=c99 $(WARNINGS)
DBG_CFLAGS = -g -O -std=c99 $(WARNINGS)
PRE_FLAG = -E
IFLAGS = -I.
all: $(BIN_FILES) $(BIN_DBG_FILES) MK-BASH
$(BIN_DBG_FILES): $(SRC_FILES)
$(CC) $(DBG_CFLAGS) $(IFLAGS) $< -o $#
MK-BASH::
for src in $(SRC_FILES); do \
echo $(CC) $(DBG_CFLAGS) $(IFLAGS) $$src -o $${src%.c}-dbg; \
$(CC) $(DBG_CFLAGS) $(IFLAGS) $$src -o $${src%.c}-dbg; \
$(CC) $(DBG_CFLAGS) $(IFLAGS) $$src -o $${src%.c}-dbg; \
$(CC) $(PRE_FLAG) $$src > $${src%.c}-pre; \
done
clean:
rm -f $(BIN_FILES) *-dbg *-pre
This is the output from executing make command.
This is the output from the target BIN_FILES.
gcc -O2 -std=c99 -Wall exercise-1.1.0.c -o exercise-1.1.0
gcc -O2 -std=c99 -Wall exercise-1.1.1.c -o exercise-1.1.1
gcc -O2 -std=c99 -Wall exercise-1.2.0.c -o exercise-1.2.0
gcc -O2 -std=c99 -Wall exercise-1.2.1.c -o exercise-1.2.1
This is the output from target BIN_DBG_FILES which uses the first source file on the list to build all targets. It should use the appropriate file (exercise-1.1.1.c) to build each target file (exercise-1.1.1-dbg).
gcc -g -O -std=c99 -Wall -I. **exercise-1.1.0.c** -o exercise-1.1.0-dbg
gcc -g -O -std=c99 -Wall -I. **exercise-1.1.0.c** -o exercise-1.1.1-dbg
gcc -g -O -std=c99 -Wall -I. **exercise-1.1.0.c** -o exercise-1.2.0-dbg
gcc -g -O -std=c99 -Wall -I. **exercise-1.1.0.c** -o exercise-1.2.1-dbg
This is the output from the target MK-BASH using shell commands.
for src in exercise-1.1.0.c exercise-1.1.1.c exercise-1.2.0.c exercise-1.2.1.c; do \
echo gcc -g -O -std=c99 -Wall -I. $src -o ${src%.c}-dbg; \
gcc -g -O -std=c99 -Wall -I. $src -o ${src%.c}-dbg; \
gcc -g -O -std=c99 -Wall -I. $src -o ${src%.c}-dbg; \
gcc -E $src > ${src%.c}-pre; \
done
output:
gcc -g -O -std=c99 -Wall -I. exercise-1.1.0.c -o exercise-1.1.0-dbg
gcc -g -O -std=c99 -Wall -I. exercise-1.1.1.c -o exercise-1.1.1-dbg
gcc -g -O -std=c99 -Wall -I. exercise-1.2.0.c -o exercise-1.2.0-dbg
gcc -g -O -std=c99 -Wall -I. exercise-1.2.1.c -o exercise-1.2.1-dbg
Use a pattern rule:
DBG: $(BIN_DBG_FILES)
%-dbg: %.c
#echo $(CC) $(DBG_CFLAGS) $(IFLAGS) $< -o $#

Boost static linking in unix

I am using the Boost library in Unix, GCC. I read the following topic: Boost static linking and added -static to my Makefile. However, this does not work.
Here is my Makefile:
all: nbbo
nbbo: nbbo.o reader.o
g++ -static -O3 -ffast-math -funroll-loops -ansi -pedantic-errors -L/usr/lib -lboost_filesystem -lboost_serialization -lboost_iostreams -lz -I /usr/include/boost -o nbbo nbbo.o reader.o
nbbo.o: nbbo.cpp
g++ -static -O3 -ffast-math -funroll-loops -ansi -pedantic-errors -I /usr/include/boost -c -o nbbo.o nbbo.cpp
reader.o: reader.cc reader.h
g++ -static -O3 -ffast-math -funroll-loops -ansi -pedantic-errors -I /usr/include/boost -c -o reader.o reader.cc
clean:
rm *.o
And here is the error message:
nbbo.o: In function `__tcf_10':
nbbo.cpp:(.text+0x3d9): undefined reference to `boost::serialization::extended_type_info::key_unregister() const'
nbbo.cpp:(.text+0x3e3): undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()'
nbbo.cpp:(.text+0x3fb): undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
etc
Which "UNIX" are you using? Using the -static flag should work fine on linux. But not on OSX. On OSX you have to remove the static flag and give the complete path to the library in order to link statically. I dont know how this would work on other "UNIXes"
eg.
g++ ..... /path/to/your/lib.a ... -o ..

Compiling error

I downloaded someone's source code for a program and i needed to make some changes.
Now i want to compile it but it doesn't seem to work.
PROGS = isotociso
COMMON = tools.o bn.o ec.o wiidisc.o rijndael.o
DEFINES = -DLARGE_FILES -D_FILE_OFFSET_BITS=64
LIBS = C:/Dev-Cpp/lib/libwsock32.a C:/Dev-Cpp/lib/libcrypto.a C:/Dev-Cpp/lib/libcomdlg32.a
CC = gcc
#CFLAGS = -Wall -W -Os -Ilibwbfs -I.
CFLAGS = -Wall -m32 -W -ggdb -Ilibwbfs -I.
LDFLAGS = -m32 -static
VPATH+=libwbfs
OBJS = $(patsubst %,%.o,$(PROGS)) $(COMMON)
all: $(PROGS)
$(PROGS): %: %.o $(COMMON) Makefile
$(CC) $(CFLAGS) $(LDFLAGS) $< $(COMMON) $(LIBS) -o $#
$(OBJS): %.o: %.c tools.h Makefile
$(CC) $(CFLAGS) $(DEFINES) -c $< -o $#
clean:
-rm -f $(OBJS) $(PROGS)
Output
C:\Users\Panda\Desktop\uloader_v4.1\src\isotociso\src>make
gcc -Wall -m32 -W -ggdb -Ilibwbfs -I. -DLARGE_FILES -D_FILE_OFFSET_BITS=64 -c i
sotociso.c -o isotociso.o
process_begin: CreateProcess((null), gcc -Wall -m32 -W -ggdb -Ilibwbfs -I. -DLAR
GE_FILES -D_FILE_OFFSET_BITS=64 -c isotociso.c -o isotociso.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [isotociso.o] Error 2
What would be the problem?
Looks to me as if gcc is not in your PATH.
It also looks like you need MinGW to get the libraries.
I am no expert in C(++) development under Windows, but my interpretation would be that it can't find the compiler itself. What development environment are you using?
It looks like it can't find a file. Are you sure you have all the required source files?

Resources