Using stl in an Android adb shell native program - stl

I'm trying to port a C++ utility program that I want to be run from the Android ADB shell.
For that, I'm using the Android NDK's make-standalone-toolchain.sh script, and compiling my program with it.
Unfortunately, when I try to run it, I get this error:
reloc_library[1315]: 16304 cannot locate '_ZNKSs5c_strEv'...
CANNOT LINK EXECUTABLE
After some research, I saw that this means that the c_str function doesn't exist in libstdc++.so in the NDK. I also couldn't find the symbol in stlport.so either, and actually only found it in the ./sources/cxx-stl/gnu-libstdc++/libs/ version of the C++ libraries. These libraries are not included in the standalone toolchain I made, and I also couldn't find them on the device (the device is running Honeycomb).
The text in the NDK clearly states that there's support for the entire STL when I use stlport. Is this something that is only true in Ice Cream Sandwich? The libstlport.so or in libsupc++.so on the device and in the NDK didn't have any signature like the one that wasn't found.
So my question has two parts:
Is there something I'm missing in the build process/Android setup? Can I set up things differently so that the program will compile without needing the gnu-libstc++, or at least fail with a compilation/link error instead of failing to load on the device?
If linking with gnu-libstc++ is the only way, how can I do that? I think I can manage statically link to it but I'd rather not.
How can I add the gnu-libstdc++ version to my

If someone else is looking for a solution, I ended up adding a dependency using the -l switch on libgnustl_shared.so. You can find it inside the NDK at
sources/cxx-stl/gnu-libstdc++/libs/&ltarchitecture&gt/
I then pushed this .so together with the program to the device, and made a script that adds the current directory to LD_LIBRARY_PATH. It seems similar to what the NDK does when you use the make scripts to create a program that depends on gnustl.

Related

Octave runs but graph not displayed

num=[1];
den=[1 3 1];
G=tf(num,den);
H=1;
T=feedback(G,H);
step(T);
hold on;
Kp=23;
Ki=0;
Kd=0;
C=pid(Kp,Ki,Kd);
T=feedback(C*G,H);
step(T);
When run this script nothing happen in Octave but works fine in octave-online.net
online octave
Octave Windows
I will put a proper answer here for future users, even though OP has already solved their problem from the comments.
octave-online.net is an excellent cloud service providing an instance of octave on the cloud.
Contrary to a typical installation of octave on linux or windows, the octave-online client autoloads some of the more popular packages, one of which is control.
You can confirm this by typing pkg list in the octave-online console.
In your normal linux / windows installation however, this needs to be loaded explicitly before use, e.g. in the case of the control package, by doing pkg load control.
Your code uses the functions feedback and pid, both of which rely on the control package, therefore in your windows instance, your code failed, because you tried to use these functions without loading the package first.
Presumably there was also an error in your terminal informing you of this fact, that you may have missed.

AIR Build Server Setup

I am at the point where I am running into incredibly long build times for my project and more projects to come. I would like to make a build server but I have not had any experience with them aside from downloading files from them as an end user.
My ideal setup is this: A GitHub where I can place my .fla file, classes and ANEs. The server sees this, compiles it, and allows me to test it remotely or hook into some debugger that lets me see stack traces and active variables at breakpoints and errors like Adobe Animate or Flash Builder.
Now I see there are GitHub plugins for Jenkins. I see there are questions referring to how to set one up with Flex/AIR. I come here with a few issues.
I am too far into my project to switch over from using Animate to something like Flash Develop or anything ADT related. The only thing I have found is how to take existing elements from my library in Animate and have them in a .swc for handling. However, this doesn't let me access existing elements in the Timeline and would rather not try to export/position/handle them in code (which is the only workaround that I see if this is not possible)
I run ANEs that are dependent on Google Play services and other Android specific libraries. Thus, I haven't been able to use the standard mobile debug launcher for AIR. I see Jenkins has some specific abilities for Android. Is it possible to somehow use this to give me a proper window for testing? I am thinking that I would need to run their emulator after compiling everything but I am unsure if there is a more efficient method or if it would even work.
I have never worked with Jenkins before or any other tools capable of automating tasks. Any step by step explanations is appreciated if you have the time.

How to create a PPAPI plugin for Google Chrome in Windows?

I am new to PPAPI development and have downloaded the already examples from here
However, even after coming across the documentation,
I am not able to build the project.
I have Microsoft Visual Studio 2010, Windows OS and Chrome:30.0.1599.65
I understand that once a dll is created, using the regsvr32 command will register the plugin, although getting the dll, even with available code, seems tough for me. Any help for building the dll is appreciated.
You will want to start here to download the and set up the SDK: https://developers.google.com/native-client/sdk/download
This page will take you through how to build and run the examples: https://developer.chrome.com/native-client/sdk/examples
This page goes over how to actually create your own plugin: https://developer.chrome.com/native-client/devguide/tutorial/tutorial-part1
And then you should read this entire section to code and structure your application: https://developer.chrome.com/native-client/devguide/coding/application-structure
If you need any third party libraries be sure to check here: https://chromium.googlesource.com/webports
Edit: Forgot to mention that you will want to use the same version of the pepper api as the version of chrome you're running (in this case pepper_30). Also, you have to use the NaCl toolchain (one of either glibc, newlib, or pnacl); you can't use the Visual C/C++ toolchains. I recommend trying pnacl now that it is available, as that is by far the most cross platform version, but if you run into trouble, you'll probably want to use the newlib toolchain as it has better support.

ADT works with ipa-test-interpreter but not ipa-test

I could use some help getting my #AS3 / #AIR application running on #iOS !
Right now I have a .SWF (v11) that I'm converting to an .IPA using Adobe AIR (v3.7) on Windows (7).
If I do the conversion with the -target of ipa-test-interpreter it works great.
If I do the conversion with ipa-test, ipa-debug, ipa-ad-hoc, or ipa-appstore, the application seems to compile fine but upon execution of the app on my iPad it just shows a black screen.
Connecting my iPad to a desktop and monitoring console output, I see not crash or error messages generated; the app appears to behave fine internally, it's just lost all external output.
This means I can test and develop but I won't ever actually be able to deploy to the app-store. Anyone else run into this?
Googling around I've run into other people encountering this problem, but no solutions yet. One thing I tried was removing all native extensions, and I also tried removing the -C compiler directive. No luck on either.
To be clear, the app runs totally fine on Mac, PC, Android, Browser, and on iOS in interpreter mode; it's just native-compilation on iOS that's broken. I've heard rumours that ipa-test and ipa-interpreter have different memory allocation routines, but I don't know enough about the low-end here to figure this out.
The remote debugger (in FlashDevelop) doesn't seem to connect either. I think it's failing before the runtime fires fully, somehow? I'm also watching the console output using the iphone-configuration-utility and there isn't anything abnormal showing up.
Temporary file link with sample project and instructions: https://dl.dropboxusercontent.com/u/1348446/test.zip
Figured it out. Rundown:
The ADT command line has a -C flag to change the current working directory on the command line, which allows you to keep your project better organized and keep the command line a bit more sane. -C can be called as many times as you want when importing assets, and I used it several times. IDEs like FlashDevelop also use -C in the AIR template files so this is sorta standard behaviour. As a quick example of asset inclusion:
ADT.exe [blah blah] assets/icons/icon1.png assets/icons/icon2.png
is the same as
ADT.exe [blah blah] -C assets/icons icon1.png icon2.png
(and, with wildcard use) is the same as
ADT.exe [blah blah] -C assets/icons .
As I have different compiling instruction sets for iOS, android, steam, etc., I had adt switch directories with a variable to the current config and execute from there.
This all works fine and as-documented in ipa-test-interpreter mode. When in native-code mode (ipa-test), however, including the main executable .SWF after a -C command [somehow for some reason] messes up the internal pathing; the file ends up being included but ends up being all "file not found" internally when executed, hence the blank screen and no code executing.
So the fix is simply to include the .swf from the current directory, before any calls to -C. As a quick example of my workaround that just tested a-okay:
copy /bin/flash/game.swf ./
adt [stuff] game.swf -c assets/icons .
del game.swf
I've gotten in touch with Adobe about this and hopefully they'll fix -C so it's functionality is the same for both compile targets in the future.
I have seen this happen in the past due to utilization of components "restricted" from use within iOS builds of Air apps. Specifically back in the day before being able to sandbox the loading of app resources with the loader class.
Start shutting down and turning off whole modules of your app and see when the app will build and run on iOS. I'm willing to bet there is some code somewhere that is ipa-test-interpreter safe but has odd behavior under ipa-test
I see you're still stuck with this issue. If you can find a Mac to test on, I bet xcode instruments will show you're exceeding you're memory limits. It is the iPad one right? Are you using flash's embed meta tags?
Is Black your swf background color? If it is, maybe it's a cross domain loading issue because you're loading your swf and app.xml from 2 different places. I don't know if this is causing it, but I usually keep them in the same place.
Have you ever seen your provision & p.12 work on a device? If not, it might be a problem with them.
What IDE are you using to make this, Flash IDE or Flash Builder, Flash Develop/ANT? And if you post src code it would help. Sometimes putting your metadata in the wrong place can screw things up on iOS but look fine in the browser...so it could be many things.
Good luck.

How to detect Flash runtime errors?

I'm developing an AS3 application with the commandline tools from the Flex SDK. My workflow is:
write code
compile with mxmlc
run the SWF file in favorite webbrowser
repeat
The second step catches compile-time errors, but what about run-time errors and warnings? And trace() output? How can I see that?
I'm not using any IDE with debugging capabilities.
Get the debug version of the Flash player and Firebug for Firefox, then you can see the traces and errors in the console.
When a run-time error occurs that isn't caught by an exception handler you will get a popup telling you about the error.
Why not get http://www.flashdevelop.org/? It's free and it has debugging, profiling and all other goodies you can expect from an IDE.
Although the Flash debugger is a pretty good choice. I would personally suggest Monster Debugger. It is a great debugger with a very intuitive user interface and it has a plethora of features that make debugging extremely easy.
Flash player debugger writes the output of trace() to the flashlog.txt file. Its location is hardcoded and is different on different systems. On Linux it is in ~/.macromedia/Flash_Player/Logs/flashlog.txt. In order to have The debugger to actually write into that file, you need yet another file, mm.cfg, it's location and name are again hardcoded. It should be in ~/mm.cfg. It may contain many different options, but the one you are interested in is ErrorReportingEnable=1.
You may then $ tail -f ~/.macromedia/Flash_Player/Logs/flashlog.txt to see the progress as the file is been written to.
Note that the directory and the file must be writable by the user running the player. Flash player will not issue any warnings if that is not the case, and will fail silently.
Also note that if you are happened to be on Linux, then there isn't a 64-bit version of a debugger player... However, the player runs fairly well under Wine, the Windows version that is.
You may debug using commandline debugger found in SDK. it's called fdb (fdb.exe or in Apache Flex fdb.bat on Windows). It has similar to gdb interface, can do breakpoints, some runtime code evaluation, disassemble functions, look up stack frames and their variables and most of the other stuff you'd expect a debugger to do. I'm usually running it from Emacs, but I would imagine that running it from Vi[m] or whatever editor you are using shouldn't be a problem...
If you were using Emacs, it is actually possible to hook up Flymake to a part of the SDK that does syntax checking while you type. You can find more info on how to do that here: http://www.flashdevelop.org/community/viewtopic.php?f=13&t=9238 (thanks Philippe).