Skip to content
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

Android Issues #82

Open
seanh1986 opened this issue May 23, 2019 · 6 comments
Open

Android Issues #82

seanh1986 opened this issue May 23, 2019 · 6 comments

Comments

@seanh1986
Copy link

First off, awesome looking library! I had boost integrated in an outdated version of the Android NDK but I wanted to upgrade to the latest version of Gradle + NDK on Android, and that required switching from gcc to clang and integrating with boost 1.70.0... Found this library and it looked to offer a great solution.

I have been experimenting with several different variations of the guidelines (adding as a sub-module and using the FetchContent within the CMake). I wanted to avoid the sub-module approach so I've been focusing on the FetchContent one.

This required me to manually update the CMake version (Android had only supported up to 3.10). I have managed to get it to support CMake version 3.14.4.

My CMake file looks roughly like this:

cmake_minimum_required(VERSION 3.12)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall")

include(FetchContent)
FetchContent_Declare(
  Boost-CMake
  GIT_REPOSITORY https://github.com/Orphis/boost-cmake.git
)
FetchContent_GetProperties(Boost-CMake)
if(NOT boost-cmake_POPULATED)
  FetchContent_Populate(Boost-CMake)
  add_subdirectory(${boost-cmake_SOURCE_DIR} ${boost-cmake_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

# includes a bunch of files
add_library(MyLib SHARED ....)

# this seemed to be necessary, guessing due to non-standard auto-generated location
find_package(Boost COMPONENTS circular_buffer REQUIRED)

target_link_libraries(MyLib
                        Boost::circular_buffer
                        )

Things seemed to be working. I did get a few errors but from reading through other open/closed issues, I saw your reply that it meant that everything was in fact working as expected. As well, when I run the CMake, it generates a bunch of boost-related folders/files.

The issue is that I get the following error:
org.gradle.api.UncheckedIOException: java.nio.file.AccessDeniedException: [MyProjectPath]\.externalNativeBuild\cmake\debug\armeabi-v7a\_deps\boost-cmake-src\.git\objects\pack\pack-9f2195dfb9d14b5d14c811b719879a70f0210228.idx

As you can see, it placed some kind of boost-cmake files deep in that directory.

My current configurations are:
Android Gradle Plugin version: 3.4.1
Gradle version: 5.1.1
CMake version: 3.14.4
Android NDK version: 19.2.5345600

My main questions are:

  1. Is my CMake file ok or am I missing something?
  2. Should the boost files be getting generated so that I can see them/open them? If so, to what location?

Any help is welcome. Thanks!

@Orphis
Copy link
Owner

Orphis commented May 23, 2019

A few comments first:

  • You shouldn't have the find_package() call as Boost is provided in the workspace directly.
  • There is no circular_buffer component in my distribution, you should just use Boost::boost (it's header only I believe).

Now, I notice the "" in your paths, so I'm guessing you are using Windows. It looks like the whole path is too deep and reaching the limit (about 260 characters long). Usually, the course of action from there is to make sure that "MyProjectPath" is as short as needed not to hit the limit.

@Orphis
Copy link
Owner

Orphis commented May 23, 2019

@seanh1986
Copy link
Author

Thanks for the quick reply!

Also, thanks for the clarification on the find_package() and the Boost::boost tip. I have made the following modifications to my above cmake file:

  • Removed the find_package() line
  • Changed "Boost::circular_buffer" to "Boost::boost" in the target_link_libraries

Yes, I am using Windows 10 and I am aware of the path limitations, so I have my repos located so that the path is nearly as short as possible.

Anyways, I verified that the path:
[MyProjectPath]\.externalNativeBuild\cmake\debug\armeabi-v7a\_deps\boost-cmake-src\.git\objects\pack\pack-9f2195dfb9d14b5d14c811b719879a70f0210228.pack

is only 202 characters long (including spaces), so I'm guessing that's not the problem.

I noticed that in my path, I have:
.\.externalNativeBuild\cmake\debug\arm64-v8a\_deps\boost-src\boost

Which appears to have the entire boost library. When I add Boost::boost, I'm guessing that is what is being included, correct (obviously different folders for debug/release and architecture type)?

Assuming my cmake is as described, I will assume that the issue I am facing is not related to the boost-cmake integration and is related to something else.

@Orphis
Copy link
Owner

Orphis commented May 24, 2019

If the path is short, then you have a local issue. You should try to go into the boost-cmake-src folder above and run some git operations manually to see if they succeed or fail and debug it from there.

As for using Boost::boost, yes it will build what you use as needed in the right mode.

@seanh1986
Copy link
Author

Hi @Orphis thanks for your help. I managed to resolve the issue and I am now no longer get that error. However, I am getting a weird error that I don't know if it's boost 1.70 specific or something...

Basically, boost itself seems to be missing includes that it needs.

In the file boost/circular_buffer/base.hpp, I have the following issues

  • Missing include for details.hpp, otherwise it cannot find "cb_details::const_traits"
  • "BOOST_CB_ASSERT" and ".is_valid( ... )" all seem to be missing imports, etc.

Note: other issues exist in other files, as well. I tried manually adding the 'recommended' imports, but that just caused a chain reaction of missing imports that I couldn't resolve.

Do you have any thoughts or suggestions? Have you ever seen anything like that before?

I saw that they have a released/tagged version of boost 1.70, so presumably it should be stable or at least build
(See: https://github.com/boostorg/circular_buffer/releases/tag/boost-1.70.0)

I don't know if maybe the boost importing script is missing somethings or not? Currently, I'm still only importing "Boost::boost", which I believe should be everything?

Thanks for your help!

@seanh1986
Copy link
Author

Is there a way I can provide a custom path for where the boost files get generated to?
I'm guessing in the:
add_subdirectory(${boost-cmake_SOURCE_DIR} ${boost-cmake_BINARY_DIR})

Note: I have experimented with including EXCLUDE_FROM_ALL and not and it didn't seem to help.

Right now, it's building all the boost library and putting them in temporary files that git is ignoring. For code sharing purposes, it would be best if I can control where only the final boost files go.

Either way, my above issue is still the same, it appears to be building boost but some boost files appear to be missing imports or maybe not all required boost files got built? I'm not sure you can help with this, but any assistance is greatly appreciated!

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants