CMake not compile on raspberry - c

I'm new with cmake.
With cmake I was able to compile my project on my laptop, but on the raspberry is not working.
This is the error i get on raspberry:
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28")
-- checking for one of the modules 'glib-2.0'
-- Found GLib: /usr/lib/arm-linux-gnueabihf/libglib-2.0.so (found version "2.42.1")
-- Found mhd: /usr/include
CMake Error at cmake/FindGLIB.cmake:39 (add_library): add_library cannot create imported target "glib-2.0" because another target with the same name already exists.
Call Stack (most recent call first):librerie/CMakeLists.txt:2 (find_package)
-- Found GLib: /usr/lib/arm-linux-gnueabihf/libglib-2.0.so (found version "2.42.1")
-- Configuring incomplete, errors occurred!
See also "/home/pi/pl1/CMakeFiles/CMakeOutput.log".
This is my project structure:
src->
---- CMakeLists.txt
---- main.c
---- librerie->
-------------- CMakeLists.txt
-------------- cJSON.c
-------------- cJSON.h
-------------- config.c
-------------- config.h
-------------- server_web.c
-------------- server_web.h
-------------- funzioni_thread.c
-------------- funzioni_thread.h
---- cmake->
-------------- FindGLIB.cmake
-------------- FindMHD.cmake
This is First CMakeLists :
cmake_minimum_required (VERSION 2.6)
project (TestPL)
include_directories("${PROJECT_BINARY_DIR}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(GLIB REQUIRED)
find_package(MHD REQUIRED)
add_subdirectory (librerie)
set (EXTRA_LIBS ${EXTRA_LIBS} librerie)
include_directories (${GLib_INCLUDE_DIRS} ${EXTRA_LIBS})
# add the executable
add_executable(TestPL main.c)
target_link_libraries (TestPL ${GLib_LIBRARY} ${MHD_LIBRARY} ${EXTRA_LIBS} m)
This is CMakeLists in librerie directory:
find_package(GLIB REQUIRED)
find_package(MHD REQUIRED)
include_directories (${GLib_INCLUDE_DIRS} ${EXTRA_LIBS})
add_library (librerie cJSON.c config.c generic.c server_web.c funzioni_thread.c)
target_link_libraries (librerie ${GLib_LIBRARY} ${MHD_LIBRARY})
What am I doing wrong?

You call twice
find_package(GLIB REQUIRED)
First time it is called from top-level CMakeLists.txt and defines glib-2.0 target. Second time it is called from librerie/CMakeLists.txt and attempt to create glib-2.0 again. That is why you see that error message: the target is already defined in this scope.
Possible workaround is to step into library subdirectory first, and only then call find_package() in top-level CMakeLists.txt:
add_subdirectory (librerie)
find_package(GLIB REQUIRED)
find_package(MHD REQUIRED)
Because IMPORTED targets has local visibility, glib-2.0 target defined by find_package(GLIB) call from subdirectory librerie/ will not be visible after returning from this subdirectory. So the second call from top-level directory will succeed.

Related

building Gstreamer mpegts project with Cmake

We are trying to use Gstreamer's mpegts pluging to record a video stream stream using the following Gstreamer example code https://gstreamer.freedesktop.org/documentation/mpegtsmux/mpegtsmux.html?gi-language=c. When we compile the code using gcc mpegtstest.c -o mpegtstest `pkg-config --cflags --libs gstreamer-1.0 gstreamer-mpegts-1.0` -v everything works as expected and the program records with no issues. We are now trying to compile the code using cmake and make. cmake generates correctly but make fails with error.
/usr/bin/ld: cannot find -lgstreamer-mpegts-1.0.
CMakeLists.txt
##################### STANDARD HEADER #########################
cmake_minimum_required(VERSION 2.6)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "" FORCE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeHelpers/")
##################### PROJECT DEF #############################
project(mpegsttest)
################### VARIABLES #################################
include_directories("${PROJECT_BINARY_DIR}")
include_directories("${PROJECT_SOURCE_DIR}/../")
set(MPEGTS_TEST_SOURCES
mpegtstest.c
)
####################### Targets ########################
add_executable(${CMAKE_PROJECT_NAME} ${MPEGTS_TEST_SOURCES})
################### Linked Libraries ###################
find_package(GLIB2 REQUIRED)
include_directories(${GLIB2_INCLUDE_DIRS})
include_directories("/usr/include/gio-unix-2.0")
target_link_libraries(${CMAKE_PROJECT_NAME} ${GLIB2_LIBRARIES} gobject-2.0 gio-2.0)
find_package(GStreamer REQUIRED)
include_directories(${GSTREAMER_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} ${GSTREAMER_LIBRARIES})
include_directories(${GSTREAMER-MPEGTS_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} gstreamer-mpegts-1.0)
cmake output
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for one of the modules 'glib-2.0'
-- Found GLib2: glib-2.0 /usr/include/glib-2.0;/usr/lib/glib-2.0/include
-- Looking for include file glib/gregex.h
-- Looking for include file glib/gregex.h - not found
-- Looking for include file glib/gchecksum.h
-- Looking for include file glib/gchecksum.h - not found
-- Checking for module 'gstreamer-1.0 >= '
-- Found gstreamer-1.0 , version 1.6.3
-- Checking for module 'gstreamer-base-1.0 >= '
-- Found gstreamer-base-1.0 , version 1.6.3
-- Checking for module 'gstreamer-app-1.0 >= '
-- Found gstreamer-app-1.0 , version 1.6.3
-- Checking for module 'gstreamer-audio-1.0 >= '
-- Found gstreamer-audio-1.0 , version 1.6.3
-- Checking for module 'gstreamer-fft-1.0 >= '
-- Found gstreamer-fft-1.0 , version 1.6.3
-- Checking for module 'gstreamer-mpegts-1.0>=1.4.0'
-- Found gstreamer-mpegts-1.0, version 1.6.3
-- Checking for module 'gstreamer-pbutils-1.0 >= '
-- Found gstreamer-pbutils-1.0 , version 1.6.3
-- Checking for module 'gstreamer-tag-1.0 >= '
-- Found gstreamer-tag-1.0 , version 1.6.3
-- Checking for module 'gstreamer-video-1.0 >= '
-- Found gstreamer-video-1.0 , version 1.6.3
-- Found GStreamer: GSTREAMER_INCLUDE_DIRS;GSTREAMER_LIBRARIES;GSTREAMER_VERSION;GSTREAMER_BASE_INCLUDE_DIRS;GSTREAMER_BASE_LIBRARIES
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dev3lx/build/mpegts
make --trace output
Makefile:176: target 'cmake_check_build_system' does not exist
/usr/bin/cmake -H/home/dev3lx/Development/mptestsrc -B/home/dev3lx/build/mpegts --check-build-system CMakeFiles/Makefile.cmake 0
Makefile:83: update target 'all' due to: cmake_check_build_system
/usr/bin/cmake -E cmake_progress_start /home/dev3lx/build/mpegts/CMakeFiles /home/dev3lx/build/mpegts/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
CMakeFiles/Makefile2:67: target 'CMakeFiles/mpegsttest.dir/all' does not exist
make -f CMakeFiles/mpegsttest.dir/build.make CMakeFiles/mpegsttest.dir/depend
CMakeFiles/mpegsttest.dir/build.make:112: target 'CMakeFiles/mpegsttest.dir/depend' does not exist
cd /home/dev3lx/build/mpegts && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dev3lx/Development/mptestsrc /home/dev3lx/Development/mptestsrc /home/dev3lx/build/mpegts /home/dev3lx/build/mpegts /home/dev3lx/build/mpegts/CMakeFiles/mpegsttest.dir/DependInfo.cmake --color=
Scanning dependencies of target mpegsttest
make -f CMakeFiles/mpegsttest.dir/build.make CMakeFiles/mpegsttest.dir/build
CMakeFiles/mpegsttest.dir/build.make:62: update target 'CMakeFiles/mpegsttest.dir/mpegtstest.c.o' due to: /home/dev3lx/Development/mptestsrc/mpegtstest.c /usr/include/glib-2.0/glib-object.h /usr/include/glib-2.0/glib.h /usr/include/glib-2.0/glib/deprecated/gallocator.h /usr/include/glib-2.0/glib/deprecated/gcache.h /usr/include/glib-2.0/glib/deprecated/gcompletion.h /usr/include/glib-2.0/glib/deprecated/gmain.h /usr/include/glib-2.0/glib/deprecated/grel.h /usr/include/glib-2.0/glib/deprecated/gthread.h /usr/include/glib-2.0/glib/galloca.h /usr/include/glib-2.0/glib/garray.h /usr/include/glib-2.0/glib/gasyncqueue.h /usr/include/glib-2.0/glib/gatomic.h /usr/include/glib-2.0/glib/gbacktrace.h /usr/include/glib-2.0/glib/gbase64.h /usr/include/glib-2.0/glib/gbitlock.h /usr/include/glib-2.0/glib/gbookmarkfile.h /usr/include/glib-2.0/glib/gbytes.h /usr/include/glib-2.0/glib/gcharset.h /usr/include/glib-2.0/glib/gchecksum.h /usr/include/glib-2.0/glib/gconvert.h /usr/include/glib-2.0/glib/gdataset.h /usr/include/glib-2.0/glib/gdate.h /usr/include/glib-2.0/glib/gdatetime.h /usr/include/glib-2.0/glib/gdir.h /usr/include/glib-2.0/glib/genviron.h /usr/include/glib-2.0/glib/gerror.h /usr/include/glib-2.0/glib/gfileutils.h /usr/include/glib-2.0/glib/ggettext.h /usr/include/glib-2.0/glib/ghash.h /usr/include/glib-2.0/glib/ghmac.h /usr/include/glib-2.0/glib/ghook.h /usr/include/glib-2.0/glib/ghostutils.h /usr/include/glib-2.0/glib/giochannel.h /usr/include/glib-2.0/glib/gkeyfile.h /usr/include/glib-2.0/glib/glib-autocleanups.h /usr/include/glib-2.0/glib/glist.h /usr/include/glib-2.0/glib/gmacros.h /usr/include/glib-2.0/glib/gmain.h /usr/include/glib-2.0/glib/gmappedfile.h /usr/include/glib-2.0/glib/gmarkup.h /usr/include/glib-2.0/glib/gmem.h /usr/include/glib-2.0/glib/gmessages.h /usr/include/glib-2.0/glib/gnode.h /usr/include/glib-2.0/glib/goption.h /usr/include/glib-2.0/glib/gpattern.h /usr/include/glib-2.0/glib/gpoll.h /usr/include/glib-2.0/glib/gprimes.h /usr/include/glib-2.0/glib/gqsort.h /usr/include/glib-2.0/glib/gquark.h /usr/include/glib-2.0/glib/gqueue.h /usr/include/glib-2.0/glib/grand.h /usr/include/glib-2.0/glib/gregex.h /usr/include/glib-2.0/glib/gscanner.h /usr/include/glib-2.0/glib/gsequence.h /usr/include/glib-2.0/glib/gshell.h /usr/include/glib-2.0/glib/gslice.h /usr/include/glib-2.0/glib/gslist.h /usr/include/glib-2.0/glib/gspawn.h /usr/include/glib-2.0/glib/gstrfuncs.h /usr/include/glib-2.0/glib/gstring.h /usr/include/glib-2.0/glib/gstringchunk.h /usr/include/glib-2.0/glib/gtestutils.h /usr/include/glib-2.0/glib/gthread.h /usr/include/glib-2.0/glib/gthreadpool.h /usr/include/glib-2.0/glib/gtimer.h /usr/include/glib-2.0/glib/gtimezone.h /usr/include/glib-2.0/glib/gtrashstack.h /usr/include/glib-2.0/glib/gtree.h /usr/include/glib-2.0/glib/gtypes.h /usr/include/glib-2.0/glib/gunicode.h /usr/include/glib-2.0/glib/gurifuncs.h /usr/include/glib-2.0/glib/gutils.h /usr/include/glib-2.0/glib/gvariant.h /usr/include/glib-2.0/glib/gvarianttype.h /usr/include/glib-2.0/glib/gversion.h /usr/include/glib-2.0/glib/gversionmacros.h /usr/include/glib-2.0/glib/gwin32.h /usr/include/glib-2.0/gobject/gbinding.h /usr/include/glib-2.0/gobject/gboxed.h /usr/include/glib-2.0/gobject/gclosure.h /usr/include/glib-2.0/gobject/genums.h /usr/include/glib-2.0/gobject/glib-types.h /usr/include/glib-2.0/gobject/gmarshal.h /usr/include/glib-2.0/gobject/gobject-autocleanups.h /usr/include/glib-2.0/gobject/gobject.h /usr/include/glib-2.0/gobject/gparam.h /usr/include/glib-2.0/gobject/gparamspecs.h /usr/include/glib-2.0/gobject/gsignal.h /usr/include/glib-2.0/gobject/gsourceclosure.h /usr/include/glib-2.0/gobject/gtype.h /usr/include/glib-2.0/gobject/gtypemodule.h /usr/include/glib-2.0/gobject/gtypeplugin.h /usr/include/glib-2.0/gobject/gvalue.h /usr/include/glib-2.0/gobject/gvaluearray.h /usr/include/glib-2.0/gobject/gvaluetypes.h /usr/include/gstreamer-1.0/gst/glib-compat.h /usr/include/gstreamer-1.0/gst/gst.h /usr/include/gstreamer-1.0/gst/gstallocator.h /usr/include/gstreamer-1.0/gst/gstatomicqueue.h /usr/include/gstreamer-1.0/gst/gstbin.h /usr/include/gstreamer-1.0/gst/gstbuffer.h /usr/include/gstreamer-1.0/gst/gstbufferlist.h /usr/include/gstreamer-1.0/gst/gstbufferpool.h /usr/include/gstreamer-1.0/gst/gstbus.h /usr/include/gstreamer-1.0/gst/gstcaps.h /usr/include/gstreamer-1.0/gst/gstcapsfeatures.h /usr/include/gstreamer-1.0/gst/gstchildproxy.h /usr/include/gstreamer-1.0/gst/gstclock.h /usr/include/gstreamer-1.0/gst/gstcompat.h /usr/include/gstreamer-1.0/gst/gstcontext.h /usr/include/gstreamer-1.0/gst/gstcontrolbinding.h /usr/include/gstreamer-1.0/gst/gstcontrolsource.h /usr/include/gstreamer-1.0/gst/gstdatetime.h /usr/include/gstreamer-1.0/gst/gstdebugutils.h /usr/include/gstreamer-1.0/gst/gstdevice.h /usr/include/gstreamer-1.0/gst/gstdevicemonitor.h /usr/include/gstreamer-1.0/gst/gstdeviceprovider.h /usr/include/gstreamer-1.0/gst/gstdeviceproviderfactory.h /usr/include/gstreamer-1.0/gst/gstelement.h /usr/include/gstreamer-1.0/gst/gstelementfactory.h /usr/include/gstreamer-1.0/gst/gstelementmetadata.h /usr/include/gstreamer-1.0/gst/gstenumtypes.h /usr/include/gstreamer-1.0/gst/gsterror.h /usr/include/gstreamer-1.0/gst/gstevent.h /usr/include/gstreamer-1.0/gst/gstformat.h /usr/include/gstreamer-1.0/gst/gstghostpad.h /usr/include/gstreamer-1.0/gst/gstinfo.h /usr/include/gstreamer-1.0/gst/gstiterator.h /usr/include/gstreamer-1.0/gst/gstmacros.h /usr/include/gstreamer-1.0/gst/gstmemory.h /usr/include/gstreamer-1.0/gst/gstmessage.h /usr/include/gstreamer-1.0/gst/gstmeta.h /usr/include/gstreamer-1.0/gst/gstminiobject.h /usr/include/gstreamer-1.0/gst/gstobject.h /usr/include/gstreamer-1.0/gst/gstpad.h /usr/include/gstreamer-1.0/gst/gstpadtemplate.h /usr/include/gstreamer-1.0/gst/gstparamspecs.h /usr/include/gstreamer-1.0/gst/gstparse.h /usr/include/gstreamer-1.0/gst/gstpipeline.h /usr/include/gstreamer-1.0/gst/gstplugin.h /usr/include/gstreamer-1.0/gst/gstpluginfeature.h /usr/include/gstreamer-1.0/gst/gstpoll.h /usr/include/gstreamer-1.0/gst/gstpreset.h /usr/include/gstreamer-1.0/gst/gstprotection.h /usr/include/gstreamer-1.0/gst/gstquery.h /usr/include/gstreamer-1.0/gst/gstregistry.h /usr/include/gstreamer-1.0/gst/gstsample.h /usr/include/gstreamer-1.0/gst/gstsegment.h /usr/include/gstreamer-1.0/gst/gststructure.h /usr/include/gstreamer-1.0/gst/gstsystemclock.h /usr/include/gstreamer-1.0/gst/gsttaglist.h /usr/include/gstreamer-1.0/gst/gsttagsetter.h /usr/include/gstreamer-1.0/gst/gsttask.h /usr/include/gstreamer-1.0/gst/gsttaskpool.h /usr/include/gstreamer-1.0/gst/gsttoc.h /usr/include/gstreamer-1.0/gst/gsttocsetter.h /usr/include/gstreamer-1.0/gst/gsttypefind.h /usr/include/gstreamer-1.0/gst/gsttypefindfactory.h /usr/include/gstreamer-1.0/gst/gsturi.h /usr/include/gstreamer-1.0/gst/gstutils.h /usr/include/gstreamer-1.0/gst/gstvalue.h /usr/include/gstreamer-1.0/gst/gstversion.h /usr/include/gstreamer-1.0/gst/mpegts/gst-atsc-section.h /usr/include/gstreamer-1.0/gst/mpegts/gst-dvb-descriptor.h /usr/include/gstreamer-1.0/gst/mpegts/gst-dvb-section.h /usr/include/gstreamer-1.0/gst/mpegts/gst-scte-section.h /usr/include/gstreamer-1.0/gst/mpegts/gstmpegts-enumtypes.h /usr/include/gstreamer-1.0/gst/mpegts/gstmpegtsdescriptor.h /usr/include/gstreamer-1.0/gst/mpegts/gstmpegtssection.h /usr/include/gstreamer-1.0/gst/mpegts/mpegts.h /usr/lib/glib-2.0/include/glibconfig.h /usr/lib/gstreamer-1.0/include/gst/gstconfig.h CMakeFiles/mpegsttest.dir/flags.make
/usr/bin/cmake -E cmake_echo_color --switch= --green --progress-dir=/home/dev3lx/build/mpegts/CMakeFiles --progress-num=1 "Building C object CMakeFiles/mpegsttest.dir/mpegtstest.c.o"
[ 50%] Building C object CMakeFiles/mpegsttest.dir/mpegtstest.c.o
/usr/bin/cc -I/home/dev3lx/build/mpegts -I/home/dev3lx/Development/mptestsrc/.. -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/gstreamer-1.0 -I/usr/lib/gstreamer-1.0/include -o CMakeFiles/mpegsttest.dir/mpegtstest.c.o -c /home/dev3lx/Development/mptestsrc/mpegtstest.c
CMakeFiles/mpegsttest.dir/build.make:95: update target 'mpegsttest' due to: CMakeFiles/mpegsttest.dir/link.txt CMakeFiles/mpegsttest.dir/mpegtstest.c.o CMakeFiles/mpegsttest.dir/build.make /usr/lib64/libgstreamer-1.0.so
/usr/bin/cmake -E cmake_echo_color --switch= --green --bold --progress-dir=/home/dev3lx/build/mpegts/CMakeFiles --progress-num=2 "Linking C executable mpegsttest"
[100%] Linking C executable mpegsttest
/usr/bin/cmake -E cmake_link_script CMakeFiles/mpegsttest.dir/link.txt --verbose=
/usr/bin/ld: cannot find -lgstreamer-mpegts-1.0
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/mpegsttest.dir/build.make:96: mpegsttest] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/mpegsttest.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
After searching online and trying a few different things found online like here and looking at Github code we don't know why or how to fix it. Any advice or assistance is much appreciated. thanks in advance.
Solution
Thanks to nega's comment and solution, changing include_directories(${GSTREAMER-MPEGTS_INCLUDE_DIRS}) to include_directories(${GSTREAMER_MPEGTS_INCLUDE_DIRS}) worked.
Based on your cmake output, I'd guess that you're using a version of FindGStreamer.cmake cribbed from WebKit. If that's the case, the variable you want to use is GSTREAMER_MPEGTS_INCLUDE_DIRS. Note the lack of a hyphen in the variable name.
If that's not the case, use a simple message() statement before the use of a variable to show you its value during the cmake step.
In your CMakeLists.txt:
message("GMID: ${GSTREAMER_MPEGTS_INCLUDE_DIRS}")
include_directories(${GSTREAMER_MPEGTS_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} gstreamer-mpegts-1.0)
In your shell:
$ cmake ../src |grep -i ^gmid
GMID: /usr/local/Cellar/libffi/3.3_2/include;/usr/local/Cellar/gst-plugins-bad/1.18.3/include/gstreamer-1.0;/usr/local/Cellar/gstreamer/1.18.3/include/gstreamer-1.0;/usr/local/Cellar/glib/2.66.7/include;/usr/local/Cellar/glib/2.66.7/include/glib-2.0;/usr/local/Cellar/glib/2.66.7/lib/glib-2.0/include;/usr/local/opt/gettext/include;/usr/local/Cellar/pcre/8.44/include
Another easy debugging step is to grep the cache after running cmake.
$ grep -i ^gstream CMakeCache.txt
GSTREAMER_APP_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-base/1.18.3/lib/libgstapp-1.0.dylib
GSTREAMER_AUDIO_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-base/1.18.3/lib/libgstaudio-1.0.dylib
GSTREAMER_BASE_LIBRARIES:FILEPATH=/usr/local/Cellar/gstreamer/1.18.3/lib/libgstbase-1.0.dylib
GSTREAMER_CODECPARSERS_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-bad/1.18.3/lib/libgstcodecparsers-1.0.dylib
GSTREAMER_FFT_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-base/1.18.3/lib/libgstfft-1.0.dylib
GSTREAMER_FULL_LIBRARIES:FILEPATH=GSTREAMER_FULL_LIBRARIES-NOTFOUND
GSTREAMER_GL_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-base/1.18.3/lib/libgstgl-1.0.dylib
GSTREAMER_LIBRARIES:FILEPATH=/usr/local/Cellar/gstreamer/1.18.3/lib/libgstreamer-1.0.dylib
GSTREAMER_MPEGTS_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-bad/1.18.3/lib/libgstmpegts-1.0.dylib
GSTREAMER_PBUTILS_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-base/1.18.3/lib/libgstpbutils-1.0.dylib
GSTREAMER_TAG_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-base/1.18.3/lib/libgsttag-1.0.dylib
GSTREAMER_VIDEO_LIBRARIES:FILEPATH=/usr/local/Cellar/gst-plugins-base/1.18.3/lib/libgstvideo-1.0.dylib

CMake Produces Makefile that Linker Doesn't Like

I'm trying to modernize a build system with CMake. When I try to compile the program with make I get this output
$ cmake -DCMAKE_TOOLCHAIN_FILE="../armgcc.cmake" .. && make
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- Check for working C compiler: /usr/bin/arm-none-eabi-gcc
-- Check for working C compiler: /usr/bin/arm-none-eabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++
-- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: ~/cmake_test/build
Scanning dependencies of target testproj
[ 50%] Building C object CMakeFiles/testproj.dir/main.c.obj
[100%] Linking C executable testproj
arm-none-eabi-gcc: fatal error: /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/lib/nosys.specs: attempt to rename spec 'link_gcc_c_sequence' to already defined spec 'nosys_link_gcc_c_sequence'
compilation terminated.
make[2]: *** [CMakeFiles/testproj.dir/build.make:84: testproj] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/testproj.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
With CMakeLists.txt
cmake_minimum_required(VERSION 3.0.0)
project(testproj VERSION 0.1.0)
add_executable(testproj main.c)
and armgcc.cmake
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-gcc)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nosys.specs")
What are link_gcc_sequence and nosys_link_gcc_sequence, and how should I structure my CMakeLists to avoid renaming them?

CMAKE dont find the libmpdclient-2.13 library

I´m new to cmake and i need help to build the ympd https://github.com/notandy/ympd project on windows
1. Install libmpdclient
I installed the libmpdclient-2.13 library from https://www.musicpd.org/libs/libmpdclient/
i did the steps to build the libmpdclient from the github repo
https://github.com/MusicPlayerDaemon/libmpdclient
This works well and got the following output with the .dll file:
2. Build the ympd project
I created a folder /build and inside this folder i did
cmake ..
i got this errors:
C:\mpd\ympd\build>cmake ..
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.15063.0 to target Windows 10.0.16299.
-- The C compiler identification is MSVC 19.11.25508.2
-- The CXX compiler identification is MSVC 19.11.25508.2
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: C:/MinGW/bin/pkg-config.exe (found version "0.26")
CMake Error at G:/Programme/CMake/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find LibMPDClient (missing: LIBMPDCLIENT_LIBRARY
LIBMPDCLIENT_INCLUDE_DIR)
Call Stack (most recent call first):
G:/Programme/CMake/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindLibMPDClient.cmake:27 (find_package_handle_standard_args)
CMakeLists.txt:20 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/mpd/ympd/build/CMakeFiles/CMakeOutput.log".
Question:
How can i give cmake the parameters LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR?
Project Structure:
mpd/ympd/
build/
cmake/
FindLibMPDClient.cmake
contrib/
htdocs/
libmpdclient-2.13/
.output/
libmpdclient-2.dll
src/
tools/
.travis
CMakeLlists
LICENSE
README
ympd.1
File FindLibMPDClient.cmake:
# - Try to find LibMPDClient
# Once done, this will define
#
# LIBMPDCLIENT_FOUND - System has LibMPDClient
# LIBMPDCLIENT_INCLUDE_DIRS - The LibMPDClient include directories
# LIBMPDCLIENT_LIBRARIES - The libraries needed to use LibMPDClient
# LIBMPDCLIENT_DEFINITIONS - Compiler switches required for using LibMPDClient
find_package(PkgConfig)
pkg_check_modules(PC_LIBMPDCLIENT QUIET libmpdclient)
set(LIBMPDCLIENT_DEFINITIONS ${PC_LIBMPDCLIENT_CFLAGS_OTHER})
find_path(LIBMPDCLIENT_INCLUDE_DIR
NAMES mpd/player.h
HINTS ${PC_LIBMPDCLIENT_INCLUDEDIR} ${PC_LIBMPDCLIENT_INCLUDE_DIRS}
)
find_library(LIBMPDCLIENT_LIBRARY
NAMES mpdclient
HINTS ${PC_LIBMPDCLIENT_LIBDIR} ${PC_LIBMPDCLIENT_LIBRARY_DIRS}
)
set(LIBMPDCLIENT_LIBRARIES ${LIBMPDCLIENT_LIBRARY})
set(LIBMPDCLIENT_INCLUDE_DIRS ${LIBMPDCLIENT_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibMPDClient DEFAULT_MSG
LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR
)
mark_as_advanced(LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR)
every help is appropriate, thanks

Cmake add library to a custom gcc compiler

I'm trying to compile a small program written in c with additional libraries zlib and libpng for an arm processor using using gcc-linaro-arm-linux.
In some .c file:
#include <bzlib.h>
If I compile with an ordinary gcc, everything is working fine, but with a gcc-linaro-arm-linux compiler it could not find libraries:
cmake:
$cmake -D CMAKE_C_COMPILER="${HOME}/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc" -D CMAKE_CXX_COMPILER="${HOME}/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-g++" CMakeLists.txt
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /home/alex/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc
-- Check for working C compiler: /home/alex/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /home/alex/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-g++
-- Check for working CXX compiler: /home/alex/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.8")
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindPNG.cmake:105 (find_package_handle_standard_args)
src/CMakeLists.txt:3 (find_package)
You need to tell CMake where to find your target sysroot. Check out CMAKE_FIND_ROOT_PATH.

cmake doesn't display display message

Fedora 15
cmake version 2.8.4
I am using the following CMakeLists.txt. However the status message doesn't display when I run cmake .
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(proj2 C)
IF(CMAKE_COMPILER_IS_GNUCXX)
MESSAGE(STATUS "==== GCC detected - Adding compiler flags")
SET(CMAKE_C_FLAGS "-pthread -ggdb -Wextra -Wall")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ADD_EXECUTABLE(crypto_app main.c)
TARGET_LINK_LIBRARIES(crypto_app crypt)
All I get is the following:
-- The C compiler identification is GNU
-- Check for working C compiler: /usr/lib64/ccache/gcc
-- Check for working C compiler: /usr/lib64/ccache/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/projects/proj1/
Many thanks for any suggestions about this.
You're telling cmake that it's a C project, and then checking for a CXX (i.e. C++) compiler. CMAKE_COMPILER_IS_GNUCXX will never be true in this case. That's why.

Resources