Alljoyn android Events and Actions sample not working - android-ndk

Trying to run Android sample 'Events and Actions' downloaded from https://allseenalliance.org/framework/download
Downloaded 'Core SDK - debug' which has sample eventaction and .apk in bin folder.
Installed it, but doesn't work. Is anyone able to run it?
Edit: Exception in the Logcat:
08-29 09:06:16.978 29314 29328 E AndroidRuntime: Process: org.allseen.sample.eventaction, PID: 29314
08-29 09:06:16.978 29314 29328 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__exidx_end" referenced by "/data/app/org.allseen.sample.eventaction-1/lib/arm/libMyAllJoynCode.so"...
I have tried building the library MyAllJoynCode.so using Android ndk, but I couldn't able to build it. I get below exception
root#jay-dev:~/alljoyn/core/alljoyn/alljoyn_core/samples/eventaction/Android# ndk-build
[arm64-v8a] Compile++ : MyAllJoynCode <= AndroidJNIBridge.cc
In file included from /root/alljoyn/core/alljoyn/build/linux/x86_64/debug/dist/cpp/inc/qcc/atomic.h:30:0,
from /root/alljoyn/core/alljoyn/build/linux/x86_64/debug/dist/cpp/inc/qcc/ManagedObj.h:38,
from /root/alljoyn/core/alljoyn/build/linux/x86_64/debug/dist/cpp/inc/alljoyn/Message.h:30,
from /root/alljoyn/core/alljoyn/build/linux/x86_64/debug/dist/cpp/inc/alljoyn/AuthListener.h:32,
from /root/alljoyn/core/alljoyn/build/linux/x86_64/debug/dist/cpp/inc/alljoyn/BusAttachment.h:34,
from jni/event/AndroidJNIBridge.cc:19:
/root/alljoyn/core/alljoyn/build/linux/x86_64/debug/dist/cpp/inc/qcc/posix/atomic.h:30:25: fatal error: sys/atomics.h: No such file or directory
#include
^
compilation terminated.
/root/android-ndk-r12b/android-ndk-r12b/build/core/build-binary.mk:474: recipe for target 'obj/local/arm64-v8a/objs/MyAllJoynCode/event/AndroidJNIBridge.o' failed
make: *** [obj/local/arm64-v8a/objs/MyAllJoynCode/event/AndroidJNIBridge.o] Error 1

It looks like you were using Android NDK level 20 (or later).
The NDK's android-20 platform directory no longer contains the atomics.h file (they removed it), which caused the AllJoyn build failure you saw:
dist/cpp/inc/qcc/posix/atomic.h:30:25: fatal error: sys/atomics.h: No such file or directory
Prior to AllJoyn release 16.10, a workaround is simply to copying the NDK's android-19 atomics.h file to its android-20 (or later) platform directory.
However, the AllJoyn-related issue has been fixed as of September 2016 (i.e. no longer dependent on atomics.h), and the fix is included in AllJoyn release 16.10.
More information is provided in JIRA https://jira.allseenalliance.org/browse/ASACORE-3216

Related

Visual C++ 2017 link error due to -Ot flag?

