ITADN
meganz/sdk/Issues

Android ExampleApp's jni `build.sh all` ends with an error after a `clean`

#2740Closedmuzso 创建于 2025-10-31
bugbuilding-systembindings
M
muzsocommented
**Describe the bug** If you run `build.sh clean` (while in the `<sdk>/examples/android/ExampleApp/app/src/main/jni/` directory) and then try to run `build.sh all`, it results in an error. The output is the following: ``` * Building x86 armeabi-v7a x86_64 arm64-v8a arch(s) * Setting up MEGA * Creating MEGA Java bindings * MEGA is ready * Setting up libsodium * Downloading 'sodium/libsodium-1.0.18.tar.gz' ... * Extracting TAR file... * Extraction finished * Prebuilding libsodium for ARMv7 * Prebuilding libsodium for ARMv8 * Prebuilding libsodium for x86 * Prebuilding libsodium for x86_64 * libsodium is ready * Setting up Crypto++ * Downloading 'cryptopp/cryptopp820.zip' ... * Extracting ZIP file... * Extraction finished * Crypto++ is ready * Setting up SQLite * Downloading 'sqlite/sqlite-amalgamation-3380500.zip' ... * Extracting ZIP file... * Extraction finished * SQLite is ready * Setting up libuv * Downloading 'libuv/libuv-1.42.0.tar.gz' ... * Extracting TAR file... * Extraction finished * Prebuilding libuv for x86 * Prebuilding libuv for armeabi-v7a * Prebuilding libuv for x86_64 * Prebuilding libuv for arm64-v8a * libuv is ready * Setting up ZenLib * Downloading 'mediainfo/6694a744d82d942c4a410f25f916561270381889.zip' ... * Extracting ZIP file... * Extraction finished * ZenLib is ready * Setting up MediaInfo * Downloading 'mediainfo/4ee7f77c087b29055f48d539cd679de8de6f9c48.zip' ... * Extracting ZIP file... * Extraction finished * MediaInfo is ready * Setting up crashlytics touch: cannot touch 'curl/crashlytics.h.ready': No such file or directory ``` The reason is: - `clean` (accidentally) removes the `curl` subdirectory, but it came as part of the repository (with a `.gitignore` and an `Android.mk` file) and is pretty much needed - while the "Setting up crashlytics" part is executing, it tries to create a file in the `curl` subdirectory (`touch ${CURL}/${CRASHLYTICS_SOURCE_FILE}.ready`), but fails since the `curl` subdirectory doesn't exist - the "Setting up crashlytics" part comes before the "Setting up cURL" part, thus the `curl` subdirectory has not yet been recreated either The real problem is the removal of the `curl` subdir in the `clean` operation. While `clean` runs, (among other things) the following commands are executed: ``` rm -rf ${CURL}/${CURL_SOURCE_FOLDER} rm -rf ${CURL}/${CURL} rm -rf ${CURL}/${ARES_SOURCE_FOLDER} rm -rf ${CURL}/ares rm -rf ${CURL}/${CURL_SOURCE_FILE} rm -rf ${CURL}/${ARES_SOURCE_FILE} rm -rf ${CURL}/${CURL_SOURCE_FILE}.ready rm -rf ${CURL}/${CRASHLYTICS_SOURCE_FILE}.ready ``` The `ARES_SOURCE_FOLDER` and the `ARES_SOURCE_FILE` environment variables are undefined (in `build.sh`), thus both commands become this: ``` rm -rf ${CURL}/ ``` Which removes the `curl` subdirectory. Suggestion: apart from removing those two lines (i.e. `rm -rf ${CURL}/${ARES_SOURCE_FOLDER}` and `rm -rf ${CURL}/${ARES_SOURCE_FILE}`), perhaps you could start the script with a `set -eu` instead of just `set -e`. This way the script would halt with an error if it runs into an undefined variable (expansion). Note: it seems that the ["SDK-4666.Remove c-ares related code and building scripts"](https://github.com/meganz/sdk/commit/5a6a8fcf8cc5a36ea1e82134db5667f34bdb3041) commit missed a couple of changes regarding the removal of c-ares. **To Reproduce** Steps to reproduce the behavior: 1. Checkout sdk repo. 2. Change current working directory to `<sdk>/examples/android/ExampleApp/app/src/main/jni`. 3. Run `build.sh clean` 4. Run `build.sh all` **Expected behavior** I expect the build to succeed. **Screenshots** I don't think this is necessary, since the bug (and fix) is well described. And it's trivially reproducible. **Environment:** - SDK Version: v9.16.1 - OS: Ubuntu 22.04.5 LTS - Device: Android **Additional context** No additional context.
关闭于 2025-11-06 1 条评论