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

ambiguous constructor error with clang7 from ndk #100

Closed
DDoSolitary opened this issue Dec 27, 2022 · 5 comments
Closed

ambiguous constructor error with clang7 from ndk #100

DDoSolitary opened this issue Dec 27, 2022 · 5 comments

Comments

@DDoSolitary
Copy link

DDoSolitary commented Dec 27, 2022

I'm trying to build boost 1.80 with the Clang 7 compiler provided by NDK r18b and got the following error

In file included from libs/thread/src/future.cpp:10:
In file included from ./boost/thread/futures/future_error_code.hpp:13:
In file included from ./boost/system/error_code.hpp:13:
./boost/system/detail/error_code.hpp:615:29: error: call to constructor of 'std::error_code' is ambiguous
            std::error_code e2( *this );
                            ^   ~~~~~
/opt/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/system_error:500:24: note: candidate is the implicit copy constructor
class _LIBCPP_TYPE_VIS error_code
                       ^
/opt/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/system_error:500:24: note: candidate is the implicit move constructor
1 error generated.

It seems to be the same error for which a special deleted declaration was added a6c4b63. But the check fails to catch my clang version.

$ /opt/android-toolchain/bin/aarch64-linux-android-clang++ --version
Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
Target: aarch64-none-linux-android21
Thread model: posix
InstalledDir: /opt/android-toolchain/bin
@pdimov
Copy link
Member

pdimov commented Dec 27, 2022

It looks like the same issue, yes. Does it work if you define the macro BOOST_SYSTEM_CLANG_6, which is defined for Clang 6 and earlier by

# define BOOST_SYSTEM_CLANG_6
?

@DDoSolitary
Copy link
Author

@pdimov Yes, manually defining the macro fixes the error.

@pdimov
Copy link
Member

pdimov commented Jan 9, 2023

The normal Clang 7.0.0, 7.0.1 works, so this Android build should be something slightly different that identifies as 7.0.2 but isn't. Any suggestions as to how the condition in detail/config.hpp needs to be changed to fix your issue?

#if defined(__clang__) && (__clang_major__ < 7 || (defined(__APPLE__) && __clang_major__ < 11) || (defined(__ANDROID__) && __clang_major__ == 7))

perhaps?

@DDoSolitary
Copy link
Author

DDoSolitary commented Jan 9, 2023

I also tested normal clang 7.0.0 and can confirm it works. I think adding the __ANDROID__ && clang == 7 check should fix the error for me, though I didn't test any newer clang versions provided by Android NDK

@pdimov
Copy link
Member

pdimov commented Jan 10, 2023

OK, let's give it a try.

@pdimov pdimov closed this as completed in b3faedf Jan 10, 2023
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