With CMake i can build libwxPDFView.a library with CodeBlocks(20) and MinW64 compiler
But building C:/wxPDFView-1.0/samples/simple i have problem.
Pdfium libs are at c:\repo\Libraries\pdfium\lib\lib and bin
Thank you.
Jim
[ 87%] Built target wxPDFView
C:/PROGRA~1/CODEBL~1/MinGW/bin/mingw32-make.exe -f
CMakeFiles\wxPDFViewSimpleSample.dir\build.make
CMakeFiles/wxPDFViewSimpleSample.dir/depend mingw32-make.exe[3]:
Entering directory 'C:/wxPDFView-1.0/samples/simple/out' "C:\Program
Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles"
C:\wxPDFView-1.0\samples\simple C:\wxPDFView-1.0\samples\simple
C:\wxPDFView-1.0\samples\simple\out
C:\wxPDFView-1.0\samples\simple\out
C:\wxPDFView-1.0\samples\simple\out\CMakeFiles\wxPDFViewSimpleSample.dir\DependInfo.cmake
--color= Dependee "C:\wxPDFView-1.0\samples\simple\out\CMakeFiles\wxPDFViewSimpleSample.dir\DependInfo.cmake"
is newer than depender
"C:/wxPDFView-1.0/samples/simple/out/CMakeFiles/wxPDFViewSimpleSample.dir/depend.internal".
Dependee
"C:/wxPDFView-1.0/samples/simple/out/CMakeFiles/CMakeDirectoryInformation.cmake"
is newer than depender
"C:/wxPDFView-1.0/samples/simple/out/CMakeFiles/wxPDFViewSimpleSample.dir/depend.internal".
Scanning dependencies of target wxPDFViewSimpleSample
mingw32-make.exe[3]: Leaving directory
'C:/wxPDFView-1.0/samples/simple/out'
C:/PROGRA~1/CODEBL~1/MinGW/bin/mingw32-make.exe -f
CMakeFiles\wxPDFViewSimpleSample.dir\build.make
CMakeFiles/wxPDFViewSimpleSample.dir/build mingw32-make.exe[3]:
Entering directory 'C:/wxPDFView-1.0/samples/simple/out' [ 93%]
Building CXX object
CMakeFiles/wxPDFViewSimpleSample.dir/Simple.cpp.obj
C:\PROGRA~1\CODEBL~1\MinGW\bin\G__~1.EXE -DUNICODE -D_DEBUG -D_UNICODE
-D__WXDEBUG__ #CMakeFiles/wxPDFViewSimpleSample.dir/includes_CXX.rsp -g -o CMakeFiles\wxPDFViewSimpleSample.dir\Simple.cpp.obj -c C:\wxPDFView-1.0\samples\simple\Simple.cpp mingw32-make.exe[3]: *** No
rule to make target 'pdfium-NOTFOUND', needed by
'wxPDFViewSimpleSample.exe'. Stop. mingw32-make.exe[2]: ***
[CMakeFiles\Makefile2:114: CMakeFiles/wxPDFViewSimpleSample.dir/all]
Error 2 mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:121:
CMakeFiles/wxPDFViewSimpleSample.dir/rule] Error 2 mingw32-make.exe:
*** [C:/wxPDFView-1.0/samples/simple/out/Makefile:136: wxPDFViewSimpleSample] Error 2 mingw32-make.exe[3]: Leaving directory
'C:/wxPDFView-1.0/samples/simple/out' mingw32-make.exe[2]: Leaving
directory 'C:/wxPDFView-1.0/samples/simple/out' mingw32-make.exe[1]:
Leaving directory 'C:/wxPDFView-1.0/samples/simple/out' Process
terminated with status 2 (1 minute(s), 43 second(s)) 3 error(s), 0
warning(s) (1 minute(s), 43 second(s))
Related
I am facing an issue while cross-compiling an awsclient application. My build environment is Ubuntu 20.04 and Buildroot running from Docker Desktop for Windows. I am using cmake tool. But when I do make I am getting below erros:
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glib-2.0/gobject/gbinding.h:28,
from /usr/include/glib-2.0/glib-object.h:22,
from /usr/include/glib-2.0/gio/gioenums.h:28,
from /usr/include/glib-2.0/gio/giotypes.h:28,
from /usr/include/glib-2.0/gio/gio.h:26,
from /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.h:12,
from /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.c:13:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:738:31: error: static assertion failed: "Expression evaluates to false"
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
^
/usr/include/glib-2.0/glib/gtypes.h:463:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/awsclient.dir/build.make:150: src/CMakeFiles/awsclient.dir /rauc-installer-gen.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:554: src/CMakeFiles/awsclient.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
One thing I noticed while doing cmake before make is cmake generated some warnings about linker.
CMake Warning at src/CMakeLists.txt:17 (add_executable):
Cannot generate a safe linker search path for target awsclient because
files in some directories may conflict with libraries in implicit
directories:
link library [libcurl.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/arm-linux- gnueabihf/libc/usr/lib
link library [libssl.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/arm-linux- gnueabihf/libc/usr/lib
link library [libcrypto.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/arm-linux- gnueabihf/libc/usr/lib
Some of these libraries may not be found correctly.
The dir /root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf is the location of the toolchain I am using. I am not sure if these warnings are reason for above issue.
Update I
The output of make VERBOSE=1 is:
/usr/bin/cmake -S/root/br-tcg4/libs/br_pjt/aws-iot-client -B/root/br-tcg4/libs/br_pjt/aws-iot-client/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /root/br-tcg4/libs/br_pjt/aws-iot-client/build/CMakeFiles /root/br-tcg4/libs/br_pjt/aws-iot-client/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 36%] Built target aws-iot-sdk-cpp
make -f lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/samples/PubSub /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/PubSub /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/samples/PubSub/CMakeFiles/pub-sub-sample.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 42%] Built target pub-sub-sample
make -f lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/samples/ShadowDelta /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/ShadowDelta /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/samples/ShadowDelta/CMakeFiles/shadow-delta-sample.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 47%] Built target shadow-delta-sample
make -f lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/samples/Jobs /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/Jobs /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/build.make lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/samples/Jobs/CMakeFiles/jobs-sample.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 53%] Built target jobs-sample
make -f lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/build.make lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/samples/JobsAgent /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/JobsAgent /root/br-tcg4/libs/br_pjt/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/build.make lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[2]: Nothing to be done for 'lib/aws-iot-device-sdk-cpp/samples/JobsAgent/CMakeFiles/jobs-agent.dir/build'.
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 60%] Built target jobs-agent
make -f src/CMakeFiles/awsclient.dir/build.make src/CMakeFiles/awsclient.dir/depend
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/br-tcg4/libs/br_pjt/aws-iot-client /root/br-tcg4/libs/br_pjt/aws-iot-client/src /root/br-tcg4/libs/br_pjt/aws-iot-client/build /root/br-tcg4/libs/br_pjt/aws-iot-client/build/src /root/br-tcg4/libs/br_pjt/aws-iot-client/build/src/CMakeFiles/awsclient.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make -f src/CMakeFiles/awsclient.dir/build.make src/CMakeFiles/awsclient.dir/build
make[2]: Entering directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
[ 61%] Building C object src/CMakeFiles/awsclient.dir/rauc-installer-gen.c.o
cd /root/br-tcg4/libs/br_pjt/aws-iot-client/build/src && /root/br-tcg4/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -DOPENSSL_LOAD_CONF -I/root/br-tcg4/libs/br_pjt/aws-iot-client/build/third_party/rapidjson/src/include -I/root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/json-glib-1.0 -I/root/br-tcg4/libs/br_pjt/aws-iot-client/lib/aws-iot-device-sdk-cpp/network/OpenSSL -pthread -o CMakeFiles/awsclient.dir/rauc-installer-gen.c.o -c /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.c
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/glib-2.0/gobject/gbinding.h:28,
from /usr/include/glib-2.0/glib-object.h:22,
from /usr/include/glib-2.0/gio/gioenums.h:28,
from /usr/include/glib-2.0/gio/giotypes.h:28,
from /usr/include/glib-2.0/gio/gio.h:26,
from /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.h:12,
from /root/br-tcg4/libs/br_pjt/aws-iot-client/src/rauc-installer-gen.c:13:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:738:31: error: static assertion failed: "Expression evaluates to false"
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
^
/usr/include/glib-2.0/glib/gtypes.h:463:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/awsclient.dir/build.make:150: src/CMakeFiles/awsclient.dir/rauc-installer-gen.c.o] Error 1
make[2]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make[1]: *** [CMakeFiles/Makefile2:554: src/CMakeFiles/awsclient.dir/all] Error 2
make[1]: Leaving directory '/root/br-tcg4/libs/br_pjt/aws-iot-client/build'
make: *** [Makefile:130: all] Error 2
Here is the Toolchain File:
# The OpenSSL paths in the network/CMakeLists.txt needs to be replaced with the path to the cross-compiled OpenSSL library for
# the required paltform
# General CMAKE cross compile settings
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)
# Specify toolchain directory
SET(TOOLCHAIN_DIR /home/toolchain/dir/here/bin)
# Specify cross compilation target
SET(TARGET_CROSS target-here)
# Set compilers
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/${TARGET_CROSS}g++)
# Set linker
SET(CMAKE_LINKER ${TOOLCHAIN_DIR}/${TARGET_CROSS}ld)
# Set compiler flags
SET(CMAKE_CXX_FLAGS ${COMMON_FLAGS} -std=c++11)
# Set archiving tool
SET(CMAKE_AR ${TOOLCHAIN_DIR}/${TARGET_CROSS}ar CACHE FILEPATH "Archiver")
# Set randomizing tool for static libraries
SET(CMAKE_RANLIB ${TOOLCHAIN_DIR}/${TARGET_CROSS}ranlib)
# Set strip tool
SET(CMAKE_STRIP ${TOOLCHAIN_DIR}/${TARGET_CROSS}strip)
# Set objdump tool
SET(CMAKE_OBJDUMP ${TOOLCHAIN_DIR}/${TARGET_CROSS}objdump)
# Set objcopy tool
SET(CMAKE_OBJCOPY ${TOOLCHAIN_DIR}/${TARGET_CROSS}objcopy)
# Set nm tool
SET(CMAKE_NM ${TOOLCHAIN_DIR}/${TARGET_CROSS}nm)
# Set THREADS_PTHREAD_ARG for testing threading
SET(THREADS_PTHREAD_ARG "2" CACHE STRING "Forcibly set by ToolchainFile.cmake." FORCE)
Update II
After following input from #Tsyvarev and #KamilCuk comment, I updated the Toolchain file to fetch binaries and headers from target system(arm) instead of host machine(x86_64). Now cmakeis building files successfully and no warnings are shown. But when I do make I get below errors:
/opt/poky/3.1.12/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -S/root/sources/aws-iot-client -B/root/sources/aws-iot-client/build --check-build-system CMakeFiles/Makefile.cmake 0
/opt/poky/3.1.12/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_progress_start /root/sources/aws-iot-client/build/CMakeFiles /root/sources/aws-iot-client/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/root/sources/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/depend
make[2]: Entering directory '/root/sources/aws-iot-client/build'
cd /root/sources/aws-iot-client/build && /opt/poky/3.1.12/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/sources/aws-iot-client /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp /root/sources/aws-iot-client/build /root/sources/aws-iot-client/build/lib/aws-iot-device-sdk-cpp /root/sources/aws-iot-client/build/lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/root/sources/aws-iot-client/build'
make -f lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build
make[2]: Entering directory '/root/sources/aws-iot-client/build'
[ 1%] Building CXX object lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/src/Action.cpp.o
cd /root/sources/aws-iot-client/build/lib/aws-iot-device-sdk-cpp && /opt/poky/3.1.12/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi --sysroot=/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi -DOPENSSL_LOAD_CONF -DSDK_VERSION_STRING=\"1.4.0\" -I/root/sources/aws-iot-client/build/third_party/rapidjson/src/include -I/root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/include -O2 -pipe -g -feliminate-unused-debug-types -fPIC -pthread -std=c++11 -o CMakeFiles/aws-iot-sdk-cpp.dir/src/Action.cpp.o -c /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/src/Action.cpp
cc1plus: warning: include location "/usr/include/x86_64-linux-gnu" is unsafe for cross-compilation [-Wpoison-system-directories]
In file included from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/wchar.h:30,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/cwchar:44,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/postypes.h:40,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/char_traits.h:40,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/string:40,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/include/Action.hpp:27,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/src/Action.cpp:26:
/usr/include/x86_64-linux-gnu/bits/floatn.h:75:70: error: unknown machine mode '__TC__'
75 | typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
| ^
/usr/include/x86_64-linux-gnu/bits/floatn.h:87:9: error: '__float128' does not name a type; did you mean '__cfloat128'?
87 | typedef __float128 _Float128;
| ^~~~~~~~~~
| __cfloat128
In file included from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/cwchar:44,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/postypes.h:40,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/char_traits.h:40,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/string:40,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/include/Action.hpp:27,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/src/Action.cpp:26:
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/wchar.h:406:8: error: '_Float128' does not name a type; did you mean '_Float32x'?
406 | extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
| ^~~~~~~~~
| _Float32x
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/wchar.h:523:8: error: '_Float128' does not name a type; did you mean '_Float32x'?
523 | extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
| ^~~~~~~~~
| _Float32x
In file included from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/cstdlib:75,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/ext/string_conversions.h:41,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/bits/basic_string.h:6493,
from /opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/c++/9.3.0/string:55,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/include/Action.hpp:27,
from /root/sources/aws-iot-client/lib/aws-iot-device-sdk-cpp/src/Action.cpp:26:
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/stdlib.h:152:8: error: '_Float128' does not name a type; did you mean '_Float32x'?
152 | extern _Float128 strtof128 (const char *__restrict __nptr,
| ^~~~~~~~~
| _Float32x
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/stdlib.h:245:4: error: '_Float128' has not been declared
245 | _Float128 __f)
| ^~~~~~~~~
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/usr/include/stdlib.h:330:8: error: '_Float128' does not name a type; did you mean '_Float32x'?
330 | extern _Float128 strtof128_l (const char *__restrict __nptr,
| ^~~~~~~~~
| _Float32x
make[2]: *** [lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/build.make:63: lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/src/Action.cpp.o] Error 1
make[2]: Leaving directory '/root/sources/aws-iot-client/build'
make[1]: *** [CMakeFiles/Makefile2:338: lib/aws-iot-device-sdk-cpp/CMakeFiles/aws-iot-sdk-cpp.dir/all] Error 2
make[1]: Leaving directory '/root/sources/aws-iot-client/build'
make: *** [Makefile:130: all] Error 2
I am not sure why I still get this warning
cc1plus: warning: include location "/usr/include/x86_64-linux-gnu" is unsafe for cross-compilation [-Wpoison-system-directories]
Update III
After spending some time exploring the project, I understood that Toolchain file used here is OEToolchainConfig.cmake.
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE )
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE )
set( CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE )
set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE )
set( CMAKE_SYSROOT $ENV{OECORE_TARGET_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "$ENV{OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}")
# Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os).
if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+")
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1})
endif()
# Include the toolchain configuration subscripts
file( GLOB toolchain_config_files "${CMAKE_TOOLCHAIN_FILE}.d/*.cmake" )
foreach(config ${toolchain_config_files})
include(${config})
endforeach()
OECORE_TARGET_SYSROOT is set to echo $OECORE_TARGET_SYSROOT:
/opt/poky/3.1.12/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi
I am not sure why we need to use this file which is genearted from populate_sdk by yocto.
Can someone please let me know how to resolve this?
Thanks in advance.
P.S: I am new to Cmake and please let me know if there are any missing info.
I am using vcpkg for the first time with amqpcpp. I am testing it out with cmake to get a project setup using a library. vcpkg installs the package correctly and cmake has no trouble finding the target amqpcpp. There is some issue with the linker that I cannot solve. Below is my CMakeLists.txt.
cmake_minimum_required(VERSION 3.15)
set(VCPKG_TARGET_TRIPLET x86-windows )
set(CMAKE_TOOLCHAIN_FILE "C:/Users/reine/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
project(amqp_test)
set(CMAKE_CXX_STANDARD 11)
find_package(amqpcpp CONFIG REQUIRED)
include_directories(${amqpcpp_INCLUDE_DIR})
add_executable(amqp_test main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE amqpcpp)
And below is the linker error that I am experiencing. The ConnectionImpl does indeed exist. Why are the file names so crazy? I imagine this is something that is done to prevent double referencing of an object. I am thinking this is where my problem is.
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\amqp_test.dir/objects.a(main.cpp.obj): in function `ZN4AMQP10ConnectionD1Ev':
C:/Users/reine/vcpkg/installed/x86-windows/include/amqpcpp/connection.h:70: undefined reference to `AMQP::ConnectionImpl::~ConnectionImpl()'
I have done my due diligence searching this type of linker error and am completely stuck.
Verbose Make Output
Clean finished
====================[ Build | all | Debug ]=====================================
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" --build C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug --target all -- -j 4
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -SC:\Users\reine\CLionProjects\amqp-test -BC:\Users\reine\CLionProjects\amqp-test\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E cmake_progress_start C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug\CMakeFiles C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug\CMakeFiles\progress.marks
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 all
mingw32-make.exe[1]: Entering directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\amqp_test.dir\build.make CMakeFiles/amqp_test.dir/depend
mingw32-make.exe[2]: Entering directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Users\reine\CLionProjects\amqp-test C:\Users\reine\CLionProjects\amqp-test C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug C:\Users\reine\CLionProjects\amqp-test\cmake-build-debug\CMakeFiles\amqp_test.dir\DependInfo.cmake --color=
mingw32-make.exe[2]: Leaving directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\amqp_test.dir\build.make CMakeFiles/amqp_test.dir/build
mingw32-make.exe[2]: Entering directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
[ 50%] Building CXX object CMakeFiles/amqp_test.dir/main.cpp.obj
C:\MinGW\bin\g++.exe #CMakeFiles/amqp_test.dir/includes_CXX.rsp -g -std=gnu++11 -o CMakeFiles\amqp_test.dir\main.cpp.obj -c C:\Users\reine\CLionProjects\amqp-test\main.cpp
[100%] Linking CXX executable amqp_test.exe
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E cmake_link_script CMakeFiles\amqp_test.dir\link.txt --verbose=1
"C:\Program Files\JetBrains\CLion 2019.2.5\bin\cmake\win\bin\cmake.exe" -E remove -f CMakeFiles\amqp_test.dir/objects.a
C:\MinGW\bin\ar.exe cr CMakeFiles\amqp_test.dir/objects.a #CMakeFiles\amqp_test.dir\objects1.rsp
C:\MinGW\bin\g++.exe -g -Wl,--whole-archive CMakeFiles\amqp_test.dir/objects.a -Wl,--no-whole-archive -o amqp_test.exe -Wl,--out-implib,libamqp_test.dll.a -Wl,--major-image-version,0,--minor-image-version,0 #CMakeFiles\amqp_test.dir\linklibs.rsp
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\amqp_test.dir/objects.a(main.cpp.obj): in function `ZN4AMQP10ConnectionC1EPNS_17ConnectionHandlerERKNS_5LoginERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE':
C:/Users/reine/vcpkg/installed/x86-windows/include/amqpcpp/connection.h:40: undefined reference to `AMQP::ConnectionImpl::ConnectionImpl(AMQP::Connection*, AMQP::ConnectionHandler*, AMQP::Login const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: CMakeFiles\amqp_test.dir/objects.a(main.cpp.obj): in function `ZN4AMQP10ConnectionD1Ev':
C:/Users/reine/vcpkg/installed/x86-windows/include/amqpcpp/connection.h:70: undefined reference to `AMQP::ConnectionImpl::~ConnectionImpl()'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\amqp_test.dir\build.make:89: recipe for target 'amqp_test.exe' failed
mingw32-make.exe[2]: Leaving directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
mingw32-make.exe[2]: *** [amqp_test.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/amqp_test.dir/all] Error 2
CMakeFiles\Makefile2:77: recipe for target 'CMakeFiles/amqp_test.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/reine/CLionProjects/amqp-test/cmake-build-debug'
Makefile:85: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
I built mono 5.20.1.19 from tarball successfully. But the build of master from github was failed. Instead of using a existing mono installation for the build, I run make get-monolite-latest for the mcs. On RedHat 6.9 (gcc6.3, cmake3.7.2) the build was crashed(segment fault). On SUSE 12.4(gcc6.3, cmake 3.5.2), the build ended with errors. I thought I might need to checkout the branch 5.20.1.19, but I couldn't find any branch newer then 4.8. Why there doesn't exist such a branch? Thanks in advance. Below are my build errors:
RedHat 6.9
make -C build-shared
make[4]: Entering directory mono-src/mono/btls/build-shared'
make[5]: Entering directorymono-src/mono/btls/build-shared'
make[6]: Entering directory mono-src/mono/btls/build-shared'
Scanning dependencies of target pqueue
make[6]: Leaving directorymono-src/mono/btls/build-shared'
make[6]: Entering directory mono-src/mono/btls/build-shared'
[ 1%] Building C object boringssl/ssl/pqueue/CMakeFiles/pqueue.dir/pqueue.c.o
^[l/bin/sh: line 1: 42877 Segmentation fault (core dumped) /opt/anss/bin/ccache /opt/anss/bin/gcc -DBORINGSSL_IMPLEMENTATION -Imono-src/external/boringssl/ssl/../include -Imono-src/external/boringssl/ssl/pqueue/../../include -Wall -Wsign-compare -Wmissing-field-initializers -fPIC -ggdb -fvisibility=hidden -Wall -Wformat=2 -Wsign-compare -Wmissing-field-initializers -ggdb -fvisibility=hidden -Wshadow -std=c11 -D_XOPEN_SOURCE=700 -o CMakeFiles/pqueue.dir/pqueue.c.o -c mono-src/external/boringssl/ssl/pqueue/pqueue.c
make[6]: *** [boringssl/ssl/pqueue/CMakeFiles/pqueue.dir/pqueue.c.o] Error 139
make[6]: Leaving directorymono-src/mono/btls/build-shared'
make[5]: * [boringssl/ssl/pqueue/CMakeFiles/pqueue.dir/all] Error 2
make[5]: Leaving directory mono-src/mono/btls/build-shared'
make[4]: *** [all] Error 2
make[4]: Leaving directorymono-src/mono/btls/build-shared'
make[3]: [build-shared/libmono-btls-shared.so] Error 2
make[3]: Leaving directory mono-src/mono/btls'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directorymono-src/mono'
make[1]: [all-recursive] Error 1
make[1]: Leaving directory `mono-src'
make: * [all] Error 2
SUSE12.4
Directory does not exist: 'mono-src/external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks'
Directory does not exist: 'mono-src/external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks'
Directory does not exist: 'mono-src/external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks'
Directory does not exist: 'mono-src/external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks'
Directory does not exist: 'mono-src/external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks'
Directory does not exist: 'mono-src/external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks'
Directory does not exist: 'mono-src/external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks'
Directory does not exist: 'mono-src/external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks'
// gensources produced 8 error(s) and a set of 155 filename(s)
// Invoked with 'mono-src/mcs/class/lib/build/gensources.exe --strict --platformsdir:./../../build ../../build/deps/_xbuild_14__Microsoft.NuGet.Build.Tasks.dll.sources Microsoft.NuGet.Build.Tasks.dll xbuild_14'
// Working directory was 'mono-src/mcs/class/Microsoft.NuGet.Build.Tasks'
make[8]: * No rule to make target '../../build/deps/_xbuild_14__Microsoft.NuGet.Build.Tasks.dll.sources', needed by '../../build/deps/_xbuild_14__Microsoft.NuGet.Build.Tasks.dll.response'. Stop.
../../build/rules.make:226: recipe for target 'do-all' failed
make[7]: * [do-all] Error 2
I'm trying to build a project that includes log4c for the Jetson Nano. log4c is dependent on expat. expat has a CMakeLists.txt file and plays nicely with CMake. I'm having trouble telling log4c where the build output of expat lives to complete the link phase.
I have my main CMakeLists.txt file performing the following:
add_subdirectory(dependencies/libexpat/expat)
add_subdirectory(dependencies/libuuid-1.0.3)
add_subdirectory(dependencies/log4c-1.2.4)
expat builds with no issues. My CMakeLists.txt file for log4c is listed below:
# ------------------------------------------------------- MINIMUM CMAKE VERSION
cmake_minimum_required(VERSION 3.10)
include(ExternalProject)
# ---------------------------------------------------------------- PROJECT NAME
set(THIS log4c)
# ------------------------------------------------------------ EXTERNAL PROJECT
if("${BUILD_PLATFORM}" STREQUAL "nano")
set(HOST "--host=aarch64-linux-gnu")
endif()
file(GLOB_RECURSE SRC_FILES
${CMAKE_CURRENT_LIST_DIR}/*
)
file(TOUCH ${SRC_FILES})
ExternalProject_Add(${THIS}_build
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}
CONFIGURE_COMMAND ${CMAKE_CURRENT_LIST_DIR}/configure --prefix=${CMAKE_INSTALL_PREFIX}/usr ${HOST}
BUILD_COMMAND make
DEPENDS expat)
#add_dependencies(${THIS}_build expat)
# --------------------------------------------------------------------- LIBRARY
add_library(${THIS} INTERFACE)
target_link_libraries(${THIS} INTERFACE ${CMAKE_INSTALL_PREFIX}/usr/lib/liblog4c.so)
target_include_directories(${THIS} INTERFACE ${CMAKE_INSTALL_PREFIX}/usr/include)
log4c configures and builds correctly, but it fails to link with the following error messages:
home/nlbutts/maza/vision2000/dependencies/log4c-1.2.4/src/log4c/rollingpolicy_type_sizewin.c: In function 'sizewin_rollover':
/home/nlbutts/maza/vision2000/dependencies/log4c-1.2.4/src/log4c/rollingpolicy_type_sizewin.c:116:14: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'void *' [-Wformat=]
sd_error("rollingpolicy '%s' not yet configured (logdir,prefix etc.)",
^
/home/nlbutts/maza/vision2000/dependencies/log4c-1.2.4/src/log4c/rollingpolicy_type_sizewin.c: In function 'sizewin_init':
/home/nlbutts/maza/vision2000/dependencies/log4c-1.2.4/src/log4c/rollingpolicy_type_sizewin.c:227:12: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
sd_debug("last index '%d'", swup->sw_last_index);
^
libtool: compile: aarch64-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/home/nlbutts/maza/vision2000/dependencies/log4c-1.2.4/src/log4c -I../../src -I/home/nlbutts/maza/vision2000/dependencies/log4c-1.2.4/src -DLOG4C_RCPATH=\"/home/nlbutts/maza/vision2000/build/nano/staging/usr/etc\" -g -O2 -Wall -MT rollingpolicy_type_sizewin.lo -MD -MP -MF .deps/rollingpolicy_type_sizewin.Tpo -c /home/nlbutts/maza/vision2000/dependencies/log4c-1.2.4/src/log4c/rollingpolicy_type_sizewin.c -o rollingpolicy_type_sizewin.o >/dev/null 2>&1
libtool: link: aarch64-linux-gnu-gcc -shared -fPIC -DPIC .libs/rc.o .libs/init.o .libs/appender_type_stream.o .libs/appender_type_stream2.o .libs/appender_type_syslog.o .libs/layout_type_basic.o .libs/layout_type_dated.o .libs/layout_type_dated_local.o .libs/layout_type_basic_r.o .libs/layout_type_dated_r.o .libs/layout_type_dated_local_r.o .libs/version.o .libs/logging_event.o .libs/priority.o .libs/appender.o .libs/layout.o .libs/category.o .libs/appender_type_rollingfile.o .libs/rollingpolicy.o .libs/rollingpolicy_type_sizewin.o -Wl,--whole-archive ../sd/.libs/liblog4c_sd.a -Wl,--no-whole-archive -lexpat -lpthread -O2 -Wl,-soname -Wl,liblog4c.so.3 -o .libs/liblog4c.so.3.3.1
/usr/lib/gcc-cross/aarch64-linux-gnu/5/../../../../aarch64-linux-gnu/bin/ld: cannot find -lexpat
collect2: error: ld returned 1 exit status
Makefile:480: recipe for target 'liblog4c.la' failed
make[7]: *** [liblog4c.la] Error 1
Makefile:436: recipe for target 'all-recursive' failed
make[6]: *** [all-recursive] Error 1
Makefile:353: recipe for target 'all' failed
make[5]: *** [all] Error 2
Makefile:602: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
Makefile:399: recipe for target 'all' failed
make[3]: *** [all] Error 2
dependencies/log4c-1.2.4/CMakeFiles/log4c_build.dir/build.make:111: recipe for target 'dependencies/log4c-1.2.4/log4c_build-prefix/src/log4c_build-stamp/log4c_build-build' failed
make[2]: *** [dependencies/log4c-1.2.4/log4c_build-prefix/src/log4c_build-stamp/log4c_build-build] Error 2
CMakeFiles/Makefile2:395: recipe for target 'dependencies/log4c-1.2.4/CMakeFiles/log4c_build.dir/all' failed
make[1]: *** [dependencies/log4c-1.2.4/CMakeFiles/log4c_build.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
How do I tell log4c where expat was built at.
I have these files in the directory:
CMakeLists.txt datalink.c datalink.h protocol.a protocol.h
All these files were got from my teacher except CMakeLists.txt.
#CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(DataLinkSimulator)
INCLUDE_DIRECTORIES(.)
set(SOURCE_FILES datalink.c protocol.a datalink.h protocol.h)
add_executable(DataLinkSimulator ${SOURCE_FILES})
target_link_libraries(DataLinkSimulator protocol.a)
I run 'cmake .' in this directory, and it works.
However, when I run 'make' , it gives me these errors.
Scanning dependencies of target DataLinkSimulator
[ 50%] Building C object CMakeFiles/DataLinkSimulator.dir/datalink.c.o
[100%] Linking C executable DataLinkSimulator
/usr/bin/ld: cannot find -lprotocol
collect2: 错误:ld 返回 1 #(means "error: ld return 1")
CMakeFiles/DataLinkSimulator.dir/build.make:94: recipe for target 'DataLinkSimulator' failed
make[2]: *** [DataLinkSimulator] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DataLinkSimulator.dir/all' failed
make[1]: *** [CMakeFiles/DataLinkSimulator.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
The error "cannot find -lprotocol" must caused by ld's mistaking protocol as a shared lib. But my protocol is a static lib. So I am confused.
If I edit makefile by myself instead of using cmake, it works correctly.
datalink: datalink.c datalink.h
gcc datalink.c protocol.a -o datalink -lm -lstdc++ -m32
clean:
${RM} datalink
${RM} *.o
I used a "make VERBOSE=1":
/usr/local/bin/cmake -H/home/shantom/Desktop/FileRecv/Lab1-linux -B/home/shantom/Desktop/FileRecv/Lab1-linux --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /home/shantom/Desktop/FileRecv/Lab1-linux/CMakeFiles /home/shantom/Desktop/FileRecv/Lab1-linux/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
make -f CMakeFiles/DataLinkSimulator.dir/build.make CMakeFiles/DataLinkSimulator.dir/depend
make[2]: Entering directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
cd /home/shantom/Desktop/FileRecv/Lab1-linux && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/shantom/Desktop/FileRecv/Lab1-linux /home/shantom/Desktop/FileRecv/Lab1-linux /home/shantom/Desktop/FileRecv/Lab1-linux /home/shantom/Desktop/FileRecv/Lab1-linux /home/shantom/Desktop/FileRecv/Lab1-linux/CMakeFiles/DataLinkSimulator.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
make -f CMakeFiles/DataLinkSimulator.dir/build.make CMakeFiles/DataLinkSimulator.dir/build
make[2]: Entering directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
[ 50%] Linking C executable DataLinkSimulator
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/DataLinkSimulator.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/DataLinkSimulator.dir/datalink.c.o -o DataLinkSimulator -Wl,-Bstatic -lprotocol -Wl,-Bdynamic
/usr/bin/ld: cannot find -lprotocol
collect2: 错误:ld 返回 1
CMakeFiles/DataLinkSimulator.dir/build.make:94: recipe for target 'DataLinkSimulator' failed
make[2]: *** [DataLinkSimulator] Error 1
make[2]: Leaving directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DataLinkSimulator.dir/all' failed
make[1]: *** [CMakeFiles/DataLinkSimulator.dir/all] Error 2
make[1]: Leaving directory '/home/shantom/.wine/drive_c/Program Files/QQ/Users/1044950475/FileRecv/Lab1-linux'
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
In order to understand the error you need to launch make command from the command line using verbose mode; on Linux paltform it means launching:
make VERBOSE=1
In this manner you will have the entire command line used to compile the code.
In order to resolve your error you could:
add a link_directories(directory_where_you_have_library) CMake line adding the directory where you have protocol.a before target_link_libraries line
add protocol.a with absolute path.
Your modified Makefile works because probably you have it in the same directory of all the files while CMake creates many Makefiles in various directories starting from build root directory so it needs -L gcc flags (obtainable through link_directories) or -l with absolute path (obtainable adding protocol.a with absolute path).