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

Crash- signal SIGSEGV, Segmentation fault. ../sysdeps/x86_64/strlen.S: No such file or directory. #411

Closed
AnnapoorniS opened this issue Apr 27, 2018 · 6 comments

Comments

@AnnapoorniS
Copy link

AnnapoorniS commented Apr 27, 2018

Hi,

Using json-c release version json-c-0.13-20171207

While trying to access the method json_object_get_string () the program crashes.
It internally uses strlen() and the string value in the jon_object is not NULL.
Whilr trying to backtrace the call was like this:
Core was generated by `./testjsonc'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: No such file or directory.
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
1 0x00007f46ecfa08d0 in json_object_nget_value ()
2 0x00007f46ecfa307c in json_object_get_value ()
3 0x00007f46ecfa30a1 in json_object_get_string ()

OS: Ubuntu 14.04

Kindly help fixing this as soon as possible.

Thanks in advance.

@hawicz
Copy link
Member

hawicz commented Apr 28, 2018

json_object_nget_value does not exist in json-c.

You either have the wrong json library linked in (Parson, perhaps?), or possibly two conflicting ones.

@AnnapoorniS
Copy link
Author

Yes my application uses json-c and another third-party application uses parson. Will these two conflict each other. I need both to be present in my machine.

@AnnapoorniS
Copy link
Author

Why is it conflicting I have installed this json-c version separately. What is the point in conflicting with another library.

@rgerhards
Copy link
Contributor

I guess you need to talk to the parson folks, as this error seems to come up with parson - at least this is how I understood @hawicz

@ploxiln
Copy link
Contributor

ploxiln commented Apr 28, 2018

Both json-c and parson define the function json_object_get_string() (and a few others). When it comes time to link your compiled c or c++ objects together, to the libraries you use, to create an executable, the linker links to the wrong json_object_get_string() in some places. You can't really simultaneously link to two libraries which offer different versions of the same symbol (e.g. function), at least without some very complicated and advanced tricks.

@hawicz
Copy link
Member

hawicz commented Apr 29, 2018

If you're not explicitly linking against parson in your application, my guess is that some library that you're using, possibly indirectly, is linking against that other json library. If you actually need both, there's no easy solution. One possible way to handle it would be to split your app into two pieces, one that uses json-c and one that uses parson, then define some way for the two piece to communicate.
Alternately, you could create a local, hacked up copy of either json-c or parson that renames every symbol in some way, then rebuilt everything to use the renamed symbols (i.e. through things like #define json_object_get_string _foo_json_object_get_string, etc...)
Without a hugely backwards-compatibility-breaking change that would affect every other user of json-c, there's not really much we can do to help here. Sorry.

@hawicz hawicz closed this as completed Apr 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants