Open Bug 1448659 Opened 5 years ago Updated 8 months ago

libmozjs.so and libxul.so fail to link: error: undefined symbol: __dtraceenabled_javascript___object__create (--enable-dtrace)

Categories

(Firefox Build System :: General: Unsupported Platforms, defect, P5)

Unspecified
FreeBSD
defect

Tracking

(firefox-esr52 unaffected, firefox59 unaffected, firefox60 unaffected, firefox61 fix-optional)

Tracking Status
firefox-esr52 --- unaffected
firefox59 --- unaffected
firefox60 --- unaffected
firefox61 --- fix-optional

People

(Reporter: jbeich, Unassigned)

References

Details

(Keywords: regression)

Bisecting first bad is mozilla-central changeset 7547d66e0f51.

$ c++ -v -Wl,-V
FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib -V -lc++ -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
LLD 6.0.0 (FreeBSD 326565) (compatible with GNU linkers)

$ pkg install autoconf213 gmake python27 mercurial
$ hg clone https://hg.mozilla.org/mozilla-central

SpiderMonkey:
$ (cd mozilla-central/js/src; autoconf-2.13)
$ mkdir build; cd build
$ ../mozilla-central/js/src/configure --enable-dtrace --enable-linker=lld
$ gmake
[...]
gmake: Entering directory '/tmp/build/js/src/build'
libmozjs-61a1.so
rm -f libmozjs-61a1.so
/usr/bin/c++ -Qunused-arguments -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I/usr/local/include -Qunused-arguments -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++1z-compat -Wcomma -Wimplicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-noexcept-type -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-sized-deallocation -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-rtti -fno-exceptions -fno-math-errno -pipe -g -O -fno-omit-frame-pointer  -fPIC -shared -Wl,-z,defs -Wl,-h,libmozjs-61a1.so -o libmozjs-61a1.so /tmp/build/js/src/build/libmozjs-61a1_so.list  -pthread -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,--build-id -fuse-ld=lld -Wl,-rpath-link,/tmp/build/dist/bin -Wl,-rpath-link,/usr/local/lib        -lm  -lz -lm -pthread
/usr/bin/ld.lld: error: undefined symbol: __dtraceenabled_javascript___object__create
>>> referenced by Probes.h:117 (mozilla-central/js/src/vm/Probes.h:117)
>>>               ../Array.o:(js::NewDenseEmptyArray(JSContext*, JS::Handle<JSObject*>, js::NewObjectKind))

/usr/bin/ld.lld: error: undefined symbol: __dtrace_javascript___object__create
>>> referenced by Probes.h:118 (mozilla-central/js/src/vm/Probes.h:118)
>>>               ../Array.o:(js::NewDenseEmptyArray(JSContext*, JS::Handle<JSObject*>, js::NewObjectKind))

/usr/bin/ld.lld: error: undefined symbol: __dtraceenabled_javascript___object__create
>>> referenced by Probes.h:117 (mozilla-central/js/src/vm/Probes.h:117)
>>>               ../Array.o:(js::NewDenseFullyAllocatedArray(JSContext*, unsigned int, JS::Handle<JSObject*>, js::NewObjectKind))

/usr/bin/ld.lld: error: undefined symbol: __dtrace_javascript___object__create
>>> referenced by Probes.h:118 (mozilla-central/js/src/vm/Probes.h:118)
>>>               ../Array.o:(js::NewDenseFullyAllocatedArray(JSContext*, unsigned int, JS::Handle<JSObject*>, js::NewObjectKind))

/usr/bin/ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
c++: error: linker command failed with exit code 1 (use -v to see invocation)

