Issue in ofxTwitter addon on armv7 (Odroid U3)

i would transfer my project that i’m developing on linux64 to my Odroid, it use the ofxTwitter addon, and i try the simple search example from this addon to test, it compile fine, but when i run it works, but when it recieve some json data it crash. i attach the log running gdb ( in this case neither it start,):

gdb ./example-search
GNU gdb (GDB) 7.6.1-ubuntu
Copyright © 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “arm-linux-gnueabihf”.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/
Reading symbols from /home/odroid/of_v0.8.0_linuxarmv7l_release/addons/ofxTwitter/example-search/bin/example-search…(no debugging symbols found)…done.
(gdb) run
Starting program: /home/odroid/of_v0.8.0_linuxarmv7l_release/addons/ofxTwitter/example-search/bin/./example-search
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/arm-linux-gnueabihf/libthread_db.so.1”.

Program received signal SIGILL, Illegal instruction.
0xb6e043c8 in ?? () from /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb)

It fails also if i want to load previous query from disk, it start to load and then it crash, @pelayo maybe the problem is in json? or need to be threaded?

this runnig wotout gdb

//after json transfer
[notice ] ofxTwitter::newResponse: Tweets received.
[notice ] ofxTwitter::parseResponse: (10) Tweets ready
Segmentation fault (core dumped)
make: *** [run] Error 139

Using @bakercp’s fork of ofxJSON and building/running example-twitter, I get the same result:

odroid@odroid:~/sandbox/openFrameworks/openFrameworks/addons/ofxJSON/example-twitter/bin$ gdb example-twitter 
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/odroid/sandbox/openFrameworks/openFrameworks/addons/ofxJSON/example-twitter/bin/example-twitter...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/odroid/sandbox/openFrameworks/openFrameworks/addons/ofxJSON/example-twitter/bin/example-twitter 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xb6eb43c8 in ?? () from /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) bt
#0  0xb6eb43c8 in ?? () from /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
Cannot access memory at address 0x0
#1  0xb6eb2090 in OPENSSL_cpuid_setup () from /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
#2  0xb6feb028 in call_init (env=0xbefff09c, argv=0xbefff094, argc=1, l=<optimized out>)
    at dl-init.c:84
#3  call_init (l=<optimized out>, argc=1, argv=0xbefff094, env=0xbefff09c) at dl-init.c:34
#4  0xb6feb0a8 in _dl_init (main_map=0xb6fff958, argc=1, argv=0xbefff094, env=0xbefff09c)
    at dl-init.c:133
#5  0xb6fe0c62 in _dl_start_user () from /lib/ld-linux-armhf.so.3
#6  0xb6fe0c62 in _dl_start_user () from /lib/ld-linux-armhf.so.3
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

It would seem that loading libcrypto causes this, no?

I have been working with ofxTwitter lately and i had a similar problem. In my case it was crashing because of emojis :smile:

try this when receiving the string:

not sure if that is your problem though…

thank you for the answer @pizthewiz and @JordiPuig, i can imagine that is something related to strings but i have no idea how to solve. @JordiPuig where i had to put your code in your opinion?

Some news: i have this issue only with searchStatus but if i postStaus it works without crash i have just send a tweet from my Odroid!
i need more testing… this is good for my project, at least, most important things i can send tweets.

I would put that code right after receiving the string. It will return the same string without emojis.
do something like:

for(int j=0; j<str.size();j++){
	string s;
	s= str[j];
	string parsed;
	parsed = parseString(s);
}

where parsed will be a safe string to use.

Example here:

It might be a very slow method but it is totally ok for Tweets :wink:
Just try it and see if it works.

Hmm, I don’t think this is related to emoji handling. For me, all the examples that make network requests hit the same SIGILL on launch: example-flickr, example-nytimes, example-stock and example-twitter. Only the example that uses a local JSON file, example-file runs.

It almost seems as though the networking used by the SIGILL’ing examples, that is what ropes in libcrypto which has the bad instruction, no?

Maybe you are right @pizthewiz but why i have the issue only while searching status? Even when i send a tweet (when i post a status) should receive a Json file? i will try the @JordiPuig method, we have nothing to loose…

My error, apparently OpenSSL tests CPU capabilities and installs its own signal handler - the SIGILL is an expected part of that. Here is a backtrace of example-twitter that shows a SIGSEGV in ofURLFileLoader::handleRequest(ofHttpRequest):

odroid@odroid:~/sandbox/openFrameworks/openFrameworks/addons/ofxJSON/example-twitter$ gdb bin/example-twitter 
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/odroid/sandbox/openFrameworks/openFrameworks/addons/ofxJSON/example-twitter/bin/example-twitter...(no debugging symbols found)...done.
(gdb) r
Starting program: /home/odroid/sandbox/openFrameworks/openFrameworks/addons/ofxJSON/example-twitter/bin/example-twitter 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xb6eb43c8 in ?? () from /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) c
Continuing.
Cannot access memory at address 0x0
[New Thread 0xb6418300 (LWP 12226)]
[New Thread 0xb5c18300 (LWP 12227)]

Program received signal SIGSEGV, Segmentation fault.
0xb6a861f8 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) ()
   from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
(gdb) bt
#0  0xb6a861f8 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) ()
   from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#1  0x00085d10 in ofURLFileLoader::handleRequest(ofHttpRequest) ()
#2  0x000860e8 in ofURLFileLoader::get(std::string) ()
#3  0x0008613e in ofLoadURL(std::string) ()
#4  0x00075eb6 in ofxJSONElement::openRemote(std::string const&) ()
#5  0x00075850 in exampleApp::setup() ()
#6  0x0008a05a in Poco::PriorityDelegate<ofBaseApp, ofEventArgs, false>::notify(void const*, ofEventArgs&) ()
#7  0x0008e13a in Poco::PriorityStrategy<ofEventArgs, Poco::AbstractPriorityDelegate<ofEventArgs> >::notify(void const*, ofEventArgs&) ()
#8  0x0008ecbe in void ofNotifyEvent<ofEvent<ofEventArgs>, ofEventArgs>(ofEvent<ofEventArgs>&, ofEventArgs&) ()
#9  0x0008cc58 in ofAppGLFWWindow::runAppViaInfiniteLoop(ofBaseApp*) ()
#10 0x00089030 in ofRunApp(ofBaseApp*) ()
#11 0x00040c90 in main ()
(gdb) 

Perhaps this explains why example-file works, it uses ofxJSONElement::open(std::string)?

Yeah, even threadedImageLoaderExample crashes for me with the same backtrace on the ODROID-U3.

(gdb) r
Starting program: /home/odroid/sandbox/openFrameworks/openFrameworks/examples/addons/threadedImageLoaderExample/bin/threadedImageLoaderExample 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xb6eb43c8 in ?? () from /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) c
Continuing.
Cannot access memory at address 0x0
[New Thread 0xb6418300 (LWP 13510)]
[New Thread 0xb5c18300 (LWP 13511)]
[New Thread 0xb4eff300 (LWP 13512)]
[New Thread 0xb44ff300 (LWP 13513)]
[verbose] ofURLFileLoader: threadedFunction(): starting thread
[verbose] ofURLFileLoader: threadedFunction(): querying request image2
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition
[verbose] ofURLFileLoader: start(): signaling new request condition

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb44ff300 (LWP 13513)]
0xb6a861f8 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) ()
   from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
(gdb) bt
#0  0xb6a861f8 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) ()
   from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#1  0x0007ae1c in ofURLFileLoader::handleRequest(ofHttpRequest) ()
#2  0x0007b436 in ofURLFileLoader::threadedFunction() ()
#3  0x000785c4 in ofThread::run() ()
#4  0x000dbd58 in Poco::ThreadImpl::runnableEntry(void*) ()
#5  0xb6b4ee64 in start_thread (arg=0xb44ff300) at pthread_create.c:313
#6  0xb691dc28 in ?? ()
    at ../ports/sysdeps/unix/sysv/linux/arm/nptl/../clone.S:96
   from /lib/arm-linux-gnueabihf/libc.so.6
#7  0xb691dc28 in ?? ()
    at ../ports/sysdeps/unix/sysv/linux/arm/nptl/../clone.S:96
   from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 

In case it helps (forget where I got this) try putting this in gdb

handle SIGILL nostop

before you run the app

Ahh thanks for the bit of gdb wizardry, I’ll see if I can step into ofURLFileLoader::handleRequest(ofHttpRequest and better figure out why it blows up. I filed the issue SIGSEGV in ofURLFileLoader::handleRequest(ofHttpRequest) on ODROID-U3/Xubuntu 13.10 to keep track of this as well.

In case y’all aren’t following along with #2823, early indications suggest this might be a Poco issue that is resolved by updating Poco…

@pizthewiz great! so it will be solved…

i am also trying to get ofxTwitter running on armv7, more specifically raspberry pi 2.
but ofxOAuth does not compile.
on my mac ofxOAuth only complies with the 32 bit setting. (OF 0.9.0 OS X 10.10)
i was hoping that might be a simple Curl or ofHttp way of querying twitter.

thx.