Bug 251480 - lang/spidermonkey78: Build fails on 12.2 with system clang 10.
Summary: lang/spidermonkey78: Build fails on 12.2 with system clang 10.
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Steve Wills
URL:
Keywords:
Depends on: 251895
Blocks:
  Show dependency treegraph
 
Reported: 2020-11-30 11:27 UTC by Jan Martin Mikkelsen
Modified: 2020-12-27 16:12 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (swills)


Attachments
v0 (1.91 KB, patch)
2020-12-01 17:58 UTC, Mikael Urankar
no flags Details | Diff
Makefile changes to set llvm options or depend on llvm if llvm isn't used (1.17 KB, patch)
2020-12-02 14:16 UTC, Jan Martin Mikkelsen
no flags Details | Diff
Update checksum file so Mikael Urankar's patch can work (3.18 KB, patch)
2020-12-02 14:18 UTC, Jan Martin Mikkelsen
no flags Details | Diff
Updated Makefile patch (1.92 KB, patch)
2020-12-17 13:04 UTC, Jan Martin Mikkelsen
no flags Details | Diff
Makefile diff against head, includes version number change from #251895 (1.80 KB, patch)
2020-12-17 17:22 UTC, Jan Martin Mikkelsen
no flags Details | Diff
Checksum file patch. (3.18 KB, patch)
2020-12-17 17:23 UTC, Jan Martin Mikkelsen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Martin Mikkelsen 2020-11-30 11:27:00 UTC
When overriding CC to be "clang" and CXX to be "clang++" so that lang/spidermonkey78 is build with the system Clang 10, the build fails with the same error as in this bug:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250161

The issue seems to be the --target option. Rerunning the command without the --target option, or fixing the target value to have a "12.2" suffix works.

Building with llvm80, as in the original bug, removing or fixing the --target option also made this build step work.

