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 #178

Closed
harishmurkal opened this issue Apr 29, 2019 · 7 comments
Closed

Compilation issue #178

harishmurkal opened this issue Apr 29, 2019 · 7 comments
Labels

Comments

@harishmurkal
Copy link

Hi,

I am considering your software for the first time. I have taken the latest release Release 0.123.2.
I am getting this following error of re-definition. When fixing by removing one of the definition I'm getting other consequential errors. Just wanted to know if any flags as such available for overcoming this issue?

Thanks and Regards,
Harish M

Compilation log snippet:

Scanning dependencies of target Nim_UT
[ 94%] Building CXX object CMakeFiles/Nim_UT.dir/imsgit_local/work/harism/reg/5g_core/ngnim/src/NIM_NfNotification.cxx.o
In file included from /imsgit_local/work/harism/reg/5g_core/ngnim/jsoncons/include/jsoncons/json_exception.hpp:13:0,
from /imsgit_local/work/harism/reg/5g_core/ngnim/jsoncons/include/jsoncons/basic_json.hpp:26,
from /imsgit_local/work/harism/reg/5g_core/ngnim/jsoncons/include/jsoncons/json.hpp:10,
from /imsgit_local/work/harism/reg/5g_core/ngnim/src/NIM_NfNotification.cxx:20:
/imsgit_local/work/harism/reg/5g_core/ngnim/jsoncons/include/jsoncons/unicode_traits.hpp:1482:12: error: specialization of ‘std::is_error_code_enumjsoncons::unicons::conv_errc’ after instantiation
struct is_error_code_enumjsoncons::unicons::conv_errc : public true_type
^
/imsgit_local/work/harism/reg/5g_core/ngnim/jsoncons/include/jsoncons/unicode_traits.hpp:1482:12: error: redefinition of ‘struct std::is_error_code_enumjsoncons::unicons::conv_errc’
In file included from /imsgit/Tools/tsp_tools/CONTAINER_TOOLSET/toolset_CENTOS/usr/include/c++/4.8.2/mutex:43:0,

from /imsgit_local/work/harism/reg/ims_tools/grpc/protobuf/include/google/protobuf/stubs/mutex.h:33,
from /imsgit_local/work/harism/reg/ims_tools/grpc/protobuf/include/google/protobuf/stubs/common.h:52,
from /imsgit_local/work/harism/reg/5g_core/nimrpc/inc/NimDiscovery.pb.h:9,
from /imsgit_local/work/harism/reg/5g_core/nimrpc/inc/NimDiscovery.grpc.pb.h:22,
from /imsgit_local/work/harism/reg/5g_core/ngnim/inc/NIM_GrpcHandler.h:12,
from /imsgit_local/work/harism/reg/5g_core/ngnim/inc/NIM_Framework.h:16,
from /imsgit_local/work/harism/reg/5g_core/ngnim/src/NIM_NfNotification.cxx:6:
/imsgit/Tools/tsp_tools/CONTAINER_TOOLSET/toolset_CENTOS/usr/include/c++/4.8.2/system_error:54:12: error: previous definition of ‘struct std::is_error_code_enumjsoncons::unicons::conv_errc’
struct is_error_code_enum : public false_type { };

@danielaparker
Copy link
Owner

danielaparker commented Apr 29, 2019

This is the first time we've had a report of a duplicate symbol, so I need to understand this better. Could you send me your full error log, to [email protected]?

When you say, "removing one of the definitions", do you mean removing these lines, in unicode_traits.hpp?

#ifndef JSONCONS_UNICONS_UNICODE_TRAITS_HPP
#define JSONCONS_UNICONS_UNICODE_TRAITS_HPP

#include <system_error>

// HERE
namespace std {
    template<>
    struct is_error_code_enum<jsoncons::unicons::conv_errc> : public true_type
    {
    };
    template<>
    struct is_error_code_enum<jsoncons::unicons::encoding_errc> : public true_type
    {
    };
}
#endif

That's the only place these symbols are defined, and I believe those are legal declarations. Similar declarations are used for error codes, e.g.

#ifndef JSONCONS_JSON_ERROR_HPP
#define JSONCONS_JSON_ERROR_HPP

#include <system_error>

namespace std {
    template<>
    struct is_error_code_enum<jsoncons::json_errc> : public true_type
    {
    };
}

#endif

Are you also getting redefinition errors for these?

We're currently testing linux builds on ubuntu, I'll look into setting up a build project on centos.

The specializations of is_error_code_enum in the std namespace are a convenience, but the code could
be rewritten without them, so if that's the only issue, we could look into that.

Daniel

@danielaparker
Copy link
Owner

I would need your help to pursue this further. Absent that, there's not much I can do.

@patternoia
Copy link
Contributor

Dear Daniel,
I am getting very similar compilation error in c++ (Debian 4.9.2-10+deb8u2) 4.9.2. Compiling it in clang 8 (Apple LLVM version 8.0.0 (clang-800.0.42.1)) works just fine.
When I am commenting out the is_error_code_enum<jsoncons::unicons::conv_errc> : public true_type block, the compilation succeeds, I am not sure however if it will have any side effects.
I am using jsoncons version 0.122.0, upgrading to 0.133.0 does not help.

I am sending you the log files over the email.

@danielaparker danielaparker reopened this Sep 16, 2019
@danielaparker
Copy link
Owner

danielaparker commented Sep 16, 2019

Thanks, reopening this issue, will investigate. If it compiles, there shouldn't be any issue from commenting out the line, it's purpose is only to indicate that the type jsoncons::unicons::conv_errc is eligible for automatic conversion to std::error_code. What I don't understand is why we have two reported issues with is_error_code_enum<jsoncons::unicons::conv_errc>, but not with similar declarations in the library. But will look at it.

@danielaparker
Copy link
Owner

danielaparker commented Sep 17, 2019

Hi patternoia,

Could you take master, and rebuild in Debian 4.9.2 environment? Or if you prefer, just replace jsoncons/unicode_traits.hpp with https://raw.githubusercontent.com/danielaparker/jsoncons/master/include/jsoncons/unicode_traits.hpp. Let me know if you still have the compilation error?

Thanks,
Daniel

@patternoia
Copy link
Contributor

Hi Daniel, this fixes it. Thanks a lot for quick response.

@danielaparker
Copy link
Owner

Resolved in v0.134.0

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

No branches or pull requests

3 participants