8000 Android toolchain files in log4cplus are obsolete · Issue #283 · log4cplus/log4cplus · GitHub
[go: up one dir, main page]

Skip to content

Android toolchain files in log4cplus are obsolete #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maichaell opened this issue Sep 26, 2017 · 11 comments
Closed

Android toolchain files in log4cplus are obsolete #283

maichaell opened this issue Sep 26, 2017 · 11 comments
Assignees
Milestone

Comments

@maichaell
Copy link
maichaell commented Sep 26, 2017

I'm trying to build log4cplus for Android. It would be really great to make it easy to build for Android too because this is the best logging library there is..

I'm working with Linux environment and I've read instruction from /android/android.toolchain.cmake


michael@michael-VirtualBox:~/Downloads/log4cplus-1.2.1-rc2/build$ export ANDROID_NDK=~/Downloads/android-ndk-r15c 

michael@michael-VirtualBox:~/Downloads/log4cplus-1.2.1-rc2/build$ cmake -DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.cmake ..


CMake Error: Could not find cmake module file: /home/michael/Downloads/log4cplus-1.2.1-rc2/build/CMakeFiles/3.0.2/CMakeCXXCompiler.cmake
CMake Error at CMakeLists.txt:14 (project):
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting the CMake cache entry
  CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name
  if it is in the PATH.


CMake Error at CMakeLists.txt:14 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting the CMake cache entry
  CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler
  name if it is in the PATH.


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
michael@michael-VirtualBox:~/Downloads/log4cplus-1.2.1-rc2/build$ 
@wilx wilx self-assigned this Sep 26, 2017
@wilx
Copy link
Contributor
wilx commented Sep 26, 2017

There is a directory android\scripts with a bunch of shell scripts that should facilitate compilation with CMake for Android.

@wilx wilx added the question label Sep 26, 2017
@maichaell
Copy link
Author

Thanks, I'll check that.

@maichaell
Copy link
Author

No, I got almost same errors when running the script. I did define ANDROID_NDK. But it seems something is still missing. It does not work out-of-the box. I'll try to investigate this.

I wonder if you could try this in Linux at some point ? It's only one script

@maichaell
Copy link
Author
maichaell commented Sep 26, 2017

I updated cmake from 3.0 to 3.9 but still errors:

michael@michael-VirtualBox:~/Downloads/log4cplus-1.2.1-rc2/android/build_armeabi$ /opt/cmake/bin/cmake -DANDROID_NATIVE_API_LEVEL=android-9 -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=/home/michael/android-ndk-r15c/build/cmake/android.toolchain.cmake $@ ../..
-- Android: Targeting API '9' with architecture 'arm', ABI 'armeabi', and processor 'armv5te'
-- Android: Selected Clang toolchain 'arm-linux-androideabi-clang' with GCC toolchain 'arm-linux-androideabi-4.9'
CMake Error at CMakeLists.txt:14 (project):
  The CMAKE_C_COMPILER:

    /home/michael/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86/bin/clang

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:14 (project):
  The CMAKE_CXX_COMPILER:

    /home/michael/android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86/bin/clang++

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/home/michael/Downloads/log4cplus-1.2.1-rc2/android/build_armeabi/CMakeFiles/CMakeOutput.log".

@maichaell
Copy link
Author

Looks like cmake has capability to build for Android: https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android

@maichaell
Copy link
Author
maichaell commented Sep 27, 2017

Ok, I have succeeded in compiling with latest NDK-r15c. The toolchain in log4cplus/android directory supports only NDK up to r10. That's why I get strange errors.

For newer NDK simply use toolchain file from NDK like this. You also need cmake version >= 3.6

michael@michael-VirtualBox:~/Downloads/log4cplus-1.2.1-rc2$ ~/cmake/bin/cmake -DCMAKE_TOOLCHAIN_FILE=/home/michael/android-ndk/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-9 -DANDROID_ABI=armeabi

... produces this kind of compiler flags:

-- Compiler flags: -isystem /home/michael/android-ndk/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=9 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security

if you want more options for Android build you can check them from toolchain file.

This can be closed. I guess it would be easy to update current scripts to use this way presented here for all targets. Also maybe some comment about this in the readme would be good to avoid same problem for someone else..

Under Cygwin + MinGW this seems to work:

$ cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=C:/Users/Michael/AppData/Local/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake ../../ -DANDROID_ABI=armeabi -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9

@wilx
Copy link
Contributor
wilx commented Jan 2, 2018

Is the CMake toolchain file for Android now obsolete since Android ships its own variant of it? If it is, we could document this fact and add a note for older Android users that they still can use the one we ship on their platforms.

@maichaell
Copy link
Author

Yes, it seems so. You have to find older android sdk to make it build with what is currently included here in log4cplus.

@wilx wilx removed the question label Feb 20, 2018
@wilx wilx changed the title Help needed in compiling for Android Android toolchain files in log4cplus are obsolete Feb 20, 2018
@wilx
Copy link
Contributor
wilx commented Aug 21, 2018

So, what do we do about this?

@wilx wilx added this to the v2.0.3 milestone Aug 21, 2018
@wilx
Copy link
Contributor
wilx commented Nov 11, 2018

Ping.

@wilx wilx modified the milestones: v2.0.3, v2.0.x Nov 22, 2018
wilx added a commit to wilx/log4cplus that referenced this issue Apr 9, 2019
@wilx wilx modified the milestones: v2.0.x, v2.0.4 Apr 9, 2019
wilx added a commit that referenced this issue Apr 9, 2019
Remove obsolete Android build support directory. Closes #283.
@wilx
Copy link
Contributor
wilx commented Apr 9, 2019

I have removed the entire directory. I assume anyone interested in building log4cplus for Android know what he is doing.

@wilx wilx closed this as completed Apr 9, 2019
wilx added a commit to wilx/log4cplus that referenced this issue Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0