[CXX-1625] Android NDK r17 compiler error Created: 31/Jul/18  Updated: 27/Oct/23  Resolved: 02/Aug/18

Status: Closed
Project: C++ Driver
Component/s: Release
Affects Version/s: 3.3.1
Fix Version/s: 3.4.0

Type: Bug Priority: Major - P3
Reporter: Cemal DEM?R Assignee: A. Jesse Jiryu Davis
Resolution: Works as Designed Votes: 0
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Android


Attachments: JPEG File EP error.JPG     JPEG File ep++ error.JPG     JPEG File errror.JPG     JPEG File image-2018-07-31-17-59-51-769.png    
Issue Links:
Duplicate
is duplicated by CXX-1624 compiler error Closed

 Description   
  1. libbson Android ndk building success.
  2. libmongoc fail with: -lrt and -lresolv can not find, shm_open() shm_unlink() unreferenced function(), rand_r(seed); undefined function. rand_r() replaced with srand(seed); rand(); function. in cmake file I remove the ${RESOLVE_LIBRARY}. disable ENABLE_SHM_COUNTERS=OFF, if I do these settings i compiling succes
  3. bsoncxx: after compilation libbson and libmongoc, I always get error: command line error jpg attached. sometimes it successed sometimes not.

Before I compiled all library with android ndk r15 and all code working well in Samdung A5 and A3 but at another device like J7 Mi5 or LG g5 console error white building a bsoncxx::Dbuilder::basic::document{}; libc error invalid address 0x4556... 

 

Now EP_minimalistic_core give me a error. How can I fix it? or How can Use mongocxx on Android? 



 Comments   
Comment by Cemal DEM?R [ 02/Aug/18 ]

can you change to topic title "compiler error" to "Android NDK r17 compiler error" or what this topic mean? I can not change the topic's title.

Comment by Cemal DEM?R [ 02/Aug/18 ]

yes, i preparing a wrapper that libbsonc and libmongoc. i don't sure my code is clean or written professional. i will be published it on github and may be you help me where i am wrong. i will be send a pull request if c libraries work a lot of android variant.

 

Thank you Jesse.

Good Luck

Comment by A. Jesse Jiryu Davis [ 02/Aug/18 ]

Thanks for your answer. We do not officially support the C++ Driver on Android, and we don't have the expertise to help you with issues on specific Android variants. If you need to make any small changes to the C++ Driver so it will compile on your systems, please send a pull request. Once you have it working everywhere, please put your build steps into this ticket, or publish them somewhere online, so that future Android developers can benefit from your work. Thank you!

Comment by Cemal DEM?R [ 02/Aug/18 ]

bsonc and libmongoc working on Samsung Note4 Android 6.0 , Samsung Note5 Android 7.0 Working Well both query and insert.

Comment by Cemal DEM?R [ 02/Aug/18 ]

auto filter = bsoncxx::builder::basic::document{}; 

try

{     filter.append(bsoncxx::builder::basic::kvp("test","test")); }

catch (bsoncxx::exception &e)

{  }

code above and below compiler error:

D:\project\Android-NDK-r17b\android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -sysroot=D:\project\Android-NDK-r17b\android-ndk-r17b/platforms/android-16/arch-arm/ -Wl,-soname,libBSONTEST.so -Wl,-rpath=C:/Qt/5.10.0/android_armv7/lib -Wl,-no-undefined -Wl,-z,noexecstack -shared -o libBSONTEST.so main.obj qrc_qml.obj -LD:\project\Android-NDK-r17b\android-ndk-r17b/sources/cxx-stl/gnu-libstdc+/4.9/libs/armeabi-v7a -Ld:/project/android-ndk-r17b/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -LC:/Users/Manager/Documents/AndroidTest/BSONTEST/android/lib/ -LC:/Users/Manager/Documents/AndroidTest/BSONTEST/android/lib -lbsoncxx -lmongocxx -lbson-1.0 -lmongoc-1.0 -LC:/Qt/5.10.0/android_armv7/lib -lQt5Quick -Lc:\utils\android-ndk-r10e/sources/cxx-stl/gnu-libstdc+/4.9/libs/armeabi-v7a -Lc:/utils/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.9 -LC:\Qt\5.10.0\android_armv7/lib -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lgnustl_shared -lgcc -llog -lz -lm -ldl -lc

main.obj:main.cpp:function main: error: undefined reference to 'bsoncxx::v_noabi::builder::core::key_view(std::experimental::basic_string_view<char, std::char_traits<char> >)'

collect2.exe: error: ld returned 1 exit status

make: *** [libBSONTEST.so] Error 1

08:48:35: The process "D:\project\Android-NDK-r17b\android-ndk-r17b\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.

Error while building/deploying project BSONTEST (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.10.0 (android_armv7)))

When executing step "Make"

 

before i said bsonc and mongoc working

 

Comment by A. Jesse Jiryu Davis [ 01/Aug/18 ]

Thanks for the information. No, there is no precompiled mongocxx driver for Android.

What is your current status? Does the driver work for you or not?

Comment by Cemal DEM?R [ 01/Aug/18 ]

libbsonc and libmongoc working well on Android emulator Android version 5.0,  Samsung A5 Android version 6.0.1 And Samsung J5 Android version 7.0. 

both query and insert bson. I will be tested soon on before crashed device like Samsung J7, MI5 and HTC

Comment by Cemal DEM?R [ 01/Aug/18 ]

is there precompiled mongocxx driver for adroid?

Comment by Cemal DEM?R [ 01/Aug/18 ]

cmake -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14 compiling well. thanks for you but previous error. like -lrt or -lresolv while compiling libmongoc, what will do?

Comment by Cemal DEM?R [ 01/Aug/18 ]

clang version

EP Step

 

EP_mnmlstc_core-configure-err.log

/*******************

CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeMinGWFindMake.cmake:12 (message):
sh.exe was found in your PATH, here:

C:/Program Files/Git/usr/bin/sh.exe

For MinGW make to work correctly sh.exe must NOT be in your path.

Run cmake from a shell that does not have sh.exe in your PATH.

If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
CMakeLists.txt:2 (project)

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

 

 

i will try option "cmake -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14" and post result here

 

Comment by A. Jesse Jiryu Davis [ 31/Jul/18 ]

Thanks for the report. A few questions:

1. What version of clang do you have installed?

2. The error messages tells you to look for log files in C:/mongoV2/mongocxx/mongo-cxx-driver-r3.3.1/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/EPI_mnmlstc_core-stamp/. Are there any log files in that directory? I'm particularly interested in "EP_mnmlstc_core-configure-err.log".

3. What if you run "cmake -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14"?

Generated at Wed Feb 07 22:03:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.