I have built myself Ogre3D http://ogre3d.org binaries and now I want to link to them my project in Qt ( I am using CMake as my build tool ). This is my CMakeLists.txt file :
project(ogre_face_test)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
include_directories( "/home/XXX/programming/SDKs/OGRE_1.8.1_BUILD/include" "." )
link_directories("/home/XXX/programming/SDKs/OGRE_1.8.1_BUILD/lib")
target_link_libraries( ogre_face_test "OgreMain" )
In .../BUILD/lib directory I have files like : libOgreMain.so, libOgreMain.so.1.8.1 and so on.
I am getting this error on linking in Qt Creator :
/usr/bin/cmake -H/home/XXX/programming/c++/ogre_face_sample/ogre_face_test -B/home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build/CMakeFiles /home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build'
make -f CMakeFiles/ogre_face_test.dir/build.make CMakeFiles/ogre_face_test.dir/depend
make[2]: Entering directory `/home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build'
cd /home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/XXX/programming/c++/ogre_face_sample/ogre_face_test /home/XXX/programming/c++/ogre_face_sample/ogre_face_test /home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build /home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build /home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build/CMakeFiles/ogre_face_test.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build'
make -f CMakeFiles/ogre_face_test.dir/build.make CMakeFiles/ogre_face_test.dir/build
make[2]: Entering directory `/home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build'
Linking CXX executable ogre_face_test
/usr/bin/cmake -E cmake_link_script CMakeFiles/ogre_face_test.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/ogre_face_test.dir/main.cpp.o CMakeFiles/ogre_face_test.dir/FacialAnimation.cpp.o -o ogre_face_test -rdynamic -lOgreMain
/usr/bin/ld: cannot find -lOgreMain
collect2: error: ld returned 1 exit status
make[2]: *** [ogre_face_test] Error 1
make[2]: Leaving directory `/home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build'
make[1]: *** [CMakeFiles/ogre_face_test.dir/all] Error 2
make[1]: Leaving directory `/home/XXX/programming/c++/ogre_face_sample/ogre_face_test-build'
make: *** [all] Error 2
EDIT
On the other hand if I use qmake instead of CMake with this file :
TARGET = qt_test_1
TEMPLATE = app
SOURCES += main.cpp\
FacialAnimation.cpp
HEADERS += FacialAnimation.h
INCLUDEPATH += /usr/include\
/home/monkey/programming/SDKs/OGRE_1.8.1_BUILD/include
DEPENDPATH += /usr/include
LIBS += -L/home/monkey/programming/SDKs/OGRE_1.8.1_BUILD/lib -lOgreMain
it links fine.
The CMake documentation says:
link_directories: Specify directories in which the linker will look for libraries.
link_directories(directory1 directory2 ...)
Specify the paths in which the linker should search for libraries. The command will apply only to targets created after it is called. For historical reasons, relative paths given to this command are passed to the linker unchanged (unlike many CMake commands which interpret them relative to the current source directory).
(emphasis mine) So you have to set the directories up before you call the add_executable.
Related
I am integrating the software update mechanism RAUC in my yocto project for my device. I followed these instructions in README file and I read the rauc documentation. Unfortunately I couldn't make it work and I got this error: u-boot-fw-utils_2019.07.bb:do_compile) failed with exit code '1'
The log.do_compile file content is :
DEBUG: Executing shell function do_compile
NOTE: make -j 16 CROSS_COMPILE=arm-poky-linux-gnueabi- CC=arm-poky-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0=/usr/src/debug/u-boot-fw-utils/1_2019.07-r0 -fdebug-prefix-map=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0=/usr/src/debug/u-boot-fw-utils/1_2019.07-r0 -fdebug-prefix-map=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot= -fdebug-prefix-map=/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native= -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now HOSTCC=gcc -isystem/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/usr/lib -L/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/lib -Wl,--enable-new-dtags -Wl,-rpath-link,/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/lib -Wl,-rpath,/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/bsp/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 V=1 tx6q-1036_mfg_config tx6q-1036_config
set -e; \
for i in tx6q-1036_mfg_config tx6q-1036_config; do \
make -f ./Makefile $i; \
done
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig tx6q-1036_mfg_config
scripts/kconfig/conf --defconfig=arch/../configs/tx6q-1036_mfg_defconfig Kconfig
***
*** Can't find default configuration "arch/../configs/tx6q-1036_mfg_defconfig"!
***
scripts/kconfig/Makefile:128: recipe for target 'tx6q-1036_mfg_defconfig' failed
make[2]: *** [tx6q-1036_mfg_defconfig] Error 1
Makefile:516: recipe for target 'tx6q-1036_mfg_config' failed
make[1]: *** [tx6q-1036_mfg_config] Error 2
Makefile:498: recipe for target '__build_one_by_one' failed
make: *** [__build_one_by_one] Error 2
ERROR: oe_runmake failed
WARNING: exit code 1 from a shell command.
ERROR: Execution of '/bsp/build/tmp/work/amr1-poky-linux-gnueabi/u-boot-fw-utils/1_2019.07-r0/temp/run.do_compile.25964' failed with exit code 1:
set -e; \
for i in tx6q-1036_mfg_config tx6q-1036_config; do \
make -f ./Makefile $i; \
done
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig tx6q-1036_mfg_config
scripts/kconfig/conf --defconfig=arch/../configs/tx6q-1036_mfg_defconfig Kconfig
***
*** Can't find default configuration "arch/../configs/tx6q-1036_mfg_defconfig"!
***
scripts/kconfig/Makefile:128: recipe for target 'tx6q-1036_mfg_defconfig' failed
make[2]: *** [tx6q-1036_mfg_defconfig] Error 1
Makefile:516: recipe for target 'tx6q-1036_mfg_config' failed
make[1]: *** [tx6q-1036_mfg_config] Error 2
Makefile:498: recipe for target '__build_one_by_one' failed
make: *** [__build_one_by_one] Error 2
WARNING: exit code 1 from a shell command.
Anybody could help in this.
Are you aware of the meta-rauc-community project? In order to make Rauc work with your board in yocto, you either need to add the necessary meta-rauc-community layer or extend support to the board. There are some bbappends that u-boot uses in order to permit the use of Rauc.
To address your specific issue though, it appears as if the defconfig u-boot requires is missing. This error doesn't seem to be related to rauc as far as I can tell. Are you sure you're setting the correct UBOOT_MACHINE in your machine config file?
I fixed that, the problem was with u-boot-fw-utils in the karo-bsp zeus release, I upgraded to the Hardknott release and u-boot-fw-utils compiles fine.
I'm getting an error while linking two archives, for which the same source file pci.h has been used during the compilation:
make[2]: Leaving directory '/home/anon/tp-link-gpl/wr841nv9_en_gpl/ap143/boot/u-boot/rtc'
UNDEF_SYM=`mips-linux-uclibc-objdump -x lib_generic/libgeneric.a common/libcommon.a board/atheros/board953x/libboard953x.a cpu/mips/libmips.a lib_mips/libmips.a drivers/libdrivers.a net/libnet.a rtc/librtc.a |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
mips-linux-uclibc-ld -Bstatic -T /home/anon/tp-link-gpl/wr841nv9_en_gpl/ap143/boot/u-boot/board/atheros/board953x/u-boot.lds -Ttext 0x80010000 $UNDEF_SYM cpu/mips/start.o /home/anon/tp-link-gpl/wr841nv9_en_gpl/ap143/boot/u-boot/board/atheros/board953x/extra.o \
--start-group lib_generic/libgeneric.a common/libcommon.a board/atheros/board953x/libboard953x.a cpu/mips/libmips.a lib_mips/libmips.a drivers/libdrivers.a net/libnet.a rtc/librtc.a --end-group -L /home/anon/tp-link-gpl/wr841nv9_en_gpl/build/gcc-4.3.3/build_mips/staging_dir/usr/bin/../lib/gcc/mips-openwrt-linux-musl/5.5.0 -lgcc \
-Map u-boot.map -o u-boot
board/atheros/board953x/libboard953x.a(ath_pci.o): In function `pci_set_region':
/home/anon/tp-link-gpl/wr841nv9_en_gpl/ap143/boot/u-boot/include/pci.h:328: multiple definition of `pci_set_region'
drivers/libdrivers.a(pci.o):/home/anon/tp-link-gpl/wr841nv9_en_gpl/ap143/boot/u-boot/include/pci.h:328: first defined here
board/atheros/board953x/libboard953x.a(ath_pci.o): In function `pci_set_ops':
/home/anon/tp-link-gpl/wr841nv9_en_gpl/ap143/boot/u-boot/include/pci.h:421: multiple definition of `pci_set_ops'
drivers/libdrivers.a(pci.o):/home/anon/tp-link-gpl/wr841nv9_en_gpl/ap143/boot/u-boot/include/pci.h:421: first defined here
make[1]: *** [Makefile:217: u-boot] Error 1
make[1]: Leaving directory '/home/anon/tp-link-gpl/wr841nv9_en_gpl/ap143/boot/u-boot'
make: *** [Makefile:200: uboot] Error 2
Using #ifndef guard for these functions did not help. Please tell, how to resolve this problem?
I install Lapack-3.6.1 on Ubutun.There is a problem during make, lack of the file (cholrl.a). The error message is this.
make[1]: Leaving directory '/usr/local/src/lapack-3.6.1/BLAS/SRC' ( cd
SRC/VARIANTS ; make) make[1]: Entering directory
'/usr/local/src/lapack-3.6.1/SRC/VARIANTS' gfortran -O2 -frecursive
-c cholesky/RL/cpotrf.f -o cholesky/RL/cpotrf.o gfortran -O2 -frecursive -c cholesky/RL/dpotrf.f -o cholesky/RL/dpotrf.o gfortran -O2 -frecursive -c cholesky/RL/spotrf.f -o cholesky/RL/spotrf.o gfortran -O2 -frecursive -c cholesky/RL/zpotrf.f -o
cholesky/RL/zpotrf.o ar cr LIB/cholrl.a cholesky/RL/cpotrf.o
cholesky/RL/dpotrf.o cholesky/RL/spotrf.o cholesky/RL/zpotrf.o ar:
LIB/cholrl.a: No such file or directory Makefile:38: recipe for target
'cholrl' failed make[1]: * [cholrl] Error 1 make[1]: Leaving
directory '/usr/local/src/lapack-3.6.1/SRC/VARIANTS' Makefile:39:
recipe for target 'variants' failed make: * [variants] Error 2
Do you have a solution?
Creating LIB directory myself worked for me. So, type mkdir LIB in SRC/VARIANTS.
I'm using Cygwin (in windows 7) to emulate Linux terminal, however, when I execute "make" to one of the files, I get the following error, (please note that this worked in Linux terminal)
cd ./agents/randomAgentJava/ && make
make[1]: Entering directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/randomAgentJava'
javac -source 5 -d bin -cp ../../system/libraries/RLVizLib.jar src/RandomAgent/RandomAgent.java
warning: [options] bootstrap class path not set in conjunction with -source 1.5
1 warning
make[1]: Leaving directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/randomAgentJava'
cd ./agents/randomAgentCPP/ && make
make[1]: Entering directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/randomAgentCPP'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/randomAgentCPP'
cd ./agents/mountainCarAgentCPP/ && make
make[1]: Entering directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/mountainCarAgentCPP'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/mountainCarAgentCPP'
cd ./agents/realTimeStrategyAgentJava/ && make
make[1]: Entering directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/realTimeStrategyAgentJava'
javac src/**/*.java -d bin -cp ../../system/libraries/RLVizLib.jar
make[1]: Leaving directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/realTimeStrategyAgentJava'
cd ./agents/helicopterAgentCPP/ && make
make[1]: Entering directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/helicopterAgentCPP'
g++ -c -I../../system/RL-Glue/RL-Glue -I../../system/RL-Glue/Utils -I./src src/weak_baseline_controller.cpp -o bin/weak_baseline_controller.o
g++ -o ./bin/RL_agent bin/weak_baseline_controller.o bin/Glue_utilities.o bin/RL_client_agent.o bin/RL_network.o -lm
bin/Glue_utilities.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Makefile:25: recipe for target `bin/RL_agent' failed
make[1]: *** [bin/RL_agent] Error 1
make[1]: Leaving directory `/cygdrive/f/Linux Files/Helicopter_Control/rl-competition/agents/helicopterAgentCPP'
Makefile:13: recipe for target `all' failed
make: *** [all] Error 2
Thanks in advance!
Trying to compile libptrace (http://sourceforge.net/projects/libptrace/). The project has not advertised any preferred means of requesting support (Unfortunately, this project hasn't indicated the best way to get help). Anywho, the problem I'm running into is as follows:
% ./build.sh
% ...[SUCCESS]
% ./configure
% ...[SUCCESS]
% make
Making all in src
make[2]: Entering directory `/home/xxx/build/libptrace-git.git/src'
make[2]: *** No rule to make target `../lib/libgnu.la', needed by `libptrace.la'. Stop.
make[2]: Leaving directory `/home/xxx/build/libptrace-git.git/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/xxx/build/libptrace-git.git'
make: *** [all] Error 2
%
If you google libptrace and libgnu.la, you get zero hits. Grepping for it in the source take fresh out of git, you get:
% grep -sre libgnu.la *
src/Makefile.in:libptrace_la_DEPENDENCIES = ../lib/libgnu.la
src/Makefile.in:libptrace_la_LIBADD = ../lib/libgnu.la
src/Makefile.am:libptrace_la_LIBADD = ../lib/libgnu.la
src/Makefile:libptrace_la_DEPENDENCIES = ../lib/libgnu.la
src/Makefile:libptrace_la_LIBADD = ../lib/libgnu.la
I have no idea how to generate a libtool archive file, and source doesn't seem to have any make targets or scripts otherwise to do so.
An note on admin: please add the tag `libptrace' to this question - obviously a very popular topic - I can't do so as I don't meet the 1.5K point count :(
In response to Mel's amendment to build.sh, Here are the new errors generated on `make':
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src -g -O2 -Wall -MT test-linux-dlsym.o -MD -MP -MF .deps/test-linux-dlsym.Tpo -c -o test-linux-dlsym.o test-linux-dlsym.c
mv -f .deps/test-linux-dlsym.Tpo .deps/test-linux-dlsym.Po
/bin/sh ../../libtool --tag=CC --mode=link gcc -g -O2 -Wall -o test-linux-dlsym test-linux-dlsym.o ../../src/libptrace.la
libtool: link: gcc -g -O2 -Wall -o .libs/test-linux-dlsym test-linux-dlsym.o ../../src/.libs/libptrace.so -Wl,-rpath -Wl,/usr/local/lib
test-linux-dlsym.o: In function `main':
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:24: undefined reference to `ptrace_elf_get_link_map_head'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:40: undefined reference to `ptrace_elf_get_link_map_next'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:31: undefined reference to `ptrace_elf_get_symtab'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:32: undefined reference to `ptrace_elf_get_strtab'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:33: undefined reference to `ptrace_elf_get_hash'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:34: undefined reference to `ptrace_elf_get_hash_chains'
collect2: ld returned 1 exit status
make[2]: *** [test-linux-dlsym] Error 1
make[2]: Leaving directory `/home/XXX/dev/insecurity/build/libptrace-git.git/tests/linux'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/XXX/dev/insecurity/build/libptrace-git.git'
make: *** [all] Error 2
This is gnulib: http://www.gnu.org/software/gnulib/
It can be install in Debian with apt-get install gnulib
builds on Ubuntu 10.10, gnulib is required as noted above and probably a whole bunch of build tools (autoconf, automake)
below patch fixes a link error which occurs when building git cc97c9e3d830bd1d567011ec099846343cef547a
diff --git a/src/Makefile.am b/src/Makefile.am
index 6de8cf2..5f8d9bc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
## -23,8 +23,8 ## endif
if TARGET_LINUX
libptrace_la_SOURCES += libptrace_linux.c libptrace_linux.h \
libptrace_wrapper.c libptrace_wrapper.h \
- libptrace_linux_procfs.c libptrace_linux_procfs.h
-# libptrace_elf.c libptrace_elf.h
+ libptrace_linux_procfs.c libptrace_linux_procfs.h \
+ libptrace_elf.c libptrace_elf.h
libptrace_la_HEADERS += libptrace_linux.h libptrace_wrapper.h
if TARGET_I386
libptrace_la_SOURCES += libptrace_linux_x86.c libptrace_linux_x86.h
## -38,8 +38,8 ## endif
if TARGET_FREEBSD
libptrace_la_SOURCES += libptrace_freebsd.c libptrace_freebsd.h \
- libptrace_wrapper.c libptrace_wrapper.h
-# libptrace_elf.c libptrace_elf.h
+ libptrace_wrapper.c libptrace_wrapper.h \
+ libptrace_elf.c libptrace_elf.h
libptrace_la_HEADERS += libptrace_freebsd.h libptrace_wrapper.h
if TARGET_I386
libptrace_la_SOURCES += libptrace_freebsd_x86.c libptrace_freebsd_x86.h
First of all, this only works on linux. If you want this to work on other systems, you will need to write a src/libptrace_config.h header in configure.ac as can be seen by grep COMPILE_HDR configure.ac.
Secondly, the following patch is all I need to get the point where the generated header is missing on my system. Of course gnulib needs to be installed and gnulib-tool must be in $PATH.
diff --git a/build.sh b/build.sh
index 81caf8a..cc195c4 100755
--- a/build.sh
+++ b/build.sh
## -1,7 +1,7 ##
#!/bin/sh
# Import gnulib modules which we use
-gnulib-tool --import stdint
+gnulib-tool --libtool --import stdint
# Update timestamp to make sure autoconf rebuilds everything.
touch configure.ac