-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
libc++ cmath math functions not found because of -isystem $PREFIX/include added by CMake #1149
Comments
yeah for c++ the first include should be include/c++/4.9.0 or include/c++/v1 or some variation. What can occur is that c++ includes in same dir as include. Cmake is changing the first include dir to onclude. Before we changed to libc++_shared cmake doing this likely had no effect so you wouldn't notice as it would find the right headers either first or second time round. Then again i could be wrong... |
Yeah, @its-pointless got it. It would try to get these functions from |
Does the recent update to cmake 3.9 improve things? |
No, no difference with CMake 3.9.0. My guess is that CMake generates I just tried it on another phone on which I haven't upgraded Termux to use the latest ndk and libc++. It wasn't completely clean, as I didn't have an old CMake installed on there, so I had to install CMake 3.9 and libc++ but not the updated ndk packages, and I didn't hit this error there. Looks like CMake was adding It appears this issue is a consequence of adding another |
@joakim-noah Does the patch in android/ndk#467 fix the problem? |
I don't think it will make a difference, as I originally ran into this problem with CMake 3.8.2 and his problem is that |
Alright, spent some time tracking this down. The issue is that ldc's As explained in android/ndk#452, adding that I could work around this issue by simply removing the |
I no longer see this issue when compiling |
Never saw it with llvm but with ldc, which was pulling in |
I am seeing this issue while trying to compile opencv from their master on github. Removing |
In my case, it is because of this line in the Ideally, I guess CMake for Termux would be patched to ignore that system directory. |
I just pushed out an updated version 16-4 of the ndk-stl package, which includes the following diff: https://github.com/termux/termux-packages/blob/master/packages/ndk-stl/math-header.diff @joakim-noah @johncant @stephengroat @its-pointless Could you try it out and see if it fixes the problem here without causing new ones? |
@fornwall, looks like that error is fixed now:
|
@fornwall i'm still getting the error on #1169 build system
|
This patch fixes the issue for me with ldc, but it's just a workaround for the bigger issue: CMake needs to filter out the Termux $PREFIX/include when that include path is given higher priority by a |
on current system (as of 1/21/2018)
|
This broke with the latest NDK update, @its-pointless forgot to move the patch over to ndk-sysroot? |
@buttaface |
i guess this illustrates the benefits of regression testing. |
Two math C++ includes, you got them both now. |
This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Build fails with similar error as in #1149
Is this issue still relevant? |
I don't think so, as I recently removed the workaround for this, 395e1c9, and nobody complained. |
Nice work switching everything over to libc++, I've been recompiling llvm and the latest ldc to use it, mostly no problems so far. However, there is an older pure C++ version of ldc that we maintain and it has a problem compiling a C++ file that calls some llvm headers that ultimately invoke
cmath
:Tracking this down, I found that the
CXX_INCLUDES
generated by CMake has this definition, removing it fixes the problem:I can't find much info on how
CXX_INCLUDES
is generated. What's weird is that I don't see that particular-isystem
flag for ldc 1.3 when compiling in Termux, so CMake seems to be behaving differently there.I can reproduce with this sample file compiled in Termux:
Normal compilation,
clang++ foo.cpp
, works, but this doesn't:I'm not sure if that should work or if CMake shouldn't be adding that flag, let me know.
The text was updated successfully, but these errors were encountered: