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

hunter-package updates #412

Closed
4 of 5 tasks
headupinclouds opened this issue May 5, 2017 · 6 comments
Closed
4 of 5 tasks

hunter-package updates #412

headupinclouds opened this issue May 5, 2017 · 6 comments

Comments

@headupinclouds
Copy link
Collaborator

headupinclouds commented May 5, 2017

  • imshow fixes in submodule
  • xgboost fixes (WIP)
  • beast (submodule + target_include_directories() -- cmake needs work)

Possible:

  • xgboostcpp : started moving C++ xgboost interface class to public xgbostcpp lib
  • to_string.h ?

Note: Multiple projects need stdlib patches (to_string) to use cereal on Android (pre libc++ (at least)). This has been added via a minimal header, and I'm starting to copy and paste this to different project. Cavet: This involves patching/adding to the std:: namespace for those toolchains. It would be best to push this to cereal, but understandably (per older issues/discussions), cereal prefers to code to a C++11 standard without including local workarounds. Eventually the Android standard library will be complete, but for now it might make sense to include the bare minimum to_string implementation in a single header-only INTERFACE library in the interim.

@ruslo
Copy link
Collaborator

ruslo commented May 5, 2017

it might make sense to include the bare minimum to_string implementation in a single header-only INTERFACE library in the interim.

Sounds dangerous. What is the problem exactly? Is the error in libc++? Do update to latest NDK helps?

@headupinclouds
Copy link
Collaborator Author

headupinclouds commented May 5, 2017

For reference, here is the main issue:

/Users/dhirvonen/devel/ruslo/hunter/_Base/xxxxxxx/cda3b20/9201547/Install/include/cereal/cereal.hpp:679:101: error: 'to_string' is not a member of 'std'
           throw Exception("Error while trying to deserialize a smart pointer. Could not find id " + std::to_string(id));

The issue stems from a missing to_string() in the android ndk standard library. I think this might be available in more recent ndk builds w/ libc++. I don't know what options are available for gcc toolchains where lto + MinSizerel still works. Also, newer libc++ ndk libs don't seem to be very stable yet. Adding to std:: is definitely "bad practice", but I think such a patch is a lesser evil here, given that it will eventually be supported, and cereal is a very good solution from cross platform serialization that works elsewhere. I've been relying on this for Android builds using the cereal portable archive files for a while, and have not hit any snags so far. Boost serialization works fine on these platforms, but boost adds another 400K or so in the final library and a fairly long build time.

Background:
USCiLab/cereal#234 (comment)
USCiLab/cereal#307 (comment)

EDIT: Maybe it is preferable to include the local std:: patches in each library as a private header along with the cereal additions. A cmake platform check for availability would be useful to pull in the header as needed.

@headupinclouds
Copy link
Collaborator Author

assimp/assimp#892 (comment)

FWIW, std::to_string is in fact supported by the NDK, but it requires use of the LLVM libc++ runtime (see also https://developer.android.com/ndk/guides/cpp-support.html#cs).

assimp/assimp#892 (comment)

You should be able to use libc++ with both gcc and clang.

@headupinclouds
Copy link
Collaborator Author

But... libc++ doesn't seem to be stable quite yet (from an android-ndk developer):

android/ndk#379 (comment)

libc++ is in much better shape than it was back then, but it's still not quite to the point that I'm comfortable recommending it. For a timeline on that, see our roadmap.

@headupinclouds
Copy link
Collaborator Author

What about a patched cereal in hunter-packages (non-standard version that needs to be added explicitly by the user)? That will avoid a whole bunch of repetition across projects and should support cereal use in Android toolchains via hunter until libc++ stabilizes.

@ruslo
Copy link
Collaborator

ruslo commented May 6, 2017

What about a patched cereal in hunter-packages

I think it's fine. Actually this patch looks good, we just need to update CMakeLists.txt with option and public define.

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