mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.74k stars 439 forks source link

Compilation fails with boost 1.84.0 on macos #640

Closed sanjuchopracool closed 1 month ago

sanjuchopracool commented 1 month ago

I am using magnum with my project as a subdirectory.

If the boost version is 1.84 it fails in compilation If the boost version is 1.73.0 it works fine.

temporary solution is to move

find_package(Boost) include_directories(${Boost_INCLUDE_DIRS})

below

add_subdirectory(corrade EXCLUDE_FROM_ALL) add_subdirectory(magnum EXCLUDE_FROM_ALL)

cmake_minimum_required(VERSION 3.26)

project(TEST)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

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

find_package(Boost)
include_directories(${Boost_INCLUDE_DIRS})
# Add Corrade as a subproject
add_subdirectory(corrade EXCLUDE_FROM_ALL)
add_subdirectory(magnum EXCLUDE_FROM_ALL)
message(${Boost_FOUND})
message(${Boost_INCLUDE_DIR})
message(${Boost_VERSION_STRING})
find_package(Magnum REQUIRED)

# set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)

add_subdirectory(src)
In file included from /Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Utility/Debug.cpp:27:
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Utility/Debug.h:657:39: error: no type named 'StringView' in namespace 'Corrade::Containers'
        Debug& operator<<(Containers::StringView value);
                          ~~~~~~~~~~~~^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Utility/Debug.h:670:39: error: no type named 'MutableStringView' in namespace 'Corrade::Containers'
        Debug& operator<<(Containers::MutableStringView value);
                          ~~~~~~~~~~~~^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Utility/Debug.h:676:33: error: no type named 'String' in namespace 'Corrade::Containers'; did you mean 'std::string'?
        Debug& operator<<(const Containers::String& value);
                                ^~~~~~~~~~~~~~~~~~
                                std::string
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__fwd/string.h:47:7: note: 'std::string' declared here
using string = basic_string<char>;
      ^
In file included from /Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Utility/Debug.cpp:58:
In file included from /Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/String.h:41:
In file included from /Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringView.h:51:
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:160:59: error: use of undeclared identifier 'StringView'
        /*implicit*/ StringIterable(std::initializer_list<StringView> view) noexcept;
                                                          ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:179:113: error: unknown type name 'StringView'
        explicit StringIterable(const void* data, const void* context, std::size_t size, std::ptrdiff_t stride, StringView(*accessor)(const void*, const void*, std::ptrdiff_t, std::size_t)) noexcept: _data{data}, _context{context}, _size{size}, _stride{stride}, _accessor{accessor} {}
                                                                                                                ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:230:9: error: unknown type name 'StringView'
        StringView operator[](std::size_t i) const;
        ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:238:16: error: unknown type name 'StringIterableIterator'
        inline StringIterableIterator begin() const;
               ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:240:16: error: unknown type name 'StringIterableIterator'
        inline StringIterableIterator cbegin() const;
               ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:248:16: error: unknown type name 'StringIterableIterator'
        inline StringIterableIterator end() const;
               ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:250:16: error: unknown type name 'StringIterableIterator'
        inline StringIterableIterator cend() const;
               ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:259:9: error: unknown type name 'StringView'
        StringView front() const;
        ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:268:9: error: unknown type name 'StringView'
        StringView back() const;
        ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:273:49: error: unknown type name 'StringView'
        explicit StringIterable(ArrayView<const StringView> view, Implementation::IterableOverloadPriority<1>) noexcept;
                                                ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:274:49: error: unknown type name 'MutableStringView'
        explicit StringIterable(ArrayView<const MutableStringView> view, Implementation::IterableOverloadPriority<1>) noexcept;
                                                ^
/Users/sanju/PROJECTS/magnum/corrade/src/Corrade/Containers/StringIterable.h:275:49: error: unknown type name 'String'; did you mean 'std::string'?
        explicit StringIterable(ArrayView<const String> view, Implementation::IterableOverloadPriority<1>) noexcept;
                                                ^~~~~~
                                                std::string
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__fwd/string.h:47:7: note: 'std::string' declared here
using string = basic_string<char>;
sanjuchopracool commented 1 month ago

It was specific to my system. corrade was installed through brew also.

I apologise for inconvenience.