Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AndroidStudio compiling native code shows "fcntl(): Bad file descriptor"

I have a legacy app that a fellow developer was seeing fcntl(): Bad file descriptor when building our native cpp code within AndroidStudio.

Our build environment supports building from the command line (for scripting and doing daily automatic builds) using locally installed NDK as well as through AndroidStudio. We set local.properties to point to the locally installed NDK.

I could not determine the cause of the fcntl error and was not seeing it myself when running NDK r17. I then updated to NDK r21d (June 2020) and immediately see the same thing within AndroidStudio.

fcntl(): Bad file descriptor
[arm64-v8a] Compile++      : vhc_jnilib <= Png.cc
fcntl(): Bad file descriptor
[arm64-v8a] Compile++      : vhc_jnilib <= Jpeg.cc
fcntl(): Bad file descriptor
[arm64-v8a] Compile++      : vhc_jnilib <= MyContainer.cc
fcntl(): Bad file descriptor
[arm64-v8a] Compile++      : vhc_jnilib <= aIdentityInfo.cc
fcntl(): Bad file descriptor
[arm64-v8a] Compile++      : vhc_jnilib <= UpdateImage.cc
fcntl(): Bad file descriptor

Android Studio 4.0, MacOS Catalina 10.15.4, Gradle 6

Questions:

  • Any idea how I can get more information on what tool is generating this warning?
  • What does this imply and can it be silenced or fixed?
like image 452
spartygw Avatar asked Jun 12 '20 15:06

spartygw


2 Answers

The project path cannot have spaces.

I have encountered the same problem, when I removed the spaces in the project path, the problem was solved.

like image 134
wanshun liu Avatar answered Oct 19 '22 18:10

wanshun liu


I was having the same issue. I'm not sure what was the actual cause of it, but I got it fixed by deleting .gradle, .cxx & build directories and then rebuilding the project.

like image 25
Palwinder Singh Avatar answered Oct 19 '22 18:10

Palwinder Singh