Error output below.


  --- stdout
  TARGET = Some("x86_64-unknown-freebsd")
  OPT_LEVEL = Some("2")
  HOST = Some("x86_64-unknown-freebsd")
  CXX_x86_64-unknown-freebsd = None
  CXX_x86_64_unknown_freebsd = Some(" /usr/bin/clang++ -std=gnu++17")
  CXXFLAGS_x86_64-unknown-freebsd = None
  CXXFLAGS_x86_64_unknown_freebsd = Some("-I/ports-work/usr/ports/lang/spidermonkey78/work/.build/dist/system_wrappers -include /ports-work/usr/ports/lang/spidermonkey78/work/firefox-78.2.0/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 -DEXPORT_JS_API -DMOZ_HAS_MOZGLUE -I/ports-work/usr/ports/lang/spidermonkey78/work/firefox-78.2.0/js/src/rust -I/ports-work/usr/ports/lang/spidermonkey78/work/.build/js/src/rust -I/ports-work/usr/ports/lang/spidermonkey78/work/.build/dist/include -I/usr/local/include/nspr -I/usr/local/include -fPIC -DMOZILLA_CLIENT -include /ports-work/usr/ports/lang/spidermonkey78/work/.build/js/src/js-confdefs.h -Qunused-arguments -I/usr/local/include -isystem /usr/local/include -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wno-error=deprecated-copy -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-noexcept-type -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -O2 -pipe -I/usr/local/include/boost-default -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pipe -O -fomit-frame-pointer -funwind-tables -fexperimental-new-pass-manager -DMOZILLA_CONFIG_H")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  running: "/usr/bin/clang++" "-std=gnu++17" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-unknown-freebsd" "-I/ports-work/usr/ports/lang/spidermonkey78/work/.build/dist/system_wrappers" "-include" "/ports-work/usr/ports/lang/spidermonkey78/work/firefox-78.2.0/config/gcc_hidden.h" "-U_FORTIFY_SOURCE" "-D_FORTIFY_SOURCE=2" "-fstack-protector-strong" "-DNDEBUG=1" "-DTRIMMED=1" "-DEXPORT_JS_API" "-DMOZ_HAS_MOZGLUE" "-I/ports-work/usr/ports/lang/spidermonkey78/work/firefox-78.2.0/js/src/rust" "-I/ports-work/usr/ports/lang/spidermonkey78/work/.build/js/src/rust" "-I/ports-work/usr/ports/lang/spidermonkey78/work/.build/dist/include" "-I/usr/local/include/nspr" "-I/usr/local/include" "-fPIC" "-DMOZILLA_CLIENT" "-include" "/ports-work/usr/ports/lang/spidermonkey78/work/.build/js/src/js-confdefs.h" "-Qunused-arguments" "-I/usr/local/include" "-isystem" "/usr/local/include" "-Qunused-arguments" "-Wall" "-Wbitfield-enum-conversion" "-Wempty-body" "-Wignored-qualifiers" "-Woverloaded-virtual" "-Wpointer-arith" "-Wshadow-field-in-constructor-modified" "-Wsign-compare" "-Wtype-limits" "-Wunreachable-code" "-Wunreachable-code-return" "-Wwrite-strings" "-Wno-invalid-offsetof" "-Wclass-varargs" "-Wempty-init-stmt" "-Wfloat-overflow-conversion" "-Wfloat-zero-conversion" "-Wloop-analysis" "-Wc++2a-compat" "-Wcomma" "-Wimplicit-fallthrough" "-Wunused-function" "-Wunused-variable" "-Wstring-conversion" "-Wtautolo@@@                                                                             
                                                              275,0-1       91%
  cargo:warning=#include_next <type_traits>
  cargo:warning=              ^~~~~~~~~~~~~
  cargo:warning=1 error generated.
  exit code: 1

  --- stderr


  error occurred: Command "/usr/bin/clang++" "-std=gnu++17" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-unknown-freebsd" "-I/ports-work/usr/ports/lang/spidermonkey78/work/.build/dist/system_wrappers" "-include" "/ports-work/usr/ports/lang/spidermonkey78/work/firefox-78.2.0/config/gcc_hidden.h" "-U_FORTIFY_SOURCE" "-D_FORTIFY_SOURCE=2" "-fstack-protector-strong" "-DNDEBUG=1" "-DTRIMMED=1" "-DEXPORT_JS_API" "-DMOZ_HAS_MOZGLUE" "-I/ports-work/usr/ports/lang/spidermonkey78/work/firefox-78.2.0/js/src/rust" "-I/ports-work/usr/ports/lang/spidermonkey78/work/.build/js/src/rust" "-I/ports-work/usr/ports/lang/spidermonkey78/work/.build/dist/include" "-I/usr/local/include/nspr" "-I/usr/local/include" "-fPIC" "-DMOZILLA_CLIENT" "-include" "/ports-work/usr/ports/lang/spidermonkey78/work/.build/js/src/js-confdefs.h" "-Qunused-arguments" "-I/usr/local/include" "-isystem" "/usr/local/include" "-Qunused-arguments" "-Wall" "-Wbitfield-enum-conversion" "-Wempty-body" "-Wignored-qualifiers" "-Woverloaded-virtual" "-Wpointer-arith" "-Wshadow-field-in-constructor-modified" "-Wsign-compare" "-Wtype-limits" "-Wunreachable-code" "-Wunreachable-code-return" "-Wwrite-strings" "-Wno-invalid-offsetof" "-Wclass-varargs" "-Wempty-init-stmt" "-Wfloat-overflow-conversion" "-Wfloat-zero-conversion" "-Wloop-analysis" "-Wc++2a-compat" "-Wcomma" "-Wimplicit-fallthrough" "-Wunused-function" "-Wunused-variable" "-Wstring-conversion" "-Wtautological-overlap-compare" "-Wtautological-unsigned-enum-zero-compare" "-Wtautological-unsigned-zero-compare" "-Wno-error=tautological-type-limit-compare" "-Wno-inline-new-delete" "-Wno-error=deprecated-declarations" "-Wno-error=array-bounds" "-Wno-error=backend-plugin" "-Wno-error=return-std-move" "-Wno-error=atomic-alignment" "-Wno-error=deprecated-copy" "-Wformat" "-Wformat-security" "-Wno-gnu-zero-variadic-macro-arguments" "-Wno-noexcept-type" "-Wno-unknown-warning-option" "-fno-sized-deallocation" "-fno-aligned-new" "-O2" "-pipe" "-I/usr/local/include/boost-default" "-fstack-protector-strong" "-isystem" "/usr/local/include" "-fno-strict-aliasing" "-isystem" "/usr/local/include" "-fno-rtti" "-ffunction-sections" "-fdata-sections" "-fno-exceptions" "-fno-math-errno" "-pipe" "-O" "-fomit-frame-pointer" "-funwind-tables" "-fexperimental-new-pass-manager" "-DMOZILLA_CONFIG_H" "-I" "/ports-work/usr/ports/lang/spidermonkey78/work/.build/js/src" "-I" "/ports-work/usr/ports/lang/spidermonkey78/work/.build/dist/include" "-DMOZ_HAS_MOZGLUE" "-o" "/ports-work/usr/ports/lang/spidermonkey78/work/.build/x86_64-unknown-freebsd/release/build/mozglue-static-38598c650063714d/out/wrappers.o" "-c" "wrappers.cpp" with args "clang++" did not execute successfully (status code exit code: 1).
Comment 1 Mikael Urankar freebsd_committer freebsd_triage 2020-12-01 17:58:21 UTC
Created attachment 220142 [details]
v0

Can you try the attached patch?

