Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building APK fails because of unknown switch of 7z #11797

Closed
ilyats opened this issue May 11, 2024 · 5 comments · Fixed by #11800
Closed

Building APK fails because of unknown switch of 7z #11797

ilyats opened this issue May 11, 2024 · 5 comments · Fixed by #11800
Labels

Comments

@ilyats
Copy link

ilyats commented May 11, 2024

I am trying to build debug APK from git.
I get the following error

cd koreader-android-armv7a-unknown-linux-android18-debug/koreader && \
	./tools/mk7z.sh \
	../../platform/android/luajit-launcher/assets/module/koreader.7z \
	"$(git show -s --format='%ci')" \
	-m0=lzma2 -mx=9 \
	-- . \
	'-x!cache' \
	'-x!clipboard' \
	'-x!data/dict' \
	'-x!data/tessdata' \
	'-x!history' \
	'-x!l10n/templates' \
	'-x!libs' \
	'-x!ota' \
	'-x!resources/fonts*' \
	'-x!resources/icons/src*' \
	'-x!rocks/bin' \
	'-x!rocks/lib/luarocks' \
	'-x!screenshots' \
	'-x!sdcv' \
	'-x!spec' \
	'-x!tools' \
	'-xr!.*' \
	'-xr!COPYING' \
	'-xr!NOTES.txt' \
	'-xr!NOTICE' \
	'-xr!README.md' \
	;


Command Line Error:
Unknown switch:
-l

Looking at mk7z.sh shows that it runs ${sevenzip}" -l ... several times. I am using Debian unstable, my version of 7z comes from package 7zip version 23.01+dfsg-12 and it does not support -l switch.

@Frenzie
Copy link
Member

Frenzie commented May 11, 2024

I can confirm that for 7-zip 23.01. In 16.02 the -l switch isn't documented, so I'm not sure what it does, but presumably it can be safely removed. It was added in #6587

$ 7z --help

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,16 CPUs AMD Ryzen 7 PRO 6850U with Radeon Graphics      (A40F41),ASM,AES-NI)

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a : Add files to archive
  b : Benchmark
  d : Delete files from archive
  e : Extract files from archive (without using directory names)
  h : Calculate hash values for files
  i : Show information about supported formats
  l : List contents of archive
  rn : Rename files in archive
  t : Test integrity of archive
  u : Update files to archive
  x : eXtract files with full paths

<Switches>
  -- : Stop switches parsing
  -ai[r[-|0]]{@listfile|!wildcard} : Include archives
  -ax[r[-|0]]{@listfile|!wildcard} : eXclude archives
  -ao{a|s|t|u} : set Overwrite mode
  -an : disable archive_name field
  -bb[0-3] : set output log level
  -bd : disable progress indicator
  -bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
  -bt : show execution time statistics
  -i[r[-|0]]{@listfile|!wildcard} : Include filenames
  -m{Parameters} : set compression Method
    -mmt[N] : set number of CPU threads
  -o{Directory} : set Output directory
  -p{Password} : set Password
  -r[-|0] : Recurse subdirectories
  -sa{a|e|s} : set Archive name mode
  -scc{UTF-8|WIN|DOS} : set charset for for console input/output
  -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
  -scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands
  -sdel : delete files after compression
  -seml[.] : send archive by email
  -sfx[{name}] : Create SFX archive
  -si[{name}] : read data from stdin
  -slp : set Large Pages mode
  -slt : show technical information for l (List) command
  -snh : store hard links as links
  -snl : store symbolic links as links
  -sni : store NT security information
  -sns[-] : store NTFS alternate streams
  -so : write data to stdout
  -spd : disable wildcard matching for file names
  -spe : eliminate duplication of root folder for extract command
  -spf : use fully qualified file paths
  -ssc[-] : set sensitive case mode
  -ssw : compress shared files
  -stl : set archive timestamp from the most recently modified file
  -stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
  -stx{Type} : exclude archive type
  -t{Type} : Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options
  -v{Size}[b|k|m|g] : Create volumes
  -w[{path}] : assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]{@listfile|!wildcard} : eXclude filenames
  -y : assume Yes on all queries

@Frenzie Frenzie transferred this issue from koreader/android-luajit-launcher May 11, 2024
@benoit-pierre
Copy link
Contributor

Look like they completely removed the full version, so now installing p7zip-full give you the same version as 7zip, with no support for -l (don't store symlinks)… ¯\(ツ)

As a workaround, I suggest getting a working binary from there: https://github.com/p7zip-project/p7zip/releases.

@benoit-pierre
Copy link
Contributor

benoit-pierre commented May 11, 2024

I'm looking at detecting if -l is needed, and found a subtle bug with the manifest optimization in tools/mk7z.sh:

▹ 7z -ba h frontend/apps/reader/modules/readerfooter.lua
0E036904        114233  frontend/apps/reader/modules/readerfooter.lua
▹ echo 0E036904 | awk '{ if ($1) print $1 }'
▹ awk 'BEGIN { print 0E036904; print 1E2 }'
0
100
▹ echo 0E036904 | awk '{ if ("$1") print $1; }'
0E036904

@benoit-pierre
Copy link
Contributor

Except:

# "$3" is not interpolated:echo "1 2 0E036904" | awk '{ print "$3" }'
$3echo "1 2" | awk '{ if("$3") print $1, $2, $3 }'
1 2
# So we really need:echo "1 2" | awk '{ if($3!="") print $1, $2, $3 }'echo "1 2 0E036904" | awk '{ if($3!="") print $1, $2, $3 }'
1 2 0E036904

@benoit-pierre
Copy link
Contributor

@ilyats: can you give the version in #11800 a whirl?

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

Successfully merging a pull request may close this issue.

3 participants