elinks
elinks copied to clipboard
Spidermonkey 1.8.5 is deprecated
Spidermonkey 1.8.5 has been removed from Debian, because it is unmaintained and has a security vulnerability. Could elinks migrate to mozjs-52 or mozjs-60 ?
I updated code to mozjs-17.0. Is this version maintained in Debian?
Debian only has mozjs-52 & mozjs-60
-- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyIDs: 4096R/A7EF5671 2048R/EDDDA1B7 GPG Fingerprints: 6E2E E4BB 72E2 F417 D066 6ABF 7B30 B496 A7EF 5761 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7
I tried building that commit (after patching confgure.ac to use mozjs-52), but configure script reported that Spidermonkey is found but not usable.
-- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyIDs: 4096R/A7EF5671 2048R/EDDDA1B7 GPG Fingerprints: 6E2E E4BB 72E2 F417 D066 6ABF 7B30 B496 A7EF 5761 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7
I tried building that commit (after patching confgure.ac to use mozjs-52), but configure script reported that Spidermonkey is found but not usable.
configure:10096: checking for SpiderMonkey (mozjs-17.0) in pkg-config mozjs-52
configure:10122: gcc -o conftest -isystem /usr/include/mit-krb5 -g -O2 -fdebug-prefix-map=/home/m/mahmoudy/build-area/elinks-0.13~20190210=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -include /usr/include/mozjs-52/js/RequiredDefines.h -I/usr/include/mozjs-52 -I/usr/include/nspr -Wdate-time -D_FORTIFY_SOURCE=2 -include /usr/include/mozjs-52/js/RequiredDefines.h -I/usr/include/mozjs-52 -I/usr/include/nspr -Wl,-z,relro -Wl,-z,now -Wl,-z,defs conftest.c -L/usr/lib/x86_64-linux-gnu/ -lmozjs-52 -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -ldl -ltinfo -lz -lbz2 -lidn -llzma -lexpat >&5
In file included from /usr/include/mozjs-52/mozilla/Casting.h:12:0,
from /usr/include/mozjs-52/mozilla/FloatingPoint.h:13,
from /usr/include/mozjs-52/jsapi.h:12,
from conftest.c:171:
/usr/include/mozjs-52/mozilla/TypeTraits.h:19:1: error: unknown type name 'namespace'
namespace mozilla {
^
/usr/include/mozjs-52/mozilla/TypeTraits.h:19:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace mozilla {
^
In file included from /usr/include/mozjs-52/mozilla/FloatingPoint.h:13:0,
from /usr/include/mozjs-52/jsapi.h:12,
from conftest.c:171:
/usr/include/mozjs-52/mozilla/Casting.h:16:1: error: unknown type name 'namespace'
namespace mozilla {
^
/usr/include/mozjs-52/mozilla/Casting.h:16:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace mozilla {
^
In file included from /usr/include/mozjs-52/jsapi.h:12:0,
from conftest.c:171:
/usr/include/mozjs-52/mozilla/FloatingPoint.h:16:1: error: unknown type name 'namespace'
namespace mozilla {
^
/usr/include/mozjs-52/mozilla/FloatingPoint.h:16:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace mozilla {
^
In file included from /usr/include/mozjs-52/jsapi.h:13:0,
from conftest.c:171:
/usr/include/mozjs-52/mozilla/RangedPtr.h:18:1: error: unknown type name 'namespace'
namespace mozilla {
^
/usr/include/mozjs-52/mozilla/RangedPtr.h:18:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace mozilla {
^
In file included from /usr/include/mozjs-52/jsapi.h:15:0,
from conftest.c:171:
/usr/include/mozjs-52/mozilla/ThreadLocal.h:32:1: error: unknown type name 'namespace'
namespace mozilla {
^
/usr/include/mozjs-52/mozilla/ThreadLocal.h:32:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace mozilla {
^
In file included from /usr/include/mozjs-52/js/Utility.h:13:0,
from /usr/include/mozjs-52/jsalloc.h:10,
from /usr/include/mozjs-52/jsapi.h:23,
from conftest.c:171:
/usr/include/mozjs-52/mozilla/Scoped.h:56:1: error: unknown type name 'namespace'
namespace mozilla {
^
/usr/include/mozjs-52/mozilla/Scoped.h:56:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace mozilla {
^
In file included from /usr/include/mozjs-52/js/Utility.h:25:0,
from /usr/include/mozjs-52/jsalloc.h:10,
from /usr/include/mozjs-52/jsapi.h:23,
from conftest.c:171:
/usr/include/mozjs-52/js/TemplateLib.h:19:1: error: unknown type name 'namespace'
namespace js {
^
/usr/include/mozjs-52/js/TemplateLib.h:19:14: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace js {
^
In file included from /usr/include/mozjs-52/jsalloc.h:10:0,
from /usr/include/mozjs-52/jsapi.h:23,
from conftest.c:171:
/usr/include/mozjs-52/js/Utility.h:28:1: error: unknown type name 'namespace'
namespace JS {}
^
/usr/include/mozjs-52/js/Utility.h:28:14: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace JS {}
^
/usr/include/mozjs-52/js/Utility.h:31:1: error: unknown type name 'namespace'
namespace mozilla {}
^
/usr/include/mozjs-52/js/Utility.h:31:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace mozilla {}
^
/usr/include/mozjs-52/js/Utility.h:34:1: error: unknown type name 'namespace'
namespace js {}
^
/usr/include/mozjs-52/js/Utility.h:34:14: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
namespace js {}
^
/usr/include/mozjs-52/js/Utility.h:163:24: error: conflicting types for 'js_calloc'
static JS_INLINE void* js_calloc(size_t nmemb, size_t size)
^
/usr/include/mozjs-52/js/Utility.h:157:24: note: previous definition of 'js_calloc' was here
static JS_INLINE void* js_calloc(size_t bytes)
^
/usr/include/mozjs-52/js/Utility.h:368:15: fatal error: new: No such file or directory
#include
-- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyIDs: 4096R/A7EF5671 2048R/EDDDA1B7 GPG Fingerprints: 6E2E E4BB 72E2 F417 D066 6ABF 7B30 B496 A7EF 5761 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7
I patched configure.ac by inserting: AC_LANG_PUSH([C++]) [...] AC_LANG_POP([C++]) around the AC_LINK test, and it passed. Yet the build failed, since the code is in C and the mozjs lib is using C++ constructs.
-- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyIDs: 4096R/A7EF5671 2048R/EDDDA1B7 GPG Fingerprints: 6E2E E4BB 72E2 F417 D066 6ABF 7B30 B496 A7EF 5761 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7
Couldn't this be done by adding a C wrapper around mozjs library instead of converting elinks' complete code to C++ ?
I don't know C++ nor SpiderMonkey. In the future it is possible, but not now.
I'm looking into porting to newer versions of SpiderMonkey by compiling only the src/ecmascript
and src/scripting/smjs
directories with C++. This might work, though is not completely ideal because the mixture of C and C++ produces many type conversion warnings.
I would rather switch to QuickJS . It is C and has smaller memory footprint, but first I want to finish libdom "migration". I stopped on tables. JS is rather next year, not now.
I would rather switch to QuickJS . It is C and has smaller memory footprint, but first I want to finish libdom "migration". I stopped on tables. JS is rather next year, not now.
I see, that makes sense. (QuickJS does look similar to old Spidermonkey.)
Unfortunately QuickJS is not available on Debian
Can't you use the Mozjs C API?
I spent too much time on SpiderMonkey to give up now. It compiles with mozjs52, but segfaults. I have no idea yet, how to resolve it. If you know, please write it here, or prepare a patch. Usually it related to threads. js::PerThreadData::runtimeFromMainThread (this=0x0) or JS_AbortIfWrongThread(cx).
According to the NEWS file, elinks 0.15.0 now uses mozjs78-dev
or QuickJS-2021-03-27
for ECMAScript support. So can we close this issue?
sounds good to me.
so currently you have to use mozjs78 correct? cause if yes then I wasted way too much time compiling mozjs17 oops
yes, either mozjs78 or quickjs, but do not expect too much.
just as a heads-up: I had installed libmozjs-78-dev
on a Debian Testing system and it was not detected by the configure script. The same system also has libmozjs-91-dev
installed so it might be a package conflict.
You need also libsqlite3-dev and libxml++5.0.1.GIT or higher. I doubt libmozjs-91-dev has any influence on build process. And add CC=g++ to ./configure invocation. meson builds are faster.
Hi, just to update: I got it to build with recent libmozjs
(revising to package=mozjs-102
in the configure file). I had to bring in some dependencies like this:
PKG_CONFIG_PATH="/opt/netsurf/pkgconfig:/opt/netsurf/inst-gtk2/lib/pkgconfig/" ./configure --with-spidermonkey --enable-256-colors
Configure reports:
...
checking for SpiderMonkey (mozjs-102) in pkg-config mozjs-102... yes
...
ECMAScript (JavaScript) ......... SpiderMonkey document scripting
...
The build completes successfully. However, even though I have the ECMAScript option turned on in elinks, when I go to https://www.whatismybrowser.com/detect/is-javascript-enabled, it tells me that it's not enabled.
Edit: I tried with quickjs instead, and still the site didn't detect Javascript enabled!
Besides examples in test directory, none of real scripts are operational. I want to "migrate" from libxml++ to libdom first, to be able to copy more code from netsurf. Progress is slow. js is postponed. The plan is to gradually make to work some scripts like a js terminal emulator, searching in Python docs, and playable tetris, but the first milestone I want to achieve is functional background colors in documents.
What is the current status of enabling JavaScript support on elinks on Debian?