Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Link step of libMediaPlayer.so unsuccessful due to not finding lintl #381

Closed
2 of 8 tasks
thevamad opened this issue Dec 8, 2017 · 48 comments
Closed
2 of 8 tasks

Comments

@thevamad
Copy link

thevamad commented Dec 8, 2017

What version of the AVS Device SDK are you using?

1.2.1

Briefly summarize your issue:

libMediaPlayer.so link step failed due to not being able to find lintl

[ 60%] Linking CXX shared library libMediaPlayer.so
/home/niux/Desktop/alexa/qsdk3/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lintl
collect2: error: ld returned 1 exit status
MediaPlayer/src/CMakeFiles/MediaPlayer.dir/build.make:279: recipe for target 'MediaPlayer/src/libMediaPlayer.so' failed

What is the expected behavior?

What behavior are you observing?

Provide the steps to reproduce the issue, if applicable:

Tell us about your environment:

Cross compiling for OpenWRT MIPS

Tell us what hardware you're using:

  • Desktop / Laptop
  • Raspberry Pi
  • Other - tell us more: Cross compiling for OpenWRT MIPS

Tell us about your OS (Type & version):

  • Linux
  • MacOS
  • Raspbian Stretch
  • Raspbian Jessie
  • Other - tell us more: OpenWRT Qualcomm QSDK
@scotthea-amazon
Copy link
Contributor

Hello thevamad,

What platform are you running your cross compiler on?

Are you sure that libintl is installed? If not, this link may be helpful: what is libintl and where can I get it?.

If you are sure it is installed, you may just need to add it to the link path.

I hope this helps,
-SWH

@thevamad
Copy link
Author

thevamad commented Dec 12, 2017

Crosscompiler runs on an Ubuntu 16 virtual machine.
root@OpenWrt:~# cat /proc/version
Linux version 3.14.0 (niux@ubuntu) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.01 r40838) ) #1 Thu Jan 11 06:45:47 PST 2018

@sanjayrd
Copy link
Contributor

Hi @thevamad,

Unfortunately, we haven't cross-compiled for OpenWRT so it's hard to help out in depth without actually having done the compilation. Could you run a make with the flags VERBOSE=1 or V=1 to get some more information?

Thanks,
Sanjay

@thevamad
Copy link
Author

I managed to get past this problem to get it to compile fully yesterday afternoon. I had to use the following directive in the CMakeLists.txt. There are 2 places where libintl.so was being generated. One was from gettext and another from a standard C library (I think). I had previously tried linking one and linking the other worked. Before I had also tried several relative paths off an environment variable.. Anyhow, the following worked.

I would prefer not to change this file as it is downloaded as part of the build process and will try to instead incorporate this in as a patch. This is my first attempt at building something on Linux so I'm still trying to figure things out.

set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")
add_definitions(-D_GLIBCXX_USE_C99=1)
link_directories("/home/niux/Desktop/alexa/qsdk3/staging_dir/target-mips_34kc_uClibc-0.9.33.2/root-ar71xx/usr/lib" "/home/niux/Desktop/alexa/qsdk3/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/lib")

Thanks for looking into it!
Madhu

@thevamad
Copy link
Author

@sanjayrd : When I run sampleapp on the hardware I get a "Bus error" .. Do you happen to know what I might be missing ? I tried searching for the error in the source code but I dont see any hits. Does it have to do with a dependency ?

@sanjayrd
Copy link
Contributor

Hi @thevamad,

What is the Bus error you are seeing? Are there additional details? If not, when you launch the SampleApp, you can also try setting the environment variable GST_DEBUG=[1,2,3,4, or 5] to see more GStreamer logs.

Thanks,
Sanjay

@thevamad
Copy link
Author

root@OpenWrt:/usr/bin# TZ=UTC ./SampleApp AlexaClientSDKConfig.json
Bus error

Even if I dont supply the additional arguments, the same thing happens (I would have expected a printf to trigger). So, I just have to set GST_DEBUG=5 and then run SampleApp ? I dont see anything different :(

@ryan-esty
Copy link

@thevamad ,
Did you try a ldd on the SampleApp? It sounds like something got built wrong.

Ryan

@thevamad
Copy link
Author

That is what I get. Can you please tell me what got built wrong based on the output below ?
Also, it would be really helpful to know what subset of gstreamer plug-ins are required for the sample app.. I dont have a lot of space to play with on my target (limited to 16MB).
root@OpenWrt:/usr/bin# ldd SampleApp
libatomic.so.1 => /usr/lib/libatomic.so.1 (0x76fe1000)
libDefaultClient.so => /usr/lib/libDefaultClient.so (0x76fb7000)
libAuthDelegate.so => /usr/lib/libAuthDelegate.so (0x76f95000)
libMediaPlayer.so => /usr/lib/libMediaPlayer.so (0x76f55000)
libportaudio.so.2 => /usr/lib/libportaudio.so.2 (0x76f1f000)
librt.so.0 => /lib/librt.so.0 (0x76f0b000)
libpthread.so.0 => /lib/libpthread.so.0 (0x76ee5000)
libasound.so.2 => /usr/lib/libasound.so.2 (0x76e03000)
libACL.so => /usr/lib/libACL.so (0x76dae000)
libAIP.so => /usr/lib/libAIP.so (0x76d6b000)
libADSL.so => /usr/lib/libADSL.so (0x76d39000)
libAFML.so => /usr/lib/libAFML.so (0x76d11000)
libAlerts.so => /usr/lib/libAlerts.so (0x76c83000)
libAudioResources.so => /usr/lib/libAudioResources.so (0x76b54000)
libCertifiedSender.so => /usr/lib/libCertifiedSender.so (0x76b29000)
libPlaybackController.so => /usr/lib/libPlaybackController.so (0x76b02000)
libSpeakerManager.so => /usr/lib/libSpeakerManager.so (0x76aba000)
libSpeechSynthesizer.so => /usr/lib/libSpeechSynthesizer.so (0x76a68000)
libSettings.so => /usr/lib/libSettings.so (0x76a2b000)
libSQLiteStorage.so => /usr/lib/libSQLiteStorage.so (0x76a12000)
libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x76941000)
libTemplateRuntime.so => /usr/lib/libTemplateRuntime.so (0x7690b000)
libAudioPlayer.so => /usr/lib/libAudioPlayer.so (0x768a3000)
libAVSSystem.so => /usr/lib/libAVSSystem.so (0x7687b000)
libContextManager.so => /usr/lib/libContextManager.so (0x76852000)
libgstapp-1.0.so.0 => /usr/lib/libgstapp-1.0.so.0 (0x76835000)
libgstbase-1.0.so.0 => /usr/lib/libgstbase-1.0.so.0 (0x767c3000)
libgstreamer-1.0.so.0 => /usr/lib/libgstreamer-1.0.so.0 (0x76697000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x76653000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x76539000)
libintl.so.8 => /usr/lib/libintl.so.8 (0x76521000)
libPlaylistParser.so => /usr/lib/libPlaylistParser.so (0x764ee000)
libAVSCommon.so => /usr/lib/libAVSCommon.so (0x76455000)
libcurl.so.4 => /usr/lib/libcurl.so.4 (0x7640f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x76326000)
libm.so.0 => /lib/libm.so.0 (0x76300000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x762dc000)
libc.so.0 => /lib/libc.so.0 (0x76239000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x76ff6000)
libdl.so.0 => /lib/libdl.so.0 (0x76225000)
libiconv.so.2 => /usr/lib/libiconv.so.2 (0x7620e000)
libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x761fb000)
libffi.so.6 => /usr/lib/libffi.so.6 (0x761e8000)
libmbedtls.so.9 => /usr/lib/libmbedtls.so.9 (0x76192000)

@sanjayrd
Copy link
Contributor

sanjayrd commented Dec 15, 2017

For GStreamer Logging:

GST_DEBUG=3 TZ=UTC ./SampleApp AlexaClientSDKConfig.json

For SDK Logging:

TZ=UTC ./SampleApp AlexaClientSDKConfig.json debug9

@thevamad
Copy link
Author

Sorry I was out of the office yesterday. Still no luck.. I get the same bus error. I dont believe anything is actually running. So it might be a compile issue like Ryan suggested.

@ryan-esty
Copy link

@thevamad if you have strace on the target you could try to put strace in front you you will see which system call causes the bus error. Even if you don't have strace it is pretty strait forward to cross compile it and it is small. There will be a ton of output but it will prove if the SampleApp is running or not.

Ryan

@thevamad
Copy link
Author

@ryan-esty : I will try strace now. Thanks so much for the suggestion.

@thevamad
Copy link
Author

@ryan-esty :
Makefile.txt

That helped. I'm new to linux and OpenWRT. Looks like the SampleApp executable is looking for library dependencies using a hardcoded path on my virtual machine that I used to build the code. I have my Makefile recipe attached. Do you know what I should do to make it look under /usr/lib ? Sorry if it is an obvious question. Never done this before.

Part of the output from the stace is below.

root@OpenWrt:/usr/lib# strace SampleApp
execve("/usr/bin/SampleApp", ["SampleApp"], [/* 9 vars */]) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x778e8000
stat("/etc/ld.so.cache", 0x7fadf0e0) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/staging_dir/target-mips_34kc_uClibc-0.9.33.2/root-ar71xx/usr/lib/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/ApplicationUtilities/DefaultClient/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/AuthDelegate/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/MediaPlayer/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/ACL/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/AIP/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/ADSL/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/AFML/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/Alerts/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/ApplicationUtilities/Resources/Audio/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CertifiedSender/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/PlaybackController/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/SpeakerManager/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/SpeechSynthesizer/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/Settings/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/Storage/SQLiteStorage/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/TemplateRuntime/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/AudioPlayer/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/CapabilityAgents/System/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/ContextManager/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/PlaylistParser/src/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/niux/Desktop/alexa/qsdk3/build_dir/target-mips_34kc_uClibc-0.9.33.2/avs-v1.2.1/build/AVSCommon/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libatomic.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libatomic.so.1", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=15208, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x778e5000
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0\21\320\0\0\0004"..., 4096) = 4096

@ryan-esty
Copy link

@thevamad It does find libatomic as here in the strace "open("/usr/lib/libatomic.so.1", O_RDONLY) = 3" then it does a couple more things and gets a bus error just after the read. I'm assuming at the end of the mess is a bus error at least.

A bus error could be a miss aligned structure. Now that we know it is running could you possibly try gdb on it? I don't know if you have the room to use gdb on the target or not but if not you might need to look into gdbstub. It doesn't look like it is getting very far though. It seems it is still reading the executable into memory.

Ryan

@thevamad
Copy link
Author

Thanks for getting back! Okay. I will look into gdb.

@anu-mathur
Copy link

hi @thevamad

Can we talk more about your use case with the AVS Device SDK? Please fill out this Contact Form and I will get in touch with you.
Thanks

@mradulan
Copy link
Contributor

@thevamad any updates on the issue?

@thevamad
Copy link
Author

thevamad commented Jan 2, 2018

Sorry I was out of the office for a while during my break. I switched up my makefile a bit to copy the library dependencies instead of using the install command (was a copy paste error)..

I am currently trying this patch for a missing libatomic package issue. https://lists.openwrt.org/pipermail/openwrt-devel/2014-March/024286.html to fix a different dependency issue. Will keep you guys posted.
@anu-mathur : I filled out the contact form

@thevamad
Copy link
Author

thevamad commented Jan 4, 2018

@sanjayrd , @ryan-esty : The bus errors are still present and they appear to happen due to a SIGKILL.. Any idea what I should do? I rebuilt this with DEBUG instead of minsizerel. It is to note that I am building this without a keyword detector and the gcc version is 4.8.3.

fstat(3, {st_mode=S_IFREG|0644, st_size=78728, ...}) = 0
close(3) = 0
open("/lib/libc.so.0", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=392456, ...}) = 0
close(3) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x77ec2000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x77ebe000
set_thread_area(0x77ec9950) = 0
mprotect(0x77df5000, 4096, PROT_READ) = 0
mprotect(0x772c8000, 28672, PROT_READ) = 0
mprotect(0x7719d000, 4096, PROT_READ) = 0
mprotect(0x77ec4000, 4096, PROT_READ) = 0
mprotect(0x7712d000, 4096, PROT_READ) = 0
set_tid_address(0x77ec2578) = 1619
set_robust_list(0x77ec2580, 12) = 0
rt_sigaction(SIGRT_0, {0x8, [RT_77 RT_79 RT_80 RT_83 RT_84 RT_86 RT_87 RT_88 RT_89 RT_90 RT_91 RT_93 RT_94 RT_95], SA_RESTART|SA_INTERRUPT|SA_NODEFER|SA_NOCLDWAIT|0x7dcf9f4}, NULL, 16) = 0
rt_sigaction(SIGRT_1, {0x10000008, [RT_77 RT_79 RT_80 RT_83 RT_84 RT_86 RT_87 RT_88 RT_89 RT_90 RT_91 RT_93 RT_94 RT_95], SA_RESTART|SA_INTERRUPT|SA_NODEFER|SA_NOCLDWAIT|0x7dcf8d0}, NULL, 16) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_0 RT_1], NULL, 16) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=2147483647}) = 0
ioctl(0, TIOCNXCL, {B115200 opost isig icanon echo ...}) = 0
ioctl(1, TIOCNXCL, 0x7fc8c618) = -1 ENOTTY (Inappropriate ioctl for device)
brk(0) = 0x9c0000
brk(0x9c1000) = 0x9c1000
futex(0x772d6860, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x772d6868, FUTEX_WAKE_PRIVATE, 2147483647) = 0
--- SIGBUS {si_signo=SIGBUS, si_code=SI_KERNEL, si_addr=0} ---
+++ killed by SIGBUS +++

@ryan-esty
Copy link

@thevamad ,
Is this still right at start up? Can you run gdb with it? I still would imagine something is being built wrong.

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 4, 2018

Yes - This is right at startup. I am looking to get gdb on my system.. I thought the gcc version (min required was 4.8.5 but my cross compiler is at 4.8.3) might have been an issue so I am spending some time on that as well.

@ryan-esty
Copy link

@thevamad ,
Since you are using an older cross tool are you also using an older kernel?

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 4, 2018

Is this what you area looking for?

root@OpenWrt:~# cat /proc/version
Linux version 3.14.0 (niux@ubuntu) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.01 r40838) ) #3 Wed Jan 3 12:35:10 PST 2018

root@OpenWrt:~# cat /proc/cpuinfo
system type : Qualcomm Atheros QCA9533 rev 2
machine : Qualcomm Atheros CUS531 dual reference board
processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 432.53
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

@ryan-esty
Copy link

@thevamad ,

There is a kernel bug that was around that era for private futex's in particular which is where you are dying. It might be something to look into also. I don't think the fix made it into 3.14.0 but you would have to look torvalds/linux@76835b0. If you have the kernel source you might be able to just look at the file, looks to be a 2 line change.

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 4, 2018

@ryan-esty : thank you so much. that bug fix (default snippet ) wasnt in there! I'm recompiling now. Will keep you posted. I'm a bit new to Linux so I really appreciate you taking the time to help me out with this! :)

@ryan-esty
Copy link

@thevamad ,

Good luck. I still am not sure if it is the issue or not but it probably won't hurt.

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 4, 2018

Thanks. I did a dirclean/ clean/ just in case and the build is taking forever.. Will let you know!

@thevamad
Copy link
Author

thevamad commented Jan 5, 2018

:( Same problem .. I changed threadmonitor to get around an issue based on one of the recommendations in a different issue. Does this look okay? Could I have caused the error by making this change?

@thevamad
Copy link
Author

thevamad commented Jan 5, 2018

@ryan-esty
Copy link

@thevamad ,
Not sure if I can help with that one. I'm not an amazon guy and didn't write that code. @mradulan might be better to ask. Do you have a link as to why you changed the code? If you are getting a sig_bus it screams of some sort of memory alignment issue. Also based on that comment I wouldn't recommend the change you did. It appears they really want per thread access and management and taking that thread_local off in the header file I believe prevents that. Since you have a static object m_threadMoniker I believe is available to all threads not just to the thread running, which might not be good.

The other issue is in m_moniker I don't think they were expecting an empty string but some hex number.

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 5, 2018

@ryan-esty : Thanks!

@mradulan :
Per #56
"If you do not generally care about thread IDs in your log messages you could also change the code to return an empty string." Is my change okay to do the way I did it ... It said on the other issue that this wasnt important to the functionality of the SDK so I didnt bother looking into what it was doing and simply returned the empty string.

@ryan-esty
Copy link

@thevamad,

I guess that #56 is pretty accurate. Is this the only thing you changed? If you can cross compile gdbstubs and do a remote connection with gdb it might be useful. It could point to the actual file in question. Sure would be easier than trying to run gdb natively if you don't have the space for it.

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 5, 2018

Okay! gdb stub it is..

Yeah those are the only 2 code files I changed.
Also made some changes to CMakeLists.txt to get a couple of C functions to work right.
set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")
add_definitions(-D_GLIBCXX_USE_C99=1)
link_directories("/home/niux/Desktop/alexa/qsdk3/staging_dir/target-mips_34kc_uClibc-0.9.33.2/root-ar71xx/usr/lib" "/home/niux/Desktop/alexa/qsdk3/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/lib")
include_directories("${STAGING_DIR}/usr/include/gstreamer-1.0/gst")
include_directories("${STAGING_DIR}/usr/include/glib-2.0" )

@thevamad
Copy link
Author

thevamad commented Jan 5, 2018

I tried all day today without success to run gdb / gdb server ... (no space) Will try gdb stubs next. Thanks!

@thevamad
Copy link
Author

thevamad commented Jan 8, 2018

@ryan-esty : Will cross compiling this one work ? https://github.com/avatarone/avatar-gdbstub

@ryan-esty
Copy link

@thevamad,
Try following this guide since you are using the openwrt platform https://wiki.openwrt.org/doc/devel/gdb. You might already have it on your target. I misspoke and it should be called gdbserver not gdb stubs.

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 8, 2018

So only run gdb-server on the target and run gdb from a different host system, correct?
I shall try that.
On Friday, I followed that guide exactly and I was running out of space and the build process wouldnt warn me about it. (https://stackoverflow.com/questions/39560857/missing-gdbserver-binary-in-openwrt-lede/39562240) ...

@ryan-esty
Copy link

@thevamad,

Yes you start your program with gdbserver and then run gdb on the host to connect to the gdbserver on the target. You will use gdb on the host to run and step and everything a debugger does. Your issue is so early on I'm hoping it isn't too early for gdb/gdbserver to catch it. It looks like some sort of object is being created as a global and blowing up.

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 9, 2018

@ryan-esty : I'm not able to even get the gdb-server to fit. When I build with gdb-server, there is no corresponding binary for the part I'm working on. Will the gdb stub (what you'd mentioned before) be an option ?

@ryan-esty
Copy link

@thevamad,

This is a long and hard battle just to get to the point where you might be able to see which file is causing the sig-bus. The gdbstub won't hurt I don't think it will be hard to cross compile. It does mention it works with the serial protocol, which I'm hoping will work just like gdbserver and can run over ssh. The other thing you could do is do a sshfs mount if your kernel supports it or some other network mount. This will give you some more space. Might be enough space to just put gdb on there. Like I said previously I'm hoping that gdb, gdbserver or gdb stubs will give you some lead as to what file is causing the sigbus, because I have no other experience finding a startup issue like this.

Ryan

@thevamad
Copy link
Author

thevamad commented Jan 11, 2018

Turns out that the sigtrap happens at the following line in uClibc-0.9.33.2/ldso/ldso/dl_startup.c
backtrace does not work as the stack is messed up at this point.

http://landley.net/mantis/mantis-5694.html had something similar going on.

_dl_get_ready_to_run (tpnt=0x7fff6ca8, load_addr=, auxvt=0x7fff6dd0, envp=0x7fff6e8c, argv=0x7fff6e84)
at ldso/ldso/ldso.c:650
650 if (!app_mapaddr && (ppnt->p_type == PT_LOAD)) {

@ryan-esty
Copy link

@thevamad,

In that thread they said turning off UCLIBC_PREGENERATED_LOCALE_DATA worked. Does that work for you?

Ryan

@thevamad
Copy link
Author

I didnt have that flag set to begin with. But previously, one glib2 package (gstreamer required this) had required:
a) building with full language support
b) a patch to be added to uClib (http://ftp.osuosl.org/pub/manulix/scripts/build-scripts/PPFILES/ppfiles-uclibc/gen_wctype.patch) -- This looked like it was messing with data types. Not completely sure..

with a new update to glib2, i found out I dont require either... So I'm trying that now. Mostly I think the update to uLibC might help.. I'll keep updating the thread as I make progress. Past 2 days were spent on making space for and running gdbserver (http://www.0xf8.org/2009/08/openwrt-remote-debugging/). Thank you for your assistance!! Really appreciate it! :)
~Madhu

@thevamad
Copy link
Author

that didnt do it, but it saved me some space in the process..
currently looking into this bug : https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62259

@thevamad
Copy link
Author

This issue has morphed into a different problem. Closing this out as the title no longer describes it accurately.

@thevamad
Copy link
Author

@ryan-esty : Thanks for all your help - The problem is that I am running out of RAM. When the sampleapp runs on the raspberry pi, it takes ~250MB RAM. We only have 64MB total RAM on our target.

@ryan-esty
Copy link

@thevamad,

Thanks for the update that would be a good reason why it never got very far.

Ryan

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

No branches or pull requests

6 participants