I use Android NDK with cygwin with Eclipse on Windows.
In my makefile I want to set path of prebuild library using environment variable in eclipse.
So I do the following:
And in makefile:
LOCAL_SRC_FILES = $(QCAR_SDK_ROOT)build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
LOCAL_EXPORT_C_INCLUDES := $(QCAR_SDK_ROOT)build/include
But I get error:
Android NDK: ERROR:jni/Android.mk:QCAR-prebuilt: LOCAL_SRC_FILES points to a missing file
/cygdrive/d/Development/Android/android-ndk-r7/build/core/prebuilt-library.mk:43: *** Android NDK: Aborting . Stop.
make: *** [all] Error 2
Android NDK: Check that jni//cygdrive/D/Development/Android/qcar-android-1-5-4-beta1/build/lib/armeabi/libQCAR.so exists or that its path is correct
Tried defining variable in makefile directly, got the same result.
So, obviously, that path is not what I wanted. How do I set the proper path?
Why not just specify the paths in the make file? (N.B Just noticed you tried that.)
Using Cygwin with Android NDK
This site seems to indicate that the make file won't run correctly within Eclipse and you should run in via Windows Explorer. Are you running this within Eclipse? Try this and see if you still get the issues.
That's a problem of the previous NDK builds that Google fixed with NDK-9. "Updated ndk-build to support absolute paths in LOCAL_SRC_FILES."
See the release notes here:http://developer.android.com/tools/sdk/ndk/index.html
Try to play with LOCAL_PATH variable. As documentation (docs/ANDROID-MK.html in Android NDK package, or here) states:
LOCAL_SRC_FILES
This is a list of source files that will be built for your module.
Only list the files that will be passed to a compiler, since the
build system automatically computes dependencies for you.
Note that source files names are all relative to LOCAL_PATH and
you can use path components
Also, NDK hints you to Check that jni//cygdrive/D/Development/Android/qcar-android-1-5-4-beta1/build/lib/armeabi/libQCAR.so exists or that its path is correct.
Thus, I would try the following:
LOCAL_PATH := /
...or to reset it at all:
LOCAL_PATH :=
You can edit eclipse.ini file and add it there.
e.g. -DLOCAL_SRC_FILES=/home/user/.../
Or declare a path variable. It is a convenient way of sharing a common location among multiple projects within a workspace.
Hope that help you!
Recent NDK releases on Windows do not need cygwin. Worse, they do not recognize the cygdrive notation. You can simply use
QCAR_SDK_ROOT = D:/Development/Android/qcar-android-1-5-4-beta1
correction absolute paths for LOCAL_SRC_FILES do not work for ndk.r7, and even for r9 the ANDROID-MK.doc does not encourage using absolute paths there.
Related
I've downloaded the binaries: or-tools_VisualStudio2022-64bit_v9.3.10497
I'm using vs2022 on win10. My shell has cygwin in the path if it's related.
I ran
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
cl.exe is in the path, and which.exe finds it.
I ran make test_cc, but it complained
the cl command was not found in your PATH
exit 127
make: *** [Makefile:271: test_cc] Error 127
The var CXX_BIN was empty even though which cl returned the correct path. I set it manually to cl.
Then, there was a complaint about echo and a newline, which I commented out. Then, it couldn't find md, so I created manually md objs.
A few of the examples were built, but then it stopped with another error. For now, I just got what I want:
make run SOURCE=examples/cpp/solve.cc
but probably there was an easier way to get it?
I tried to build it from the source using cmake. Doesn't work off-the-shelf as well:
Build abseil-cpp: OFF
...
CMake Error at C:/prj-external-libs/vcpkg/scripts/buildsystems/vcpkg.cmake:824 (_find_package):
By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "absl", but
CMake did not find one.
Could not find a package configuration file provided by "absl" with any of
the following names:
abslConfig.cmake
absl-config.cmake
Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
"absl_DIR" to a directory containing one of the above files. If "absl"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
cmake/deps.cmake:33 (find_package)
CMakeLists.txt:304 (include)
If finds gurobi95.dll, but it can't find the function GRBtunemodeladv.
On failure, solve.exe crashes with (unknown) names in the stack trace. Need to add debug symbols and graceful error handling.
cmake looks more promising, and I was missing dependencies. Should give it a flag -DBUILD_DEPS:BOOL=ON.
OR-Tools depends on few external dependencies so CMake build will try to find them using the idiomatic find_package() => your distro/env(vcpkg ?) must provide them, just regular CMake stuff here.
ref: https://cmake.org/cmake/help/latest/command/find_package.html
note: we provide few findFoo.cmake here https://github.com/google/or-tools/tree/main/cmake
We also provide a meta option to build statically all our dependencies, simply pass -DBUILD_DEPS=ON cmake option at configure time.
You can also build only some of them, please take a look at
https://github.com/google/or-tools/tree/main/cmake#dependencies
Concerning Gurobi and GRBtunemodeladv symbol, this one has been removed by last version of Gurobi so we fix it in v9.4/main/stable branch...
see: https://github.com/google/or-tools/commit/d6e0feb8ae96368523deb99fe4318d32e80e8145
I am building a flutter plugin which calls native functions from lib.dll file and everything works as expected in my computer.
But I use relative path to link that lib such as
E:/_Projects/mahesabu/client/packages/server/windows/lib.dll
Now I want to move the build process in CI/CD which I believe using relative path such as
./lib.dll would be very easy.
Of cource I am new to cmake configuration. And in one comment it is written
List of absolute paths to libraries that should be bundled with the plugin
I wonder how can I use relative path there, because if I try build fails. The following is CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
set(PROJECT_NAME "server")
project(${PROJECT_NAME} LANGUAGES CXX)
# This value is used when generating builds using this plugin, so it must
# not be changed
set(PLUGIN_NAME "server_plugin")
add_library(${PLUGIN_NAME} SHARED
"server_plugin.cpp"
)
apply_standard_settings(${PLUGIN_NAME})
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)
# List of absolute paths to libraries that should be bundled with the plugin
set(server_bundled_libraries
""
"E:/_Projects/mahesabu/client/packages/server/windows/lib.dll" #USE RELATIVE PATH HERE
PARENT_SCOPE
)
Any help will be appreciated.
Just use:
set(server_bundled_libraries "${CMAKE_CURRENT_SOURCE_DIR}/lib.dll" PARENT_SCOPE)
The CMAKE_CURRENT_SOURCE_DIR variable will expand to current source directory as tracked by add_subdirectory. This is usually, but not always, the directory in which the present CMakeLists.txt resides. Presumably, this is E:/_Projects/mahesabu/client/packages/server/windows on your computer (given your remark that you expect ./lib.dll to work), but will be somewhere else on CI or elsewhere.
I'm trying to build my OwnCloud client. I'm using "Generic Build Instructions" from this link - https://doc.owncloud.org/desktop/2.5/building.html.
I'm stuck at 3 step with an error:
Could NOT find Qt5Keychain (missing: QTKEYCHAIN_LIBRARY)
I downloaded Qtkeychain and compiled it using this link - https://github.com/frankosterfeld/qtkeychain/wiki.
Everything is in my C disk. PATHS are set correctly. Can someone tell me what am missing here.
Adding PATH photo:
Adding a photo to be clear what am talking about:
How did you compile qtkeychain?
With the environment variable %QTDIR% set correctly, e.g. C:\Qt\Qt5.6.0\5.6\msvc2015, you should be able to compile qtkeychain
cmake -G "MinGW Makefiles" .
mingw32-make
and get a 32bit file named "libqt5keychain.dll.a".
You can then add the directory containing this file to your Windows path environment variable. This should work (it does for Nextcloud, at least).
I searched how to use to_string() in android ndk. After a long search, from this link, i changed the Application.mk file as said. And the cpp source compiled and build properly only from the terminal.
Terminal output :
> ndk-build
Android NDK: WARNING: APP_PLATFORM android-21 is larger than android:minSdkVersion 9 in
/<some path>/Android/Exercise01/AndroidManifest.xml
[armeabi-v7a] Install : libndkfoo.so => libs/armeabi/libndkfoo.so
But in ecplise IDE, still i am getting error as "Function 'to_string' could not be resolved". So from the IDE i am not able to run the android application. (Note : before the usage of std::to_string, the source compiled properly)
I tried to include the header files as below (under project properties->C/C++ general->Path and Symbols->GNU C++)
vstring.h from //android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/include/ext
&
basic_string.h from //android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.9/include/bits
But no luck.
Androi.mk File
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -llog
TARGET_PLATFORM := android-21
TARGET_ARCH_ABI := armeabi-v7a
TARGET_ABI := android-21-armeabi-v7a # concatenation of above two variables
# Here we give our module name and source file(s)
LOCAL_MODULE := ndkfoo
LOCAL_C_INCLUDES := $(LOCAL_PATH)/header
LOCAL_SRC_FILES := src/NativeFunction.cpp src/clsArithmeticParser.cpp
include $(BUILD_SHARED_LIBRARY)
Application.mk
#APP_STL := stlport_static
APP_STL:=c++_static
I know, i am doing some small mistake, but not able to find for a long time. Any solution/suggestion appreciated.
Edited :
I am able use the std::to_string & std::stoll through eclipse in the below trick only. These can help some one in rare situation. So adding this point to test the c++11 support through eclipse IDE. The error shown only when the source file or the header file opened. Just close open source file documents (.h, .c, .cpp). Close and reopen the eclipse. Now it is ready to compile and run through the android emulator.
What version of Eclipse IDE do you use? Try to update to the latest Mars version, it may fix your problem.
After referring the answer by #Khaled Lakehal, I myself posting this answer for my question.Hope this may help someone.
Followed the below step to make it work:
Update the eclipse version from Luna to latest Mars 2
Imported the existing project from the old version of the eclipse
using -> import -> Existing Android code into Workspace
Had some problem with the C/C++ project conversion after import. So followed this link to undo the C/C++ project conversion
Converted the project to C/C++ newly.
To remove the error, I referred this link, and selected the "Run with build" only
Close & Reopen the IDE
So now able to use the std::to_string & std::stoll functions.
I am trying to create an eclipse project from a cmake project .
I used the following command
cmake -G "Eclipse CDT4 - Unix Makefiles" ./`
it gives the following error
CMake Error at CMakeLists.txt:119 (find_package):
By not providing "FindGlib.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Glib", but
CMake did not find one.
Could not find a package configuration file provided by "Glib" (requested
version 2.28) with any of the following names:
GlibConfig.cmake
glib-config.cmake
Add the installation prefix of "Glib" to CMAKE_PREFIX_PATH or set
"Glib_DIR" to a directory containing one of the above files. If "Glib"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
I have glib installed . actually it couldn't resolve the path i guess. wherever find is there in cmake file , it is giving the smiler errors. please i suggest a way out, i badly need to load this project in cmake. Thanks.
Here is line 119 where error message is pointing
find_package(Glib 2.28 REQUIRED)
include_directories(${Glib_INCLUDE_DIRS})
list(APPEND LIBS ${Glib_LIBRARIES})
add_definitions(${Glib_DEFINITIONS})
When you call find_package(MyPackage) in a CMake file, it tries to find a FindMyPackage.cmake configuration in its system path (/usr/share/cmake-2.8/Modules on my Ubuntu box), or in the directory you did specify as CMAKE_MODULE_PATH).
The solution to your problem is to create a directory for modules in your source tree (e.g. CMakeModules), put in it a FindGlib.cmake file that you can find using Google, and add
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
in your CMakeLists.txt before the actual call to find_package.
(your problem is not related to the Eclipse generator, you could remove that from the title of the question).