Firefox:
$ cd mozilla-central
$ echo "ac_add_options --enable-dtrace" >>.mozconfig
$ echo "ac_add_options --enable-linker=lld # bug 1041353 workaround" >>.mozconfig
$ ./mach bootstrap
$ ./mach build -v
[...]
gmake[4]: Entering directory 'mozilla-central/obj-x86_64-unknown-freebsd12.0/toolkit/library'
libxul.so
rm -f libxul.so
/usr/bin/c++ -Qunused-arguments -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I/usr/local/include -Qunused-arguments -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++1z-compat -Wcomma -Wimplicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-sized-deallocation -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -pipe -g -O -fno-omit-frame-pointer  -fPIC -shared -Wl,-z,defs -Wl,--warn-unresolved-symbols -Wl,-h,libxul.so -o libxul.so mozilla-central/obj-x86_64-unknown-freebsd12.0/toolkit/library/libxul_so.list  -pthread -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,--build-id -fuse-ld=lld -Wl,-rpath-link,mozilla-central/obj-x86_64-unknown-freebsd12.0/dist/bin -Wl,-rpath-link,/usr/local/lib   -fcolor-diagnostics ../../security/nss/lib/crmf/crmf_crmf/libcrmf.a ../../js/src/build/libjs_static.a ../../toolkit/library/rust/../x86_64-unknown-freebsd/release/libgkrust.a ../../config/external/nspr/pr/libnspr4.so ../../config/external/nspr/libc/libplc4.so ../../config/external/nspr/ds/libplds4.so ../../config/external/lgpllibs/liblgpllibs.so ../../security/nss/lib/nss/nss_nss3/libnss3.so ../../security/nss/lib/util/util_nssutil3/libnssutil3.so ../../security/nss/lib/smime/smime_smime3/libsmime3.so ../../config/external/sqlite/libmozsqlite3.so ../../security/nss/lib/ssl/ssl_ssl3/libssl3.so ../../widget/gtk/mozgtk/stub/libmozgtk_stub.so    -lX11 -lX11-xcb -lxcb -lXcomposite -lXcursor -lXdamage -lXext -lXfixes -lXi -lXrender -lpthread -lm -pthread -L/usr/local/lib -lfreetype -lfontconfig -lutil -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0 -lintl -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lxcb-shm -lpangoft2-1.0 -lXt -lgthread-2.0
/usr/bin/ld.lld: error: undefined symbol: __dtraceenabled_javascript___object__create
>>> referenced by Probes.h:117 (mozilla-central/js/src/vm/Probes.h:117)
>>>               Array.o:(js::NewDenseEmptyArray(JSContext*, JS::Handle<JSObject*>, js::NewObjectKind)) in archive ../../js/src/build/libjs_static.a

/usr/bin/ld.lld: error: undefined symbol: __dtrace_javascript___object__create
>>> referenced by Probes.h:118 (mozilla-central/js/src/vm/Probes.h:118)
>>>               Array.o:(js::NewDenseEmptyArray(JSContext*, JS::Handle<JSObject*>, js::NewObjectKind)) in archive ../../js/src/build/libjs_static.a

/usr/bin/ld.lld: error: undefined symbol: __dtraceenabled_javascript___object__create
>>> referenced by Probes.h:117 (mozilla-central/js/src/vm/Probes.h:117)
>>>               Array.o:(js::NewDenseFullyAllocatedArray(JSContext*, unsigned int, JS::Handle<JSObject*>, js::NewObjectKind)) in archive ../../js/src/build/libjs_static.a

/usr/bin/ld.lld: error: undefined symbol: __dtrace_javascript___object__create
>>> referenced by Probes.h:118 (mozilla-central/js/src/vm/Probes.h:118)
>>>               Array.o:(js::NewDenseFullyAllocatedArray(JSContext*, unsigned int, JS::Handle<JSObject*>, js::NewObjectKind)) in archive ../../js/src/build/libjs_static.a

/usr/bin/ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Presumably that change made this hack in js/src/Makefile.in no longer work:
https://dxr.mozilla.org/mozilla-central/rev/6ff60a083701d08c52702daf50f28e8f46ae3a1c/js/src/Makefile.in#158

We could mostly replace that with `GENERATED_FILES`, except that we don't have a way to pass pre-compiled object files into the link, AFAIK, and that rule also wants the rest of $(OBJS) as a dependency, and we definitely don't have a way to deal with that.
If FreeBSD integrates dtrace -G into linker the hack would be unnecessary:
https://lists.freebsd.org/pipermail/freebsd-dtrace/2017-April/000512.html
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.