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

'clang++ ./json.hpp' with no usage: Compiler syntax problem in clang 3.7.0 (tizen :/ ) #3153

Closed
2 of 5 tasks
joerohde opened this issue Nov 21, 2021 · 4 comments
Closed
2 of 5 tasks
Labels
confirmed kind: bug solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope)

Comments

@joerohde
Copy link

joerohde commented Nov 21, 2021

Syntax errors (noted below) just trying to include the header, or compile/parse it directly. This is on a mac targetting arm. Compiler SDK in question can be wget retrieved, unzipped and used - no install.

What is the issue you have?

Please describe the steps to reproduce the issue.

  1. wget http://sdf.samsungcloudcdn.com/Public/UwBWAEMAMAAwADAAMAAyAA==/NAAyADkAeABsAGsAcAB2AHAAaABkAHMAagA=/NaCl_SDK_v56.zip
  2. unzip it
  3. Compile single-header: pepper_56/toolchain/mac_pnacl/bin/arm-nacl-clang++ -ftemplate-backtrace-limit=0 -ferror-limit=1 -std=gnu++14 -c ./json.hpp
  4. Or split headers: (add -isystem. ./nlohmann/json.hpp)

(Note: --std=c++14 has same issue, but then requires an extra workaround for isascii not declared)
.

Can you provide a small but working code example?

No code needed.

What is the expected behavior?

Compiles. Readme shows CI support that bookends this version clang 3.6.2 and 3.7.1, but the tizen thing may be a monkey-wrent.

And what is the actual behavior instead?

This is the 1st error from the single header:

pepper_56/toolchain/mac_pnacl/bin/arm-nacl-clang++ -ftemplate-backtrace-limit=0 -ferror-limit=1 -std=gnu++14 -c ./json.hpp
In file included from ./json.hpp:37:
In file included from /Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/algorithm:627:
/Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/utility:254:9: error: field has incomplete type 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned
      long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >'
    _T2 second;
        ^
/Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/map:588:16: note: in instantiation of template class 'std::__1::pair<const std::__1::basic_string<char>, nlohmann::basic_json<std::map, std::vector,
      std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >' requested here
    value_type __cc;
               ^
/Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/__tree:603:16: note: in instantiation of template class 'std::__1::__value_type<std::__1::basic_string<char>, nlohmann::basic_json<std::map,
      std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >' requested here
    value_type __value_;
               ^
/Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/__tree:625:22: note: in instantiation of template class 'std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>,
      nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >,
      void *>' requested here
    typedef typename __node::base                                 __node_base;
                     ^
/Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/map:650:19: note: in instantiation of template class 'std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char>,
      nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >,
      std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer,
      std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >, void *> *, int>' requested here
    _TreeIterator __i_;
                  ^
./json.hpp:11569:48: note: in instantiation of template class 'std::__1::__map_iterator<std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char>, nlohmann::basic_json<std::map, std::vector,
      std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >,
      std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer,
      std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >, void *> *, int> >' requested here
    typename BasicJsonType::object_t::iterator object_iterator {};
                                               ^
./json.hpp:12321:72: note: in instantiation of template class 'nlohmann::detail::internal_iterator<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator,
      adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >' requested here
    internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
                                                                       ^
./json.hpp:18812:48: note: in instantiation of template class 'nlohmann::detail::iter_impl<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator,
      adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >' requested here
    iterator set_parents(iterator it, typename iterator::difference_type count)
                                               ^
/Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/type_traits:2342:38: note: in instantiation of template class 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long
      long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >' requested here
    : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
                                     ^
/Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/type_traits:2929:41: note: in instantiation of template class 'std::__1::is_constructible<nlohmann::basic_json<std::map, std::vector,
      std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, nlohmann::basic_json<std::map, std::vector,
      std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > &&>' requested here
    : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...>
                                        ^
/Users/x/src/sdks/pepper_56/toolchain/mac_pnacl/bin/../arm-nacl/include/c++/v1/type_traits:3065:14: note: in instantiation of template class 'std::__1::is_nothrow_constructible<nlohmann::basic_json<std::map, std::vector,
      std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, nlohmann::basic_json<std::map, std::vector,
      std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > &&>' requested here
    : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
             ^
./json.hpp:26526:5: note: in instantiation of template class 'std::__1::is_nothrow_move_constructible<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double,
      std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > >' requested here
    is_nothrow_move_constructible<nlohmann::json>::value&&  // NOLINT(misc-redundant-expression)
    ^
./json.hpp:3448:7: note: definition of 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char,
      std::__1::allocator<unsigned char> > >' is not complete until the closing '}'
class basic_json;
      ^

Which compiler and operating system are you using?

Build on mac, targetting arm

Which version of the library did you use?

  • latest release version 3.10.4
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below
    Haven't run since the header itself does not get past the 1st pass compilation. Hope that's ok?
@joerohde
Copy link
Author

Note: they have a slightly newer v63 of this SDK - no difference in syntax handling. clang build was build from the same commit hash, llvm different (but not relevant).

@nlohmann
Copy link
Owner

I can confirm the error. Can you please provide more information about the SDK?

@joerohde
Copy link
Author

The zip file is the full Native SDK Tizen - Samsung TVs. A couple years ago they started moving away from Tize. It is a snapshot of the Native Chromium SDK: https://developer.chrome.com/docs/native-client/sdk/download/

It exists in the typical worst case. It's old. The product is alive and doing well, but the SDK seems to be locked in time. They don't release often and the compiler feels locked down. Samsun'g launchpad: https://developer.samsung.com/smarttv/develop/extension-libraries/nacl/getting-started.html

We would ideally like to use the library as our json solution on all native streaming clients.

Just reach out if there is any other information I can provide, or if this is not hitting the mark. I think the key take-away is - no - we don't have an update/alternative-compiler option. :(

@gregmarr
Copy link
Contributor

Looks like this is because C++ didn't officially support using an incomplete type as the template argument of std::vector<> until C++ 17. Compilers were not required to support it before then, and clang was particularly fussy about that.

@nlohmann nlohmann added the solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope) label Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed kind: bug solution: wontfix the issue will not be fixed (either it is impossible or deemed out of scope)
Projects
None yet
Development

No branches or pull requests

3 participants