Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

no NDK arm-linux-androideabi-gcc on $PATH at (eval 10) line 124. #105

Open
kangwang1988 opened this issue Dec 7, 2020 · 10 comments
Open

Comments

@kangwang1988
Copy link

kangwang1988 commented Dec 7, 2020

@vgorloff
Thanks for your job.

When running "node main.js bootstrap", I met error here:

cd /Users/kylewong/Codes/Swift/swift-everywhere-toolchain/ToolChain/Sources/ssl && \
   ANDROID_NDK=/usr/local/ndk/21.3.6528147 PATH=/usr/local/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH \
   ./Configure \
   -D__ANDROID_API__=21 \
   --prefix=/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/ToolChain/Install/darwin-armv7a/ssl \
   android-arm
Configuring OpenSSL version 1.1.1d (0x1010104fL) for android-arm
Using os-specific seed configuration

Failure!  build file wasn't produced.
Please read INSTALL and associated NOTES files.  You may also have to look over
your available compiler tool chain or change your configuration.

no NDK arm-linux-androideabi-gcc on $PATH at (eval 10) line 124.
Execution of command is failed:
cd /Users/kylewong/Codes/Swift/swift-everywhere-toolchain/ToolChain/Sources/ssl && \
   ANDROID_NDK=/usr/local/ndk/21.3.6528147 PATH=/usr/local/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH \
   ./Configure \
   -D__ANDROID_API__=21 \
   --prefix=/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/ToolChain/Install/darwin-armv7a/ssl \
   android-arm

If error was due Memory, CPU, or Disk peak resource usage (i.e. missed file while file exists),
then try to run previous command again. Build process will perform "configure" step again,
but most of compilation steps will be skipped.

/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/lib/Tool.js:82
      throw error;
      ^

Error: Command failed: cd /Users/kylewong/Codes/Swift/swift-everywhere-toolchain/ToolChain/Sources/ssl && \
   ANDROID_NDK=/usr/local/ndk/21.3.6528147 PATH=/usr/local/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH \
   ./Configure \
   -D__ANDROID_API__=21 \
   --prefix=/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/ToolChain/Install/darwin-armv7a/ssl \
   android-arm
    at checkExecSyncError (child_process.js:630:11)
    at Object.execSync (child_process.js:666:15)
    at SSLBuilder.execute (/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/lib/Tool.js:72:10)
    at SSLBuilder.executeCommands (/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/lib/Tool.js:89:10)
    at SSLBuilder.executeConfigure (/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/lib/Builders/SSLBuilder.js:62:10)
    at SSLBuilder.configure (/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/lib/Builder.js:79:10)
    at SSLBuilder.make (/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/lib/Builder.js:96:10)
    at SSLBuilder.runAction (/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/lib/Builder.js:62:12)
    at /Users/kylewong/Codes/Swift/swift-everywhere-toolchain/Automation.js:123:57
    at Array.forEach (<anonymous>) {
  status: 2,
  signal: null,
  output: [ null, null, null ],
  pid: 22798,
  stdout: null,
  stderr: null
}

arm-linux-androideabi-gcc indeed doesn't exist in the ndk.

kylewong@KyleWongs-MacBook-Pro swift-everywhere-toolchain % ls ~/Library/Android/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/bin | grep gcc

How to resolve this issue?

@vgorloff
Copy link
Owner

vgorloff commented Dec 7, 2020

Seems you got this case:

One can engage clang by adjusting PATH to cover same NDK's clang. Just keep in mind that if you miss it, Configure will try to use gcc...

Source: https://github.com/openssl/openssl/blob/master/NOTES-Android.md

That is seems why Configure trying to use arm-linux-androideabi-gcc.


Try to comment or remove line -D__ANDROID_API__=${ndk.api} in file lib/Builders/SSLBuilder.js. Maybe it will help.