I am trying to get a Visual Studio 2017 project to link, but I'm stuck on the following linker error:
LINK : fatal error C1007: unrecognized flag '-Ot' in 'p2'
I've read questions on what the cause could be, but I couldn't come to a solution for my project.
The details are that, due to an external component we have no control over (component A), this Visual Studio 2017 project is forced to use the v14.13 version of the C++ toolchain, i.e. not the latest one (v14.14). However, the latest release of another external precompiled static lib we have no control over either (component B), is built with the v14.14 version (I checked via a dumpbin extract of the debug version of the lib). Switching my project over to the v14.14 toolchain indeed makes the link error go away on component B, but this unfortunately isn't a solution for me due to component A. Taking an earlier version of component B isn't desirable either, since we need the functionality in the latest release...
However, what strikes me, is that the /Ot ("optimize for speed") flag has been around since the middle ages... Why wouldn't v14.13 recognize it? Or is it just an (awkwardly manifested) matter of a mismatched obj file layout due to the version differences? And, probably related, what does the 'p2' stand for anyway?
Update
I've checked the linker output by using the /verbose flag, and all seems normal (3600 lines of Searching <lib>, Found <function>, Referenced in <obj> and Loaded <lib>).
Right up until the end that is, where I get the following 6 lines:
1> Searching C:\PathToExternalLib\TheirStatic.lib:
1> Found UsedFunctionName
1> Referenced in MyOwnStatic.lib(MyOwnCompileUnit.obj)
1>LINK : fatal error C1007: unrecognized flag '-Ot' in 'p2'
1>LINK : fatal error LNK1257: code generation failed
1>Done building project "MyProject.vcxproj" -- FAILED.
And that's that.
When visiting the command line setting of the link properties of the project, the only thing listed is (broken up in separate lines for convenience):
/OUT:"MyProject.dll"
/MANIFEST
/NXCOMPAT
/PDB:"MyProject.pdb"
/DYNAMICBASE "C:\PathToMyStatic.lib"
/IMPLIB:"MyProject.lib"
/DLL
/MACHINE:X64
/PGD:"MyProject.pgd"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/ManifestFile:"MyProject.prm.intermediate.manifest"
/ERRORREPORT:PROMPT
/NOLOGO
/LIBPATH:"C:\PathToExternalStaticLib"
/LIBPATH:"C:\PathToAnotherExternalStaticLib"
/TLBID:1
So no trace of any -Ot flag there as well...?
I had this problem. LINK : fatal error C1007: unrecognized flag '-Ot' in 'p2'
while building a project with Visual Studio 2015.
I had to rebuild any library or sub library the project linked to which were built with Visual Studio 2017.
Once I rebuild the dependent libraries with Visual Studio 2015 the first project was able to link against them.
project
--------\
---------lib1(unable to rebuild lib1 until its dependencies were also rebuilt with VS2015
--------------\lib_linked_by_lib1_which_was_build_with_VS2017_and_had_to_be_rebuilt
--------------\another_lib_which_had_to_be_rebuilt_for_lib1_with_VS2015
--------\lib2
--------\lib3

Build message - Unknown compiler version, for dealii-4.8.1 library on visual studios

My build output gives many error messages of:
"Unknown compiler version - please run the configure tests and report the results"
...when attempting to build INSTALL for the dealii-8.4.1 library (open source, finite element library - graphics library) on Visual studios 14.0 (v 2015) c++.
A portion of the build is shown below.
Can anyone advise on what this means? and how to: "run the configure tests and report the results?" I Configured dealii-8.4.1 using cmake to start with.
Using deal.II on native Windows (dealii webpage and instructions)
https://github.com/dealii/dealii/wiki/Windows
PORTION OF BUILD OUTPUT on Visual Studios
44> vector_tools_point_value.cc
44> Unknown compiler version - please run the configure tests and report the results
44>C:\dealii-8.4.1\source\numerics\vector_tools_point_value.cc(22): fatal error C1083: Cannot open include file: 'vector_tools_point_value.inst': No such file or directory
44> vector_tools_point_gradient.cc
44> Unknown compiler version - please run the configure tests and report the results
44>C:\dealii-8.4.1\source\numerics\vector_tools_point_gradient.cc(22): fatal error C1083: Cannot open include file: 'vector_tools_point_gradient.inst': No such file or directory
44> vector_tools_project.cc
44> Unknown compiler version - please run the configure tests and report the results
44>C:\dealii-8.4.1\source\numerics\vector_tools_project.cc(22): fatal error C1083: Cannot open include file: 'vector_tools_project.inst': No such file or directory
44> vector_tools_rhs.cc
44> Unknown compiler version - please run the configure tests and report the results
44>C:\dealii-8.4.1\source\numerics\vector_tools_rhs.cc(83): fatal error C1083: Cannot open include file: 'vector_tools_rhs.inst': No such file or directory
The issue may be due to deal.II on native Windows, as for the windows version it states:
"Warning: please be aware that the following is experimental and you will likely encounter bugs in compilers and deal.II itself. Only continue if you are willing to experiment."
https://github.com/dealii/dealii/wiki/Windows
And: "deal.II is mostly developed on Linux using the GCC compiler."
http://www.dealii.org/8.4.1/readme.html
So it may be better to install Linux (Ubuntu) to see if that solves it.

Unable to build NDK project from latest Android Studio (version 2.1.2, Windows 64 bit)

I am unable to build a NDK project from the Android Studio environment but can build it manually using the command console.
I get the following error after building:
Error:Execution failed for task ':xxxxxx:compileReleaseNdk'.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\xxxxx\AppData\Local\Android\SDK\android-sdk\ndk-bundle\ndk-build.cmd'' finished with non-zero exit value 2
I got a similar error while invoking ndk-build.cmd manually using the console from the jni directory where my NDK project is stored.However I fixed it by modifying the following in my Application.mk file as follows:
NDK_TOOLCHAIN_VERSION := 4.9
since 4.9 is the tool chain available on my install. I suspect from the Android Studio environment, the toolchain version is being picked incorrectly, and yet I do not know where to set this option in the GUI.
The build.gradle file has the following NDK block:
ndk{
moduleName "xxxxxx"
ldLibs "log"
cFlags "-std=c++11 -fexceptions"
stl "gnustl_static"
abiFilters "arm64-v8a armeabi armeabi-v7a mips mips64 x86 x86_64"
}
Please advise me on how to go about solving this problem.
Just out of curiosity, I moved my project directory to the desktop and tried to build that project. The build was successful.
Finally narrowed down the problem to the NDK compiler not being able to create the following intermediate object file inside my project folder:
C:\Users\xxxxx\GitRepos\REVIEWS\xxx\SMART-xxx\xxxx-xxx-androidnative\xxxLibraries\xxxlibrary\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/natXXXX/C_\Users\xxxxx\GitRepos\REVIEWS\xxx\SMART-xxxx\xxxx-xxx-androidnative\xxxLibraries\xxxlibrary\src\main\jni\NativeXXXX.o.d
The reason was the well known windows path cannot exceed 255 characters issue. As you can see above the NDK-Build utility tries to append a deep folder hierarchy like "C_\Users\xxxxx\GitRepos\REVIEWS\xxx\SMART-xxxx\xxxx-xxx-androidnative\xxxLibraries\xxxlibrary\src\main\jni\" which exceeds MAX_PATH.

NDK:OpenSSL error" java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libssl.so.1.0.0" needed by "libmyLib.so"

I am trying to build libcurl with openSSL support. I tried using DockerFile and using ubantuimage with that. I am able to compile .so file for libcurl and openSSL. When I try to use those in my android NDK project and load application into device then it gives me error "java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libssl.so.1.0.0" needed by "libmyLib.so"; caused by library "libssl.so.1.0.0" not found". I have put this versioned file where my libcurl.so,libcrypto.so and libssl.so resides. This kind of error comes for every .so I have used depending on order I have included in my Android.mk file. Let me know how to solve this issue. For every .so mentioned above I can see versioned files. Let me know if more detail is required. I am getting error:
java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libssl.so.1.0.0" needed by "libmyLib.so"; caused by library "libssl.so.1.0.0" not found
Android doesn't support versioned .so files, you have to rename it so it ends by .so.
clarification: you should rebuild the library in order to change its name and be able to use it - don't just rename the file itself.

Release Build Linker Failure

I just finished my project and tried building it in Release for the first time. I've had previous issues with the Windows 7 SDK and the Common7 stuff located in program files(ie they were missing and I had to install them from msdn).
The build is complaining :
1>LINK : fatal error C1350: error loading dll 'msobj110.dll': dll not found
1>Block.obj : fatal error LNK1000: unknown error at 00A14372; consult documentation for technical support options
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Yet I looked at :
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE
I have the same folder under C:\Program Files..., and IDE is almost empty; doesn't have the ms libraries.
How can I know where Visual Studio picks these dll from? I'm using VS2012.

Resources