How to set temporary directory when building cyanogenmod - android

I am trying to build cyanogenmod, but the build fails with the following. My drive on /mnt has plenty of space, however the root-partition where /tmp resides has less space, so I assume this happens while writing a temporary file.
Therefore I would like to redirect the temporary directory for this to somewhere under /mnt as well, how can I do this in cyanogenmod/Android build system? I tried setting TMP and TEMP but they don't seem to have any effect.
Package OTA: /mnt/android/system/out/target/product/oneplus3/cm_oneplus3-ota-178d4560f4.zip
unzipping target target-files...
running: unzip -o -q /mnt/android/system/out/target/product/oneplus3/obj/PACKAGING/target_files_intermediates/cm_oneplus3-target_files-178d4560f4.zip -d /tmp/targetfiles-RM6VsH
--- target info ---
...
cache_size = (int) 268435456
...
recovery_size = (int) 67108864
...
userdata_size = (int) 57436708864
(using device-specific extensions from target_files)
loaded device-specific extensions from /tmp/targetfiles-RM6VsH/META/releasetools.py
Warning: could not find RADIO/filesmap in <zipfile.ZipFile object at 0x2b4193f91fd0>.
using prebuilt recovery.img from BOOTABLE_IMAGES...
using system.img from target-files
Total of 770048 4096-byte output blocks in 2698 input chunks.
Generating digraph...
Finding vertex sequence...
Reversing backward edges...
0/0 dependencies (0.00%) were violated; 0 source blocks stashed.
Improving vertex order...
Revising stash size...
Total 0 blocks are packed as new blocks due to insufficient cache size.
Reticulating splines...
Traceback (most recent call last):
File "./build/tools/releasetools/ota_from_target_files", line 1772, in <module>
main(sys.argv[1:])
File "./build/tools/releasetools/ota_from_target_files", line 1727, in main
WriteFullOTAPackage(input_zip, output_zip)
File "./build/tools/releasetools/ota_from_target_files", line 664, in WriteFullOTAPackage
system_diff = common.BlockDifference("system", system_tgt, src=None)
File "/mnt/android/system/build/tools/releasetools/common.py", line 1302, in __init__
b.Compute(self.path)
File "/mnt/android/system/build/tools/releasetools/blockimgdiff.py", line 299, in Compute
self.ComputePatches(prefix)
File "/mnt/android/system/build/tools/releasetools/blockimgdiff.py", line 618, in ComputePatches
new_f.write(piece)
IOError: [Errno 28] No space left on device
make: *** [/mnt/android/system/out/target/product/oneplus3/cm_oneplus3-ota-178d4560f4.zip] Error 1
make: Leaving directory `/mnt/android/system'
Update: I found a workaround by editing /mnt/android/system/build/tools/releasetools/common.py and setting a temp-dir manually with something like tmpdir = tempfile.mkdtemp(dir='/mnt/tmp') at line 1299, according to documentation mkdtemp should use TMP and TEMP, however that seems to not have worked for me here! Python is at version 2.7.6.

To set the TMPDIR environment variable, specify a directory that is accessible to the user ID that runs the replication or publishing programs. Ensure that files cannot be deleted by other user IDs.
For example, the following command specifies the /home/repldba/tempfiles/ directory:
export TMPDIR=/home/repldba/tempfiles/

Related

Buildozer error when compiling Android: list index out of range inside _install_p4a

I'm currently trying to compile a simple Kivy app for use on Android. It runs in both my windows and linux environments without errors or warnings. When I go to package it using buildozer I get an error almost immediately. I did search for this error and although the title is very similar to other questions, the error is not.
Output from buildozer:
(mykivyinstall) oli#Bud: buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Install platform
Traceback (most recent call last):
File "/home/oli/mykivyinstall/bin/buildozer", line 11, in <module>
sys.exit(main())
File "/home/oli/mykivyinstall/lib/python3.6/site-packages/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/home/oli/mykivyinstall/lib/python3.6/site-packages/buildozer/__init__.py", line 1059, in run_command
self.target.run_commands(args)
File "/home/oli/mykivyinstall/lib/python3.6/site-packages/buildozer/target.py", line 92, in run_commands
func(args)
File "/home/oli/mykivyinstall/lib/python3.6/site-packages/buildozer/target.py", line 102, in cmd_debug
self.buildozer.prepare_for_build()
File "/home/oli/mykivyinstall/lib/python3.6/site-packages/buildozer/__init__.py", line 176, in prepare_for_build
self.target.install_platform()
File "/home/oli/mykivyinstall/lib/python3.6/site-packages/buildozer/targets/android.py", line 467, in install_platform
self._install_p4a()
File "/home/oli/mykivyinstall/lib/python3.6/site-packages/buildozer/targets/android.py", line 524, in _install_p4a
deps = re.findall("^install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0]
IndexError: list index out of range
My environment:
buildozer version=0.35
cython version=0.25.2
python version=3.6.6
OS is Ubuntu=18.04
Am I mixing and matching the wrong versions of things?
This seems a like a bug in the latest version of buildozer. The solution is to edit the file "../python3.6/site-packages/buildozer/targets/android.py" and replace the line
deps = re.findall("^install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0]
with
deps = re.findall("install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0]
Then run buildozer -v android debug

Can't compile Chromium for android on Debian 9 - Unable to create file. File name too long

I am trying to compile chromium for android on Debian 9 and I get this error, can someone help me on this?
dacod#phoenix:~/Devel/chromium/src$ ninja -C out/Default cast_shell_apk
ninja: Entering directory `out/Default'
[0/21317] ACTION //third_party/WebKit/Source/bindings/modules/v8:generate...snapshot_external_references(//build/toolchain/android:android_clang_arm)
ninja: error:
WriteFile(__third_party_WebKit_Source_bindings_modules_v8_generate_v8_context_snapshot_external_references___build_toolchain_android_android_clang_arm__rule.rsp):
Unable to create file. File name too long
ninja: build stopped: .
The file system you are building on does not support name sizes long enough to accommodate the 150 character filename:
__third_party_WebKit_Source_bindings_modules_v8_generate_v8_context_snapshot_external_references___build_toolchain_android_android_clang_arm__rule.rsp
Typical file systems will support 255 character file names. Here is a reference:
https://serverfault.com/questions/9546/filename-length-limits-on-linux
However, eCryptfs only supports 143 character file names if it is also configured to encrypt the file names themselves [source]. Are you building in your home folder and is it encrypted? If so, this may be the reason. To check the file name size, run the following in your build folder:
$ getconf NAME_MAX .
143
If it is not 255 you may be building on an ecryptfs partition. Try building in /tmp instead, as it may not be encrypted. You can check this with:
$ getconf NAME_MAX /tmp
255

