Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake compile failure with external CMAKE_MODULE_PATH set #962

Closed
chenguokai opened this issue May 19, 2020 · 1 comment
Closed

cmake compile failure with external CMAKE_MODULE_PATH set #962

chenguokai opened this issue May 19, 2020 · 1 comment

Comments

@chenguokai
Copy link
Collaborator

Thank you for giving feedback to the stlink project.

In order to allow developers and other contributors to isolate and target your respective issue, please take some time to fill out each of the following items appropriate to your specific problem:

  • Operating system and version: [macOS 10.14.6] (e.g Linux, Mac OS X, Windows)
  • Stlink tools version and/or git commit hash: [90d65be] (e.g v1.1.0/git-c722056)

Futher we kindly ask you to describe the detected problem as detailed as possible and to add debug output if available, by using the following template:

Expected/description:

Should compile without errors with MacPorts.

...
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_pek.cn.rsync.macports.org_macports_release_tarballs_ports_cross_stlink/stlink/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.14" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk" /opt/local/var/macports/build/_opt_local_var_macports_sources_pek.cn.rsync.macports.org_macports_release_tarballs_ports_cross_stlink/stlink/work/stlink-90d65be93123e8b29b451dd34dabf39628f142d7 
-- The C compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:21 (include):
  include could not find load file:

    /opt/local/share/cmake/Modules


CMake Error at CMakeLists.txt:25 (include):
  include could not find load file:

    /opt/local/share/cmake/Modules


-- Found libusb: /opt/local/lib/libusb-1.0.a  
-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'gtk+-3.0'
--   No package 'gtk+-3.0' found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for __stack_chk_fail in ssp
-- Looking for __stack_chk_fail in ssp - not found
-- STLINK_LIB_SHARED: stlink
-- PROJECT_VERSION_MAJOR: 
-- VERSION: ..
CMake Error at CMakeLists.txt:167 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


-- STLINK_LIB_STATIC: stlink-static
-- PROJECT_VERSION_MAJOR: 
-- VERSION: ..
CMake Error at CMakeLists.txt:203 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


-- GTK3 not found!
-- Manpage generation disabled
-- Configuring incomplete, errors occurred!
...

My test environment:

macOS 10.14.6
cmake 3.17.2

What I have figured out

Compile fails with a minimum of cmake -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" ../

CMake Warning (dev) at CMakeLists.txt:146:
  Syntax Warning in cmake code at column 59

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:21 (include):
  include could not find load file:

    /opt/local/share/cmake/Modules


CMake Error at CMakeLists.txt:25 (include):
  include could not find load file:

    /opt/local/share/cmake/Modules


-- Found libusb: /opt/local/lib/libusb-1.0.a  
-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.24.20
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for __stack_chk_fail in ssp
-- Looking for __stack_chk_fail in ssp - not found
-- STLINK_LIB_SHARED: stlink
-- PROJECT_VERSION_MAJOR: 
-- VERSION: ..
CMake Error at CMakeLists.txt:167 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


-- STLINK_LIB_STATIC: stlink-static
-- PROJECT_VERSION_MAJOR: 
-- VERSION: ..
CMake Error at CMakeLists.txt:203 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


-- Found GTK3: -I/opt/local/include/gtk-3.0;/opt/local/include/at-spi2-atk/2.0;/opt/local/include/at-spi-2.0;/opt/local/include;/opt/local/include/dbus-1.0;/opt/local/lib/dbus-1.0/include;/opt/local/include/gtk-3.0;/opt/local/include/gio-unix-2.0/;/opt/local/include;/opt/local/include/cairo;/opt/local/include;/opt/local/include/pango-1.0;/opt/local/include/harfbuzz;/opt/local/include;/opt/local/include/pango-1.0;/opt/local/include/fribidi;/opt/local/include/atk-1.0;/opt/local/include/cairo;/opt/local/include/pixman-1;/opt/local/include;/opt/local/include/ossp;/opt/local/include/freetype2;/opt/local/include;/opt/local/include/libpng16;/opt/local/include;/opt/local/include/gdk-pixbuf-2.0;/opt/local/include/glib-2.0;/opt/local/lib/glib-2.0/include;/opt/local/include, gtk-3;gdk-3;pangocairo-1.0;pango-1.0;atk-1.0;cairo-gobject;cairo;gdk_pixbuf-2.0;gio-2.0;gobject-2.0;glib-2.0;intl
-- Manpage generation disabled
-- Configuring incomplete, errors occurred!
See also "/Users/cgk/Documents/macports-maintain/stlink/test/CMakeFiles/CMakeOutput.log".
See also "/Users/cgk/Documents/macports-maintain/stlink/test/CMakeFiles/CMakeError.log".

This shows that set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake/modules") in CMakeList.txt is overwritten by the command-line argument. A dirty fix is removing ${CMAKE_MODULE_PATH};.

NOTICE: This bug report may be closed without further notice, if not enough information is provided!

Thank you for your support.

The stlink project maintainers

@Nightwalker-87
Copy link
Member

This shows that set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake/modules") in CMakeList.txt is overwritten by the command-line argument. A dirty fix is removing ${CMAKE_MODULE_PATH};.

@chenguokai: I'd say this is not a "dirty" fix, I think it was simply wrong before. I've removed ${CMAKE_MODULE_PATH}; anyway during a review without any relation to this issue at all. I'll submit this as soon as the current PR is ready to merge after your pending review.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants