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

Build fails: error: static_assert failed "could not find from_json() method in T's namespace" #54

Closed
yurivict opened this issue Feb 23, 2019 · 2 comments

Comments

@yurivict
Copy link

yurivict commented Feb 23, 2019

See the log here: http://beefy12.nyi.freebsd.org/data/head-amd64-default/p493484_s344398/logs/magnum-plugins-2019.01.log (IPv6 URL)

/wrkdirs/usr/ports/graphics/magnum-plugins/work/magnum-plugins-2019.01/src/MagnumExternal/TinyGltf/./json.hpp:1378:9: error: static_assert failed "could not find from_json() method in T's namespace"
        static_assert(sizeof(BasicJsonType) == 0,
        ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/graphics/magnum-plugins/work/magnum-plugins-2019.01/src/MagnumExternal/TinyGltf/./json.hpp:1387:16: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::call<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
        return call(j, val, priority_tag<1> {});
               ^
/wrkdirs/usr/ports/graphics/magnum-plugins/work/magnum-plugins-2019.01/src/MagnumExternal/TinyGltf/./json.hpp:6861:9: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::operator()<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
        ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
        ^
/wrkdirs/usr/ports/graphics/magnum-plugins/work/magnum-plugins-2019.01/src/MagnumExternal/TinyGltf/./json.hpp:9578:36: note: in instantiation of function template specialization 'nlohmann::adl_serializer<std::__1::basic_string_view<char, std::__1::char_traits<char> >, void>::from_json<const nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer> &, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
        JSONSerializer<ValueType>::from_json(*this, ret);
                                   ^
/wrkdirs/usr/ports/graphics/magnum-plugins/work/magnum-plugins-2019.01/src/MagnumExternal/TinyGltf/./json.hpp:9841:16: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>::get<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string_view<char, std::__1::char_traits<char> >, 0>' requested here
        return get<ValueType>();
               ^
/usr/include/c++/v1/string:875:29: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>::operator basic_string_view<std::__1::basic_string_view<char, std::__1::char_traits<char> >, 0>' requested here
        {__self_view __sv = __t; return assign(__sv);}
                            ^
/wrkdirs/usr/ports/graphics/magnum-plugins/work/magnum-plugins-2019.01/src/MagnumExternal/TinyGltf/tiny_gltf.h:1924:12: note: in instantiation of function template specialization 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>, void>' requested here
    (*ret) = it.value();
@mosra mosra added this to the 2019.0b milestone Feb 24, 2019
@mosra mosra added this to TODO in Asset management via automation Feb 24, 2019
@mosra
Copy link
Owner

mosra commented Feb 24, 2019

Huh. Neither my internet provider nor my mobile connection is IPv6-capable, apparently. That's sad. (Amended the issue to show the relevant portion, hope that's okay.)

As an aside: thank you for working on FreeBSD packages! 👍 💯

This is related to the external nlohmann/json library that TinyGltfImporter is using. I'm pinned to a quite ancient version there because the newer ones are way too huge and have terrible compile times (even this one is awful, but what can I do). Could you try swapping the json.hpp for a newer one and try building again? If that helps, maybe I could cherry-pick the change that fixes it (instead of doing a full upgrade).

I see it's using Clang and libc++, but don't see the version. What's the compiler version? Maybe I'll be able to reproduce here on ArchLinux as well.

Besides that, tiny_gltf might be going away from json.hpp in the future (a welcome change), so this issue might get solved by that as well. If the above doesn't help, I'm afraid you'll need to disable WITH_TINYGLTFIMPORTER for the time being.

@mosra
Copy link
Owner

mosra commented Apr 9, 2019

Fixed by upgrading to json.hpp 3.3.0 in b64e5b3. Cherry-picking the change was impossible, so the code is inflated by another 200 kB :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants