Open Bug 1672611 Opened 5 years ago Updated 5 years ago

ar: invalid option -- /

Categories

(NSS :: Build, defect, P3)

3.58

Tracking

(Not tracked)

People

(Reporter: leleliu008, Unassigned)

Details

(Whiteboard: [nss-nofx])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36

Steps to reproduce:

run the command : ndk-pkg install nss

Actual results:

......
rm -f build/libnssb.a
/usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar build/arena.o build/error.o build/errorval.o build/hashops.o build/libc.o build/tracker.o build/item.o build/utf8.o build/list.o build/hash.o
arm-linux-androideabi-ar: invalid option -- /
Usage: /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
/usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar -M [<mri-script]
commands:
d - delete file(s) from the archive
m[ab] - move file(s) in the archive
p - print file(s) found in the archive
q[f] - quick append file(s) to the archive
r[ab][f][u] - replace existing or insert new file(s) into the archive
s - act as ranlib
t - display contents of archive
x[o] - extract file(s) from the archive
command specific modifiers:
[a] - put file(s) after [member-name]
[b] - put file(s) before [member-name] (same as [i])
[D] - use zero for timestamps and uids/gids
[U] - use actual timestamps and uids/gids (default)
[N] - use instance [count] of name
[f] - truncate inserted file names
[P] - use full path names when matching
[o] - preserve original dates
[u] - only replace files that are newer than current archive contents
generic modifiers:
[c] - do not warn if the library had to be created
[s] - create an archive index (cf. ranlib)
[S] - do not build a symbol table
[T] - make a thin archive
[v] - be verbose
[V] - display the version number
@<file> - read options from <file>
--target=BFDNAME - specify the target object format as BFDNAME
optional:
--plugin <p> - load the specified plugin
emulation options:
No emulation specific options
/usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
make[3]: *** [build/libnssb.a] Error 1
make[2]: *** [base] Error 2
make[1]: *** [lib] Error 2
make: *** [all] Error 2

I solved this problem by modifying the file nss/coreconf/rules.mk :
chang $(AR) to $(AR) rs $@

Hi, thanks for reporting. The ndk-pkg command looks very cool, thank you for building it.

I'm concerned about patching the AR invocations for all platforms to act as ranlib, as I'm not sure that is going to be compatible on all platforms. The use of the filtered $OBJs rather than $@ is deliberate, and I don't totally understand the ramifications of changing that.

A couple of questions:

  1. Is it possible for you to use the gyp/ninja-based build.sh instead of Make, and see if that handles this platform better?
    It's also a bit curious because NSS is regularly built for Android, but for whatever reason we're hitting this problem here, with the ar in use. I wonder if it's a Make vs Ninja/Gyp issue.

  2. Could https://github.com/leleliu008/ndk-pkg-formula/blob/master/nss.sh be updated so that the AR declaration is instead $AR rs? It might not be the cleanest, but if it's just for this build environment, that might be nicer than trying to isolate down via further ifeq checks in rules.mk.

Thanks!
J.C.

Flags: needinfo?(leleliu008)

(In reply to J.C. Jones [:jcj] (he/him) [increased latency due to COVID-19] from comment #1)

Hi, thanks for reporting. The ndk-pkg command looks very cool, thank you for building it.

I'm concerned about patching the AR invocations for all platforms to act as ranlib, as I'm not sure that is going to be compatible on all platforms. The use of the filtered $OBJs rather than $@ is deliberate, and I don't totally understand the ramifications of changing that.

A couple of questions:

  1. Is it possible for you to use the gyp/ninja-based build.sh instead of Make, and see if that handles this platform better?
    It's also a bit curious because NSS is regularly built for Android, but for whatever reason we're hitting this problem here, with the ar in use. I wonder if it's a Make vs Ninja/Gyp issue.

  2. Could https://github.com/leleliu008/ndk-pkg-formula/blob/master/nss.sh be updated so that the AR declaration is instead $AR rs? It might not be the cleanest, but if it's just for this build environment, that might be nicer than trying to isolate down via further ifeq checks in rules.mk.

Thanks!
J.C.

  1. I have tried to use the gyp/ninja-based build.sh to install nss, but it failed too, it looks need many patches.
  2. I think use $(AR) $(ARFLAGS) $@ $^ is better. same as nss/gtests/google_test/gtest/make/Makefile line65 in use.

AR command have a long history. It has been standardized by POSIX. see here: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ar.html

Flags: needinfo?(leleliu008)

Got it. We'll put this on the list ASAP. If you wanted to attach the patch with moz-phab though, we can basically auto-land it, so that'd undoubtedly be faster.

Thanks again!

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Whiteboard: [nss-nofx]
You need to log in before you can comment on or make changes to this bug.