For reference:
https://svnweb.freebsd.org/ports/head/lang/rust/files/patch-vendor_cc_src_lib.rs?revision=532685&view=markup
Comment 2 Mikael Urankar freebsd_committer freebsd_triage 2020-12-01 18:18:53 UTC
(In reply to Mikael Urankar from comment #1)
bug #238556
Comment 3 Jan Martin Mikkelsen 2020-12-02 14:16:09 UTC
Created attachment 220169 [details]
Makefile changes to set llvm options or depend on llvm if llvm isn't used
Comment 4 Jan Martin Mikkelsen 2020-12-02 14:18:04 UTC
Created attachment 220170 [details]
Update checksum file so Mikael Urankar's patch can work
Comment 5 Jan Martin Mikkelsen 2020-12-02 14:23:33 UTC
(In reply to Mikael Urankar from comment #1)

It worked with your patch plus the two additional patches I have added. This builds with the base system compiler on 12. by setting CC=clang and CXX=clang++.

The Makefile patch removes the llvm dependency if CC and CXX are overridden, and only sets the llvm configure options if llvm is being used.

The checksum patch is necessary for your patch to work; the Spidermonkey build checks the checksums of the input files and fails because the checksum doesn't match after your patch is applied.

Perhaps the default dependency on llvm can be removed if the base system compiler is new enough.
Comment 6 Mikael Urankar freebsd_committer freebsd_triage 2020-12-04 18:01:43 UTC
(In reply to janm from comment #4)
You can use this instead of a patch file (just fix the path)
# Disable vendor checksums like lang/rust
        @${REINPLACE_CMD} 's,"files":{[^}]*},"files":{},' \
                ${MOZSRC}/third_party/rust/*/.cargo-checksum.json
Comment 7 Steve Wills freebsd_committer freebsd_triage 2020-12-16 17:12:08 UTC
Can you check if the updated version still has the same issue (PR 251895) and if so supply an updated patch?
Comment 8 Jan Martin Mikkelsen 2020-12-16 18:51:54 UTC
(In reply to Steve Wills from comment #7)

Sure. Will do a run tomorrow and let you know.
Comment 9 Jan Martin Mikkelsen 2020-12-17 13:04:02 UTC
Created attachment 220661 [details]
Updated Makefile patch
Comment 10 Jan Martin Mikkelsen 2020-12-17 13:10:25 UTC
(In reply to Steve Wills from comment #7)

Building on 12.2-p2 with a 2020Q4 ports tree.

The problem still exists on the updated version without the patch.

With the patch in the "v0" attachment plus the Makefile changes it builds fine with the system Clang 10 and also with LLVM 8.0. The underlying issue seems to be the target string, not that Clang must be at least version 9. The "LLVM must be 9.0 or higher" check in head does not seem to be necessary with this patch.

The updated Makefile patch has a "${COMPILER_VERSION} < 100" check to decide whether to depend on LLVM or not. I suspect that it could be "${COMPILER_VERSION} < 80" but I don't have a 12.1 system set up for testing and so cannot test.
Comment 11 Steve Wills freebsd_committer freebsd_triage 2020-12-17 15:18:30 UTC
(In reply to janm from comment #10)
Thanks for testing and the updated patch. Unfortunately it doesn't apply for me, but I'm on the trunk branch (in svn) so maybe that's the issue. Also, I'd prefer not to add another sed (REINPLACE_CMD) if possible, since sed can break or stop working silently. Can we use a patch here instead?
Comment 12 Jan Martin Mikkelsen 2020-12-17 17:22:28 UTC
Created attachment 220668 [details]
Makefile diff against head, includes version number change from #251895
Comment 13 Jan Martin Mikkelsen 2020-12-17 17:23:03 UTC
Created attachment 220669 [details]
Checksum file patch.
Comment 14 Jan Martin Mikkelsen 2020-12-17 17:24:54 UTC
(In reply to Steve Wills from comment #11)

Diff against the head Makefile, including your version number change attached.

The checksum change added as a patch file reattached. The sed change has been removed from the Makefile.

I put the ${COMPILER_VERSION} as "< 80" on the basis that it builds with LLVM 8.0.
Comment 15 Steve Wills freebsd_committer freebsd_triage 2020-12-17 18:33:09 UTC
(In reply to janm from comment #14)
Thanks, seems fine here. I posted an updated version of this in PR 251895 and am waiting on exp-run results.
Comment 16 commit-hook freebsd_committer freebsd_triage 2020-12-27 16:08:59 UTC
A commit references this bug:

Author: swills
Date: Sun Dec 27 16:08:21 UTC 2020
New revision: 559369
URL: https://svnweb.freebsd.org/changeset/ports/559369

Log:
  lang/spidermonkey78: update to 78.6.0 [1]

  While here, allow building with system clang 10 on 12.2 [2]

  PR:		251895 [1]
  PR:		251480 [2]
  Submitted by:	mikael, janm@transactionware.com [2]
  Exp-run by:	antoine [1]
  Reported by:	janm@transactionware.com [2]

Changes:
  head/lang/spidermonkey78/Makefile
  head/lang/spidermonkey78/distinfo
  head/lang/spidermonkey78/files/patch-third__party_rust_cc_.cargo-checksum.json
  head/lang/spidermonkey78/files/patch-third__party_rust_cc_src_lib.rs
Comment 17 Steve Wills freebsd_committer freebsd_triage 2020-12-27 16:12:48 UTC
Committed, thanks!