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).
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
(In reply to Mikael Urankar from comment #1) bug #238556
Created attachment 220169 [details] Makefile changes to set llvm options or depend on llvm if llvm isn't used
Created attachment 220170 [details] Update checksum file so Mikael Urankar's patch can work
(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.
(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
Can you check if the updated version still has the same issue (PR 251895) and if so supply an updated patch?
(In reply to Steve Wills from comment #7) Sure. Will do a run tomorrow and let you know.
Created attachment 220661 [details] Updated Makefile patch
(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.
(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?
Created attachment 220668 [details] Makefile diff against head, includes version number change from #251895
Created attachment 220669 [details] Checksum file patch.
(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.
(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.
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
Committed, thanks!