Giter Club home page Giter Club logo

quickjs-windows-build's People

Contributors

mengmo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

quickjs-windows-build's Issues

Ship builds with os.Worker support

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.

Missing components

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:

  1. It would be better if the library - including headers, etc. - was made available as a NuGet package on nuget.org; this would make it super easy to consume. Happy to help onboard this if there is interest.
  2. The release is missing an import lib (libquickjs.lib) - this is needed in order to link the DLL. I generated it by dumping the exports in the DLL, cleaning it up, saving the result as a .def file, and then using the lib.exe tool to generate the import lib.
  3. The headers are missing some types - some types such as 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'd be interested to hear back and if this project is still active and you are interested in help, let me know :)

Executable output is not supported for this target

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>

output color issue

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

Executable output is not supported for this target or Could not load '-o'

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
$

lto-wrapper.exe: fatal error: gcc returned 1 exit status

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
$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.