Incremental OTA zip is not generating

I am trying to generate minor.zip(Incremental OTA zip)file.
Home$build/tools/releasetools/ota_from_target_files -i
out/target/product/xxx/OTA_20170916.zip
out/target/product/xxx/OTA-20171010.zip
out/target/product/xxx/minor.zip
unzipping target target-files...
Traceback (most recent call last):
File "build/tools/releasetools/ota_from_target_files", line 2028, in
<module>
main(sys.argv[1:])
File "build/tools/releasetools/ota_from_target_files", line 1937, in
main
OPTIONS.info_dict = common.LoadInfoDict(input_zip)
File "build/tools/releasetools/common.py", line 141, in LoadInfoDict
raise ValueError("can't find recovery API version in input target-files")
ValueError: can't find recovery API version in input target-files
This error is coming...
I followed this site http://solarex.github.io/wiki/Android/android_ota_update.html
Could you please help to overcome this error
I got solution for incremental OTA zip creation.
Step 1: Copy new OTA and old OTA zip files from out/target/product/xxx/obj/PACKAGING/target_files_intermediates/
Step 2: ./build/tools/releasetools/ota_from_target_files -i old.zip new.zip update.zip
Incremental OTA file will be generate.

Input path limit for Android ndk source file

Is there a known limit on the path for the Android ndk input files? I've run into an issue where the input path is over 155 characters the android g++ command fails to find the file.
The local path back down to my base directory is quite deep, in a few cases I have a full path back to a source file in the jni project making the path a bit long, though 155 doesn't seem like a very high limit.
LOCAL_PATH := $(call my-dir)/../../../../../../../../../..
Here is an example of a failure, at 155 characters:
/cygdrive/c/java/Android/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c jni/VECodecG723/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/./././VECodecG723/VECodecG723.cpp
arm-linux-androideabi-g++.exe: error: jni/VECodecG723/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/./././VECodecG723/VECodecG723.cpp: No such file or directory
arm-linux-androideabi-g++.exe: fatal error: no input files
And a success case, at 153 characters:
/cygdrive/c/java/Android/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c jni/VECodecG723/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/././VECodecG723/VECodecG723.cpp
jni/VECodecG723/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/../gen/././VECodecG723/VECodecG723.cpp:26:17: fatal error: jni.h: No such file or directory
#include <jni.h>
The repeating ../gen is just for this sample, the actual path contains 10 ../ and then the full path back to the file.
I've tried the paths with the regular g++ compiler and it does not fail because of the path length. I have also tried this in a Windows command shell with the android g++ and it has the same issue.
Is there anything I can do short of renaming my folders.
I took another look at this and figured it out. I was running into the max path length for Windows, 260 characters or so. When I added the base path forming an absolute path to the source file the breaking point was around the windows max. No good way around this other than to build on Linux or a Mac.

[Android,Facebook,Infer]Too many open files about infer error

I use Facebook's Infer to check my android code
infer -- ./gradlew build
after 8 minutes
Fatal error: exception Sys_error("/Users/lm/project/android_workplace/******/app/build/intermediates/exploded-aar/com.mogujie/user/1.2.17/jars/classes.jar: Too many open files")
Traceback (most recent call last):
File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/infer", line 180, in <module>
main()
File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/infer", line 144, in main
capture_exitcode = imported_module.gen_instance(args, cmd).capture()
File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/../lib/capture/gradle.py", line 83, in capture
return util.run_commands(cmds)
File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/../lib/capture/util.py", line 40, in run_commands
if not cmd.start():
File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/inferlib.py", line 692, in start
if self.capture() == os.EX_OK:
File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/inferlib.py", line 478, in capture
return self.run_infer_frontend()
File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/inferlib.py", line 469, in run_infer_frontend
self.args.analyzer
File "/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/inferlib.py", line 385, in run_command
raise e
subprocess.CalledProcessError: Command '[u'/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/InferJava', u'-project_root', '/Users/lm/project/android_workplace/Minicooper4android', u'-results_dir', u'/Users/lm/project/android_workplace/Minicooper4android/infer-out', u'-verbose_out', '/var/folders/2r/7hc18jz1091_jg7_8jcnqlhr0000gn/T/javac_qWbfkP.out', u'-models', u'/Users/lm/project/infer_workplace/infer-osx-v0.4.0/infer/bin/../lib/java/models.jar', u'-no-static_final']' returned non-zero exit status 2
From http://fbinfer.com/support
The maximum number of files a program can simultaneously hold open is a bit low on MacOs. You can increase the limit by running these commands for example:
sysctl -w kern.maxfiles=20480
sysctl -w kern.maxfilesperproc=22480
ulimit -S -n 2048

Categories

Resources