Before:

  executeConfigure() {
    this.clean();

    var ndk = new NDK();
    // Seems `-D__ANDROID_API__` not needed. See: #{@sources}/NOTES.ANDROID
    var cmd = `
    ${this.options}
    ./Configure
    // -D__ANDROID_API__=${ndk.api} <<<<<<<<<<<<< THIS LINE IS NOW COMMENTED.
    --prefix=${this.paths.installs}
    `;
    if (this.arch.name == Archs.arm.name) {
      cmd = `${cmd} android-arm`;
    } else if (this.arch.name == Archs.arm64.name) {
      cmd = `${cmd} android-arm64`;
    } else if (this.arch.name == Archs.x86.name) {
      cmd = `${cmd} android-x86`;
    } else if (this.arch.name == Archs.x86_64.name) {
      cmd = `${cmd} android-x86_64`;
    }
    this.executeCommands(`cd ${this.paths.sources} && ${cmd}`);
  }

Then execute: node main.js ssl:make arch:armv7a

@vgorloff
Copy link
Owner

vgorloff commented Dec 7, 2020

btw. Similar issue: openssl/openssl#11192

Maybe you have environment variable "CC" set somewhere?

@vgorloff
Copy link
Owner

vgorloff commented Dec 7, 2020

btw: Another similar issue: openssl/openssl#8941

@kangwang1988
Copy link
Author

Unfortunately, neither of it works.

@vgorloff
Copy link
Owner

vgorloff commented Dec 7, 2020

OK. What command perl configdata.pm --dump returns?

cd ToolChain/Sources/ssl/
perl configdata.pm --dump

@kangwang1988
Copy link
Author

OK. What command perl configdata.pm --dump returns?

cd ToolChain/Sources/ssl/
perl configdata.pm --dump

kylewong@KyleWongs-MacBook-Pro ssl % perl configdata.pm --dump
Can't open perl script "configdata.pm": No such file or directory
kylewong@KyleWongs-MacBook-Pro ssl % pwd
/Users/kylewong/Codes/Swift/swift-everywhere-toolchain/ToolChain/Sources/ssl

@vgorloff
Copy link
Owner

vgorloff commented Dec 8, 2020

Hm. The file configdata.pm even was not generated. Super strange.

Well. If the commands below not working, then it is an issue of SSL. Seems would be more effective to ask them as well: https://github.com/openssl/openssl/issues.

cd ToolChain/Sources/ssl
git clean --quiet -f -X
git clean --quiet -f -x -d
export ANDROID_NDK_HOME=/usr/local/ndk/21.3.6528147
export ANDROID_NDK_ROOT=/usr/local/ndk/21.3.6528147
PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/darwin-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin:$PATH
./Configure android-arm64 -D__ANDROID_API__=29
make SHLIB_VERSION_NUMBER= SHLIB_EXT=.so

Build commands taken from: https://github.com/openssl/openssl/blob/master/NOTES-Android.md

@michaelknoch
Copy link

I ran into the same issue locally and I found out that it only happens when /usr/local/ndk/21.3.6528147 is a symlink. Not sure why, as far as I know it should be possible to add symlinks to $PATH but in that case it doesn't work.

PATH=/usr/local/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH
   ./Configure android-arm -D__ANDROID_API__=21

# Failure!  build file wasn't produced.
# Please read INSTALL and associated NOTES files.  You may also have to look over
# your available compiler tool chain or change your configuration.

# no NDK arm-linux-androideabi-gcc on $PATH at (eval 10) line 124.
# configures successfully

PATH=/Users/username/Library/Android/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH \
   ./Configure -D__ANDROID_API__=21 android-arm

I used this commit to workaround it locally. I can open a pr if this makes sense for you as well.

@vgorloff

@vgorloff
Copy link
Owner

vgorloff commented May 5, 2021

Interesting. Thank you for the figuring out this issue!

The whole idea of NDK symbolic link – is to have "similar path on user side" in "umbrella header" when setting up glibc.modulemap (e.g. /.../swift-android-toolchain/usr/lib/swift/android/armv7/glibc.modulemap). But of cause symbolic link not really needed during build time.

I will try to use your @michaelknoch commit to make two separate variables for NDK path: one will be used during build time (non symlinked) and another will be used when packing toolchain for distribution.

@vgorloff
Copy link
Owner

vgorloff commented May 8, 2021

Maybe the issue is solved in release https://github.com/vgorloff/swift-everywhere-toolchain/releases/tag/1.0.68. In this release the non-symlinked (absolute paths) to NDK tools were used.

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

No branches or pull requests

3 participants