Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

buck fails to include SLES/OpenSLES.h with the android-ndk-r10e #306

Closed
bmihai opened this issue May 16, 2015 · 12 comments
Closed

buck fails to include SLES/OpenSLES.h with the android-ndk-r10e #306

bmihai opened this issue May 16, 2015 · 12 comments
Labels

Comments

@bmihai
Copy link

bmihai commented May 16, 2015

I have a project that uses OpenSL ES. Building worked fine with android-ndk-r10d, but fails with the newly released r10e:

[...] fatal error: SLES/OpenSLES.h: No such file or directory
 #include <SLES/OpenSLES.h>

To switch between the two NDK versions, I change the ndk.dir in local.properties. Is there something else I should also be changing maybe?

@sdwilsh
Copy link
Contributor

sdwilsh commented May 18, 2015

I'm downloading the new NDK now to figure out what changed.

@sdwilsh sdwilsh self-assigned this May 18, 2015
@sdwilsh
Copy link
Contributor

sdwilsh commented May 18, 2015

Hmm, the headers are there in both cases. A couple of questions to make sure this isn't a bug still:

  • Are you using ndk_library or cxx_library?
  • If you run buck clean first, does the problem go away?

@bmihai
Copy link
Author

bmihai commented May 18, 2015

Thank you for looking into this sdwilsh!

I'm using ndk_library(), and buck clean does not change things. I'm using the latest buck from the repository.

I've tried keeping all the changes that should have (but did not) work with r10e, and replacing the files of the r10e folder with the ones of r10d: with this 'faked' r10e it worked. So, something in android-ndk-r10e is breaking buck (or at least my buck).

I'll try to reproduce it in a modified buck quickstart project, and will write back.

@bmihai
Copy link
Author

bmihai commented May 18, 2015

Well, with a modified buck quickstart I'm getting SLES/OpenSLES.h: No such file or directory with both r10d and r10e. It looks like it might be a configuration problem on my end, and the fact that r10d worked is the odd thing. Will look into this again tomorrow.

@sdwilsh
Copy link
Contributor

sdwilsh commented May 18, 2015

Hmm, okay. This looks like a support issue then, so I'm going to close it and encourage you to use Stack Overflow (just tag it with Buck and I'll see it). Thanks for filing this though since you thought you had a bug, and if you happen to find a bug, feel free to post here and I'll reopen it.

@bmihai
Copy link
Author

bmihai commented May 27, 2015

I've had a bit more time to look into this. (I'm writing this here because I feel it's a bit too specific for stackoverflow.com, and it looks like a bug in either buck or android-ndk.)

I was able to reproduce the problem in a minimal buck quickstart project. The reason I wasn't before was that I'd forgotten to create an Application.mk file. Interestingly enough, it seems the problem with r10e+buck is that it doesn't find Application.mk, so the failure mode was the same. I've uploaded a minimal test project to github.

I've narrowed the cause of the problem down to one of the arguments buck passes to ndk-build: 'APP_PROJECT_PATH=/home/mihai/tmp/delme/buck-out/bin/jni/__libbugtest/'. Manually calling the ndk-build with this argument removed completes the compilation, and if buck build is re-run, it happily declares the build complete.

When this arg is passed to the r10e ndk-build, it calls gcc with a -I [...]/android-ndk-r10e/platforms/android-3/arch-arm/usr/include. If r10d is used or the APP_PROJECT_PATH argument is removed, it uses -I [...]/android-ndk-r10e/platforms/android-9/arch-arm/usr/include. (So, android-3 for the bad case, and android-9 for the good).

Using flags = ['NDK_LOG=1'], shows how ndk-build behaves differently with r10d:

Android NDK: Looking for jni/Android.mk in /home/mihai/tmp/delme/jni
Android NDK: Looking for jni/Android.mk in /home/mihai/tmp/delme
Android NDK:     Found it !
Android NDK: Found project path: /home/mihai/tmp/delme
Android NDK: Ouput path for intermediate files: /home/mihai/tmp/delme/buck-out/bin/jni/__libbugtest/
Android NDK: Ouput path for generated library files: /home/mihai/tmp/delme/buck-out/bin/jni/__libbugtest/libs
Android NDK: Parsing /home/mihai/tmp/delme/jni/Application.mk
Android NDK:   Adjusting APP_PLATFORM android-11 to android-9

versus r10e:

Android NDK: Use APP_PROJECT_PATH for NDK_PROJECT_PATH: /home/mihai/tmp/delme/buck-out/bin/jni/__libbugtest/
Android NDK: Found project path: /home/mihai/tmp/delme/buck-out/bin/jni/__libbugtest/
Android NDK: Ouput path for intermediate files: /home/mihai/tmp/delme/buck-out/bin/jni/__libbugtest/
Android NDK: Ouput path for generated library files: /home/mihai/tmp/delme/buck-out/bin/jni/__libbugtest/libs
Android NDK: Parsing /home/mihai/bin/android-ndk-r10e/build/core/default-application.mk
Android NDK:   Defaulted to APP_PLATFORM=android-3

So, with r10e, APP_PROJECT_PATH is causing ndk-build to not see Application.mk anymore and use default values for APP_PLATFORM. I believe the behaviour is due to a 17-line segment of code added by the Android devs at line 93 in android-ndk-r10e/build/core/build-local.mk. But buck should be handling this somehow, I believe?

@sdwilsh
Copy link
Contributor

sdwilsh commented May 29, 2015

Do you have an AndroidManifest.xml alongside those as well? I've seen that fix issues like this in the past (it can be empty).

@bmihai
Copy link
Author

bmihai commented May 30, 2015

Yup, there's the apps/myapp/AndroidManifest.xml that buck quickstart creates (you can see it in the minimal project I uploaded here).

@bmihai
Copy link
Author

bmihai commented Jun 1, 2015

Shawn, would it be worth reopening this? I believe it's a genuine bug, and seems like a significant one.

@sdwilsh
Copy link
Contributor

sdwilsh commented Jun 1, 2015

I thought it was open again :)

I need to spend some time figuring out what a compatible fix is, but your investigation should help a lot. I may not get to it this week, however :/

@sdwilsh sdwilsh reopened this Jun 1, 2015
@bmihai
Copy link
Author

bmihai commented Jun 1, 2015

No problem, as long as it's on the radar somewhere! :)

Thank you.

@powderluv
Copy link

Im hitting the same problem with r10e.

Updated (1/15/16): Still seen on top of master 3c42b08

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

No branches or pull requests

4 participants