mengmo / quickjs-windows-build Goto Github PK
View Code? Open in Web Editor NEWBuild QuickJS on Windows
Home Page: https://github.com/mengmo/QuickJS-Windows-Build
License: MIT License
Build QuickJS on Windows
Home Page: https://github.com/mengmo/QuickJS-Windows-Build
License: MIT License
quickjs 的源码在近期更新过了, 请求新的编译的 dll
https://github.com/bellard/quickjs
#include <iostream>
#include "..\..\include\quickjs\quickjs.h"
int main() {
std::cout << "I wish I could evaluate some JavaScript!" << std::endl;
}
g++ main.cpp -L libquickjs -Wl,-Bstatic
missing libquickjsbn.dll in last prebuilt binary releases
Since already building with MinGW and pthreads, perhaps os.Worker
could be supported?
Adding -DUSE_WORKER
and a macro for pipe
like #define pipe(fds) _pipe(fds, 4096, _O_BINARY)
seems to do it.
can you provide a tcc command to compile the c code generated by qjsc?
Thanks for providing a prebuilt DLL. I tried using it and ran into some issues - I've been able to work around them but it would be better if these were solved centrally. Sharing the issues here for other people's benefit too:
JSString
and others, are defined in quickjs.c, which means that an app using the release from this repo (and the quickjs.h header) won't be able to use those types or any macros that depend on them.I download the latest binary and test with qjsc ..\examples\hello.js
, however, it failed with Executable output is not supported for this target
.
D:\apps\quickjs-2021-03-27-win32-all\bin>cat ..\examples\hello.js
console.log("Hello World");
D:\apps\quickjs-2021-03-27-win32-all\bin>qjs ..\examples\hello.js
Hello World
D:\apps\quickjs-2021-03-27-win32-all\bin>qjsc ..\examples\hello.js
Executable output is not supported for this target
D:\apps\quickjs-2021-03-27-win32-all\bin>ver
Microsoft Windows [Version 10.0.19042.1237]
D:\apps\quickjs-2021-03-27-win32-all\bin>
it is useful to have .lib file in the release
Hi, do you have any trick to fix the color display?
for example, when you input i=1 in qjs command line, it displays as below
�[32;1mi�[0m�[J�[D�[32;1mi�[0m�[32;1m=�[0m�[J�[2D�[32;1mi�[0m�[32;1m=�[0m�[32m1�[0m�[J
�[37;1m1
After success build, I tried a example in the doc/quickjs.pdf
.
Liu.D.H@DESKTOP-KA8TQF4 MINGW32 ~/quickjs/QuickJS-Windows-Build
$ ./qjsc -v
QuickJS Compiler version 2020-03-16
usage: qjsc [options] [files]
options are:
-c only output bytecode in a C file
-e output main() and bytecode in a C file (default = executable output)
-o output set the output filename
-N cname set the C name of the generated data
-m compile as Javascript module (default=autodetect)
-M module_name[,cname] add initialization code for an external C module
-x byte swapped output
-p prefix set the prefix of the generated C names
-flto use link time optimization
-fbignum enable bignum extensions
-fno-[date|eval|string-normalize|regexp|json|proxy|map|typedarray|promise|module-loader|bigint]
disable selected language features (smaller code size)
Liu.D.H@DESKTOP-KA8TQF4 MINGW32 ~/quickjs/QuickJS-Windows-Build
$ ./qjs examples/hello.js
Hello World
Liu.D.H@DESKTOP-KA8TQF4 MINGW32 ~/quickjs/QuickJS-Windows-Build
$ ./qjsc examples/hello.js -o hello.exe
Could not load '-o'
Liu.D.H@DESKTOP-KA8TQF4 MINGW32 ~/quickjs/QuickJS-Windows-Build
$ ./qjsc -o hello.exe examples/hello.js
Executable output is not supported for this target
Liu.D.H@DESKTOP-KA8TQF4 MINGW32 ~/quickjs/QuickJS-Windows-Build
$
RT,试图使用msys2 ucrt-x86-64-gcc将项目编译为动态库 (dll)
经过一些尝试发现无法做到,前来请教
I followed the instructions on readme, but I got the following error.
Liu.D.H@DESKTOP-KA8TQF4 MINGW64 ~/quickjs/QuickJS-Windows-Build
$ make LDEXPORT="-Wl,-static,-s" LDEXTRAS="-Wl,-static,-s"
x86_64-w64-mingw32-gcc -g -Wall -MMD -MF .obj/quickjs.check.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -DCONFIG_CHECK_JSVALUE -c -o .obj/quickjs.check.o quickjs.c
x86_64-w64-mingw32-gcc -g -Wall -MMD -MF .obj/qjs.check.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -DCONFIG_CHECK_JSVALUE -c -o .obj/qjs.check.o qjs.c
qjs.c: In function 'js_trace_malloc_printf':
qjs.c:152:35: warning: unknown conversion type character 'l' in format [-Wformat=]
printf("H%+06lld.%zd",
^
qjs.c:152:39: warning: unknown conversion type character 'z' in format [-Wformat=]
printf("H%+06lld.%zd",
^
qjs.c:152:28: warning: too many arguments for format [-Wformat-extra-args]
printf("H%+06lld.%zd",
^~~~~~~~~~~~~~
qjs.c:152:35: warning: unknown conversion type character 'l' in format [-Wformat=]
printf("H%+06lld.%zd",
^
qjs.c:152:39: warning: unknown conversion type character 'z' in format [-Wformat=]
printf("H%+06lld.%zd",
^
qjs.c:152:28: warning: too many arguments for format [-Wformat-extra-args]
printf("H%+06lld.%zd",
^~~~~~~~~~~~~~
qjs.c:161:26: warning: unknown conversion type character 'z' in format [-Wformat=]
printf("%zd", sz);
^
qjs.c:161:24: warning: too many arguments for format [-Wformat-extra-args]
printf("%zd", sz);
^~~~~
qjs.c:161:26: warning: unknown conversion type character 'z' in format [-Wformat=]
printf("%zd", sz);
^
qjs.c:161:24: warning: too many arguments for format [-Wformat-extra-args]
printf("%zd", sz);
^~~~~
qjs.c: In function 'js_trace_malloc':
qjs.c:186:35: warning: unknown conversion type character 'z' in format [-Wformat=]
js_trace_malloc_printf(s, "A %zd -> %p\n", size, ptr);
^
qjs.c:186:42: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
js_trace_malloc_printf(s, "A %zd -> %p\n", size, ptr);
~^ ~~~~
%I64d
qjs.c:186:31: warning: too many arguments for format [-Wformat-extra-args]
js_trace_malloc_printf(s, "A %zd -> %p\n", size, ptr);
^~~~~~~~~~~~~~~
qjs.c: In function 'js_trace_realloc':
qjs.c:216:39: warning: unknown conversion type character 'z' in format [-Wformat=]
js_trace_malloc_printf(s, "R %zd %p\n", size, ptr);
^
qjs.c:216:43: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
js_trace_malloc_printf(s, "R %zd %p\n", size, ptr);
~^ ~~~~
%I64d
qjs.c:216:35: warning: too many arguments for format [-Wformat-extra-args]
js_trace_malloc_printf(s, "R %zd %p\n", size, ptr);
^~~~~~~~~~~~
qjs.c:225:35: warning: unknown conversion type character 'z' in format [-Wformat=]
js_trace_malloc_printf(s, "R %zd %p", size, ptr);
^
qjs.c:225:39: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
js_trace_malloc_printf(s, "R %zd %p", size, ptr);
~^ ~~~~
%I64d
qjs.c:225:31: warning: too many arguments for format [-Wformat-extra-args]
js_trace_malloc_printf(s, "R %zd %p", size, ptr);
^~~~~~~~~~
x86_64-w64-mingw32-gcc -g -Wall -MMD -MF .obj/qjs.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/qjs.o qjs.c
qjs.c: In function 'js_trace_malloc_printf':
qjs.c:152:35: warning: unknown conversion type character 'l' in format [-Wformat=]
printf("H%+06lld.%zd",
^
qjs.c:152:39: warning: unknown conversion type character 'z' in format [-Wformat=]
printf("H%+06lld.%zd",
^
qjs.c:152:28: warning: too many arguments for format [-Wformat-extra-args]
printf("H%+06lld.%zd",
^~~~~~~~~~~~~~
qjs.c:152:35: warning: unknown conversion type character 'l' in format [-Wformat=]
printf("H%+06lld.%zd",
^
qjs.c:152:39: warning: unknown conversion type character 'z' in format [-Wformat=]
printf("H%+06lld.%zd",
^
qjs.c:152:28: warning: too many arguments for format [-Wformat-extra-args]
printf("H%+06lld.%zd",
^~~~~~~~~~~~~~
qjs.c:161:26: warning: unknown conversion type character 'z' in format [-Wformat=]
printf("%zd", sz);
^
qjs.c:161:24: warning: too many arguments for format [-Wformat-extra-args]
printf("%zd", sz);
^~~~~
qjs.c:161:26: warning: unknown conversion type character 'z' in format [-Wformat=]
printf("%zd", sz);
^
qjs.c:161:24: warning: too many arguments for format [-Wformat-extra-args]
printf("%zd", sz);
^~~~~
qjs.c: In function 'js_trace_malloc':
qjs.c:186:35: warning: unknown conversion type character 'z' in format [-Wformat=]
js_trace_malloc_printf(s, "A %zd -> %p\n", size, ptr);
^
qjs.c:186:42: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
js_trace_malloc_printf(s, "A %zd -> %p\n", size, ptr);
~^ ~~~~
%I64d
qjs.c:186:31: warning: too many arguments for format [-Wformat-extra-args]
js_trace_malloc_printf(s, "A %zd -> %p\n", size, ptr);
^~~~~~~~~~~~~~~
qjs.c: In function 'js_trace_realloc':
qjs.c:216:39: warning: unknown conversion type character 'z' in format [-Wformat=]
js_trace_malloc_printf(s, "R %zd %p\n", size, ptr);
^
qjs.c:216:43: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
js_trace_malloc_printf(s, "R %zd %p\n", size, ptr);
~^ ~~~~
%I64d
qjs.c:216:35: warning: too many arguments for format [-Wformat-extra-args]
js_trace_malloc_printf(s, "R %zd %p\n", size, ptr);
^~~~~~~~~~~~
qjs.c:225:35: warning: unknown conversion type character 'z' in format [-Wformat=]
js_trace_malloc_printf(s, "R %zd %p", size, ptr);
^
qjs.c:225:39: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
js_trace_malloc_printf(s, "R %zd %p", size, ptr);
~^ ~~~~
%I64d
qjs.c:225:31: warning: too many arguments for format [-Wformat-extra-args]
js_trace_malloc_printf(s, "R %zd %p", size, ptr);
^~~~~~~~~~
gcc -g -Wall -MMD -MF .obj/qjsc.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -DCONFIG_CC=\"gcc\" -DCONFIG_PREFIX=\"/usr/local\" -O2 -flto -c -o .obj/qjsc.host.o qjsc.c
gcc -g -Wall -MMD -MF .obj/quickjs.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/quickjs.host.o quickjs.c
gcc -g -Wall -MMD -MF .obj/libregexp.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/libregexp.host.o libregexp.c
gcc -g -Wall -MMD -MF .obj/libunicode.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/libunicode.host.o libunicode.c
gcc -g -Wall -MMD -MF .obj/cutils.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/cutils.host.o cutils.c
gcc -g -Wall -MMD -MF .obj/quickjs-libc.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/quickjs-libc.host.o quickjs-libc.c
gcc -g -Wall -MMD -MF .obj/libbf.host.o.d -Wno-array-bounds -Wno-format-truncation -D_GNU_SOURCE -DCONFIG_VERSION=\"2020-03-16\" -DCONFIG_BIGNUM -O2 -flto -c -o .obj/libbf.host.o libbf.c
gcc -g -flto -Wl,-static,-s -o host-qjsc .obj/qjsc.host.o .obj/quickjs.host.o .obj/libregexp.host.o .obj/libunicode.host.o .obj/cutils.host.o .obj/quickjs-libc.host.o .obj/libbf.host.o -lm
lto1.exe: internal compiler error: in gen_subprogram_die, at dwarf2out.c:22682
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://sourceforge.net/projects/msys2> for instructions.
lto-wrapper.exe: fatal error: gcc returned 1 exit status
compilation terminated.
C:/msys32/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: error: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile:203: host-qjsc] Error 1
Liu.D.H@DESKTOP-KA8TQF4 MINGW64 ~/quickjs/QuickJS-Windows-Build
$
Liu.D.H@DESKTOP-KA8TQF4 MINGW64 ~/quickjs/QuickJS-Windows-Build
$ which make
/mingw64/bin/make
Liu.D.H@DESKTOP-KA8TQF4 MINGW64 ~/quickjs/QuickJS-Windows-Build
$ cat `which make`
#! /bin/sh
"mingw32-make" "$@"
Liu.D.H@DESKTOP-KA8TQF4 MINGW64 ~/quickjs/QuickJS-Windows-Build
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys32\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys32/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-8.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=ada,c,lto,c++,objc,obj-c++,fortran --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev3, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 8.2.0 (Rev3, Built by MSYS2 project)
Liu.D.H@DESKTOP-KA8TQF4 MINGW64 ~/quickjs/QuickJS-Windows-Build
$ make -v
GNU Make 4.2.1
Built for x86_64-w64-mingw32
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Liu.D.H@DESKTOP-KA8TQF4 MINGW64 ~/quickjs/QuickJS-Windows-Build
$
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.