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

compilation issue with NVCC 9.0 #1773

Closed
palebluedot19 opened this issue Oct 3, 2019 · 14 comments
Closed

compilation issue with NVCC 9.0 #1773

palebluedot19 opened this issue Oct 3, 2019 · 14 comments
Labels
kind: question state: needs more info the author of the issue needs to provide more details state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@palebluedot19
Copy link

palebluedot19 commented Oct 3, 2019

Can someone help me to solve the compilation errors? I compiled a simple test source code with g++. The code does compile successfully. However, I get error messages (see below) if I compile the same code with nvcc.

/home/palebluedot/src/json/single_include/nlohmann/json.hpp(14261): warning: pointless comparison of unsigned integer with zero
          detected during:
            instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::__cxx11::string, __nv_bool, int64_t, uint64_t, double, std::allocator, nlohmann::adl_serializer>, NumberType=uint64_t, <unnamed>=0]" 
(13896): here
            instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType &, __nv_bool, __nv_bool, unsigned int, unsigned int) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::__cxx11::string, __nv_bool, int64_t, uint64_t, double, std::allocator, nlohmann::adl_serializer>]" 
(16414): here
            instantiation of "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::dump(int, char, __nv_bool, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::error_handler_t) const [with ObjectType=std::map, ArrayType=std::vector, StringType=std::__cxx11::string, BooleanType=__nv_bool, NumberIntegerType=int64_t, NumberUnsignedType=uint64_t, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer]" 
(22491): here

/home/palebluedot/src/json/single_include/nlohmann/json.hpp(5215): warning: statement is unreachable

/home/palebluedot/src/json/single_include/nlohmann/json.hpp(10716): warning: statement is unreachable

/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2509:151: error: expansion pattern ‘CompatibleObjectType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2509:154: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2509:261: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2509:263: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2534:160: error: expansion pattern ‘ConstructibleObjectType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2534:163: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2534:273: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2534:275: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:196: error: expansion pattern ‘CompatibleStringType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:199: error: template argument 2 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:201: error: template argument 2 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:216: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2567:218: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:205: error: expansion pattern ‘ConstructibleStringType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:208: error: template argument 2 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:210: error: template argument 2 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:225: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2585:227: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2603:147: error: expansion pattern ‘CompatibleArrayType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2603:150: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2603:330: error: template argument 1 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2603:332: error: template argument 3 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2633:432: error: expansion pattern ‘ConstructibleArrayType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2633:435: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:2633:81: error: parse error in template argument list
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9241:11: error: ‘BasicJsonType’ in namespace ‘::’ does not name a type
     friend BasicJsonType;
           ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:474: error: expansion pattern ‘const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>&’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:488: error: expansion pattern ‘ValueType’ contains no argument packs
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:491: error: template argument 4 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:491: error: template argument 5 is invalid
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17306:42: error: parse error in template argument list
     template < typename ValueType, typename std::enable_if <
                                          ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:17319:2: error: expected unqualified-id before ‘=’ token
                    , int >::type = 0 >
  ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp: In instantiation of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iterator nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::begin() [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iterator = nlohmann::detail::iter_impl<nlohmann::basic_json<> >]’:
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:4639:46:   required from ‘bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::end_object() [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8738:26:   required from ‘bool nlohmann::detail::parser<BasicJsonType>::sax_parse_internal(SAX*) [with SAX = nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<> >; BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8629:19:   required from ‘void nlohmann::detail::parser<BasicJsonType>::parse(bool, BasicJsonType&) [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:20726:1:   required from ‘static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::parse(IteratorType, IteratorType, typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t, bool) [with IteratorType = const char*; typename std::enable_if<std::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<_InputIterator>::iterator_category>::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t = std::function<bool(int, nlohmann::detail::parser<nlohmann::basic_json<> >::parse_event_t, nlohmann::basic_json<>&)>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:22544:38:   required from here
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9369:15: error: ‘void nlohmann::detail::iter_impl<BasicJsonType>::set_begin() [with BasicJsonType = nlohmann::basic_json<>]’ is private
     void set_begin() noexcept
               ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18521:1: error: within this context
         result.set_begin();
 ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp: In instantiation of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iterator nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::end() [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::iterator = nlohmann::detail::iter_impl<nlohmann::basic_json<> >]’:
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:4639:52:   required from ‘bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::end_object() [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8738:26:   required from ‘bool nlohmann::detail::parser<BasicJsonType>::sax_parse_internal(SAX*) [with SAX = nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<> >; BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8629:19:   required from ‘void nlohmann::detail::parser<BasicJsonType>::parse(bool, BasicJsonType&) [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:20726:1:   required from ‘static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::parse(IteratorType, IteratorType, typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t, bool) [with IteratorType = const char*; typename std::enable_if<std::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<_InputIterator>::iterator_category>::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t = std::function<bool(int, nlohmann::detail::parser<nlohmann::basic_json<> >::parse_event_t, nlohmann::basic_json<>&)>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:22544:38:   required from here
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9406:6: error: ‘void nlohmann::detail::iter_impl<BasicJsonType>::set_end() [with BasicJsonType = nlohmann::basic_json<>]’ is private
     void set_end() noexcept
      ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18592:1: error: within this context
         result.set_end();
 ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp: In instantiation of ‘IteratorType nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::erase(IteratorType) [with IteratorType = nlohmann::detail::iter_impl<nlohmann::basic_json<> >; typename std::enable_if<(std::is_same<InputIT, nlohmann::detail::iter_impl<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> > >::value || std::is_same<InputIT, nlohmann::detail::iter_impl<const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> > >::value), int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer]’:
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:4643:1:   required from ‘bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::end_object() [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8738:26:   required from ‘bool nlohmann::detail::parser<BasicJsonType>::sax_parse_internal(SAX*) [with SAX = nlohmann::detail::json_sax_dom_callback_parser<nlohmann::basic_json<> >; BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:8629:19:   required from ‘void nlohmann::detail::parser<BasicJsonType>::parse(bool, BasicJsonType&) [with BasicJsonType = nlohmann::basic_json<>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:20726:1:   required from ‘static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::parse(IteratorType, IteratorType, typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t, bool) [with IteratorType = const char*; typename std::enable_if<std::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<_InputIterator>::iterator_category>::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; typename nlohmann::detail::parser<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> >::parser_callback_t = std::function<bool(int, nlohmann::detail::parser<nlohmann::basic_json<> >::parse_event_t, nlohmann::basic_json<>&)>]’
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:22544:38:   required from here
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9830:37: error: ‘nlohmann::basic_json<>* nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_object’ is private
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18087:31: error: within this context
         if (JSON_HEDLEY_UNLIKELY(this != pos.m_object))
                               ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
     internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
                                                                             ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18102:26: error: within this context
                 if (JSON_HEDLEY_UNLIKELY(not pos.m_it.primitive_iterator.is_begin()))
                          ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
     internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
                                                                             ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18122:33: error: within this context
                 result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
                                 ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
     internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
                                                                             ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18122:33: error: within this context
                 result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
                                 ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
     internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
                                                                             ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18128:32: error: within this context
                 result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
                                ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:9832:77: error: ‘nlohmann::detail::internal_iterator<nlohmann::basic_json<> > nlohmann::detail::iter_impl<nlohmann::basic_json<> >::m_it’ is private
     internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
                                                                             ^
/home/palebluedot/src/json/single_include/nlohmann/json.hpp:18128:32: error: within this context
                 result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
                                ^
CMakeFiles/json-test.dir/build.make:62: recipe for target 'CMakeFiles/json-test.dir/matmul.cu.o' failed
make[2]: *** [CMakeFiles/json-test.dir/matmul.cu.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/json-test.dir/all' failed
make[1]: *** [CMakeFiles/json-test.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
@mjcrawford22
Copy link

mjcrawford22 commented Oct 17, 2019

If this is only on the host side, consider using a CMake External Project and linking to your JSON libraries (I have several and use):
...
ExternalProject_Add(${JSON_LIB}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${JSON_LIB}
CMAKE_ARGS ${PASSARGS}} )

If you are supporting it on the GPU side, I had no luck there.

@nlohmann
Copy link
Owner

In order to asses your issue, we need the following information:

  • What is the issue you have?

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

  • What is the expected behavior?

  • And what is the actual behavior instead?

  • Which compiler and operating system are you using? Is it a supported compiler?

  • Did you use a released version of the library or the version from the develop branch?

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

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Oct 21, 2019
@mjcrawford22
Copy link

We are using a Kokkos and ours is only needed on the host; we (eventually) got around this around this by adding the CMake line to specify that this will only run on the host to the nvcc_wrapper
add_compile_options(--host-only)

Currently we are NOT using JSON for GPU/GPU or CPU/GPU communications.

@t-b
Copy link
Contributor

t-b commented Oct 21, 2019

@palebluedot19 What nvcc version are you using? Are you able to compile tests with it?

@mjcrawford22
Copy link

We use nvcc 9.2 as that is the highest that Kokkos supports at this time. I have not tried to run any of the nlohmann tests. We are using only a very limited number of features for input file parsing at this time.

@palebluedot19
Copy link
Author

@palebluedot19 What nvcc version are you using? Are you able to compile tests with it?

It is nvcc 9.0. Yes, I am able to compile tests. I think that tests are compiled using g++/gcc.

@palebluedot19
Copy link
Author

In order to asses your issue, we need the following information:

  • What is the issue you have?
  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
  • What is the expected behavior?
  • And what is the actual behavior instead?
  • Which compiler and operating system are you using? Is it a supported compiler?
  • Did you use a released version of the library or the version from the develop branch?
  • If you experience a compilation error: can you compile and run the unit tests?

I want to the json parser in a source file containing CUDA. So I need to use nvcc to compile the source code. During the compilation, the above error messages pop up. If I remove all the device code and rename the source file with cpp suffix, the code compiles. I have tried nvcc 9.0 and 10.1 on Ubuntu 16.04. Neither of the two works. Here is the hash for the version I used, ce3a76d959f81263f5847392d60d12b4b63f1712. Yes, I can compile and run the unit tests.

@palebluedot19
Copy link
Author

In order to asses your issue, we need the following information:

  • What is the issue you have?
  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
  • What is the expected behavior?
  • And what is the actual behavior instead?
  • Which compiler and operating system are you using? Is it a supported compiler?
  • Did you use a released version of the library or the version from the develop branch?
  • If you experience a compilation error: can you compile and run the unit tests?

Sorry. I sent you wrong hash for the repo. I used the version in develop branch. Sorry again for my mistake on the version.

@stale
Copy link

stale bot commented Nov 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Nov 21, 2019
@b-v
Copy link

b-v commented Nov 21, 2019

Related to #1347.

@stale stale bot removed the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Nov 21, 2019
@nlohmann
Copy link
Owner

I am not using nvcc myself, so I may have tried the wrong thing. But I can compile and run the test suite on macOS with

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:34:12_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89

with

CXX=/Developer/NVIDIA/CUDA-10.2/bin/nvcc make check

(after removing all but -std=c++11 from CXXFLAGS).

@stale
Copy link

stale bot commented Dec 22, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Dec 22, 2019
@stale stale bot closed this as completed Dec 29, 2019
@minitu
Copy link

minitu commented Aug 21, 2020

Was this issue ever fixed? I'm encountering the same issue with 3.9.1 (CUDA 10.1), when a .cu file that includes json.hpp is compiled with nvcc (or nvcc -x cu).

@palebluedot19
Copy link
Author

@minitu I could not find a way to solve it. What I did is putting CUDA source files in a separate compilation unit. I call the kernel through a driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question state: needs more info the author of the issue needs to provide more details state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

6 participants