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

"Getting Started" fails at command "cmake .. -DWITH_SDL2APPLICATION=ON" #140

Closed
Osram-Lux opened this issue Mar 22, 2016 · 6 comments
Closed

Comments

@Osram-Lux
Copy link

Hi,
I'm following Magnum getting started, http://mosra.cz/blog/magnum-doc/getting-started.html, but the instructions fails at command cmake .. -DWITH_SDL2APPLICATION=ON with:
CMake Error at /usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 (message): Could NOT find Corrade (missing: CORRADE_INCLUDE_DIR _CORRADE_CONFIGURE_FILE)

Command transcript (irrelevant and successful command results replaced with ...):

$ mkdir new_magnum
$ cd new_magnum/
$ unzip base.zip 
Archive:  base.zip
8c90cab6b4da713dfe19e886ac8143ffa63f8e11
   creating: magnum-bootstrap-base/
  ...  
  inflating: magnum-bootstrap-base/src/MyApplication.cpp
$ cd magnum-bootstrap-base/
$ git clone git://github.com/mosra/corrade.git
Cloning into 'corrade'...
...
$ git clone git://github.com/mosra/magnum.git
...
$ mkdir -p build && cd build
$ cmake .. -DWITH_SDL2APPLICATION=ON
-- The C compiler identification is GNU 5.2.1
-- The CXX compiler identification is GNU 5.2.1
-- 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
CMake Error at /usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find Corrade (missing: CORRADE_INCLUDE_DIR
  _CORRADE_CONFIGURE_FILE)
Call Stack (most recent call first):
  /usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
  modules/FindCorrade.cmake:228 (find_package_handle_standard_args)
  modules/FindMagnum.cmake:180 (find_package)
  src/CMakeLists.txt:1 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/jan/WORK/new_magnum/magnum-bootstrap-base/build/CMakeFiles/CMakeOutput.log".

I have unfortunately not written any CMake scripts, so I'm not able to understand the root cause of the problem (more than that Corrade is not found despite that it has been gitted to it's "correct" place).

I'm on (K)Ubuntu 15.10, if that matters.

Thanks in advance
/Jan

@mosra
Copy link
Owner

mosra commented Mar 22, 2016

Hmm... if the command transcript is really everything you did, then you probably missed this part:

Then open the CMakeLists.txt file in the root of bootstrap project and add these two new subdirectories using add_subdirectory() so the file looks like this:

cmake_minimum_required(VERSION 2.8.12)
project(MyApplication)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/")

add_subdirectory(corrade)
add_subdirectory(magnum)
add_subdirectory(src)

The reason why this is not done by default is to allow people a choice -- someone might want to install the dependencies separately instead of bundling them with the project.

Hope this helps :)

@Osram-Lux
Copy link
Author

Hi and thanks for a very quick reply,

You definitely pinpointed the problem and my mistake.
Unfortunately that does not solve all compilation problems, since compiling gives a compile error (generating the makefiles gave a warning include below for reference)

$ cmake --build .
....
Linking CXX shared library libMagnumText.so
[ 99%] Built target MagnumText
src/CMakeFiles/MyApplication.dir/build.make:84: *** target pattern contains no '%'.  Stop.
CMakeFiles/Makefile2:1772: recipe for target 'src/CMakeFiles/MyApplication.dir/all' failed
make[1]: *** [src/CMakeFiles/MyApplication.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2

I'm running GNU Make 4.0 and line 84 of src/CMakeFiles/MyApplication.dir/build.make is:

src/MyApplication: Magnum::Magnum-NOTFOUND

and the surrounding code looks like this:

# External object files for target MyApplication
MyApplication_EXTERNAL_OBJECTS =

src/MyApplication: src/CMakeFiles/MyApplication.dir/MyApplication.cpp.o
src/MyApplication: src/CMakeFiles/MyApplication.dir/build.make
src/MyApplication: Magnum::Magnum-NOTFOUND
src/MyApplication: src/CMakeFiles/MyApplication.dir/link.txt
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX executable MyApplication"
    cd /home/jan/WORK/new_magnum/magnum-bootstrap-base/build/src && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/MyApplication.dir/link.txt --verbose=$(VERBOSE)

# Rule to build all files generated by this target.

The whole Makefile does not contain any % sign. I guess that the problem is that Magnum::Magnum-NOTFOUND should have expanded to a path, but unfortunately my CMake knowledge at this stage is limited, and most probably I would not have been able to guess to what it should have been initialized.

Building the makefiles ends with the following warning:

$ mkdir build && cd build
$ cmake .. -DWITH_SDL2APPLICATION=ON
...
-- Configuring done
CMake Warning (dev) at src/CMakeLists.txt:6 (add_executable):
  Policy CMP0028 is not set: Double colon in target name means ALIAS or
  IMPORTED target.  Run "cmake --help-policy CMP0028" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target "MyApplication" links to target "Magnum::Application" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /home/jan/WORK/new_magnum/magnum-bootstrap-base/build

The warning seems to be benign, but I included it just in case.

Again, Thanks in advance,
/Jan

@mosra
Copy link
Owner

mosra commented Mar 23, 2016

This is probably a bug on my side. Let me check.

@mosra
Copy link
Owner

mosra commented Mar 23, 2016

Okay, my apologies. Should be fixed in b5851b5 and f47a406, the relevant module is also copied in the base bootstrap application. Can you try pulling latest Magnum, downloading latest base.zip and compiling again?

Lately I did a big overhaul of the CMake build system and apparently the testing was not done properly in this case. Sorry.

@Osram-Lux
Copy link
Author

Hi,
Thanks again for the quick response. Now it works like a charm.

Don't be sorry for this small slip on the keyboard. I think you are doing wonderful work.

Now it's playtime for me :-)
/Jan

@mosra
Copy link
Owner

mosra commented Mar 24, 2016

Thank you! :)

@mosra mosra added this to the 2018.02 milestone Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants