Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,306
    • Issues 3,306
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 16
    • Merge Requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #16536

Closed
Open
Created Jan 04, 2017 by Viktor@Windsor

Cross-compiling with CMake for Android x86 with API lower than 21 fails

When using CMake options as described on official site: cmake ../src -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=9 -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_NDK=/path/to/android-ndk -DCMAKE_ANDROID_STL_TYPE=c++_static

https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android

and building for Android x86 with API version < 21 and gcc 4.9 on host x64 Ubuntu machine, then we get the following error:

 /.../boost/1.61.0/build/include/boost/asio/impl/serial_port_base.ipp: In member function 'boost::system::error_code boost::asio::serial_port_base::baud_rate::store(termios&, boost::system::error_code&) const':

/.../boost/1.61.0/build/include/boost/asio/impl/serial_port_base.ipp:119:3: error: '::cfsetspeed' has not been declared
   ::cfsetspeed(&storage, baud);
   ^
make: *** [all] Error 2 

Probably this error occured because _BSD_SOURCE is defined in following header: path_to_ndk/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9/include-fixed/asm/posix_types.h included instead of needed path_to_ndk/platforms/android-9/arch-x86/usr/include/asm/posix_types.h , that's why _BSD_SOURCE is defined and it leads to errors when compiling third-party libraries (Boost etc)

When using custom toolchain file https://github.com/taka-no-me/android-cmake/blob/master/android.toolchain.cmake _BSD_SOURCE gets never defined.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
3.8.0
Milestone
3.8.0 (Past due)
Assign milestone
Time tracking
None
Due date
None