Giter Club home page Giter Club logo

quickjs-go's Issues

import error : SyntaxError: expecting '('

// hello.js
function hello() {
return 'hello'
}
export default hello

//mian.go
package main

import (
"fmt"
"time"

"github.com/buke/quickjs-go"
polyfill "github.com/buke/quickjs-go-polyfill"

)

func main() {
// Create a new runtime
rt := quickjs.NewRuntime()
defer rt.Close()
// Create a new context
ctx := rt.NewContext()
defer ctx.Close()
// Inject polyfills to the context
polyfill.InjectAll(ctx)
ret, err := ctx.Eval(console.log("aaaa"); import {hello} from './hello'; console.log("22222"+hello()))
defer ret.Free()
fmt.Println("error:", ret, err)
// Wait for the timeout to finish
time.Sleep(time.Millisecond * 100)
rt.ExecuteAllPendingJobs()
// Output:
// error: SyntaxError: expecting '('
}

Build failing when building on windows 11

This is the error message I'm seeing.

$ go build
# example/hello
C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/allai/go/pkg/mod/github.com/buke/[email protected]/deps/libs/windows_amd64/libquickjs.a(quickjs.nolto.o): in function `js_atomics_wait':
D:\a\quickjs-go\quickjs-go\deps\quickjs/quickjs.c:55522: undefined reference to `clock_gettime'
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/allai/go/pkg/mod/github.com/buke/[email protected]/deps/libs/windows_amd64/libquickjs.a(quickjs-libc.nolto.o): in function `js_std_getenviron':
D:\a\quickjs-go\quickjs-go\deps\quickjs/quickjs-libc.c:703: undefined reference to `__imp___p__environ'
collect2.exe: error: ld returned 1 exit status

If it helps I'm using mingw and this is the info I get from gcc:

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\TDM-GCC-64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/10.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-git-10.3.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,jit,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch --enable-libstdcxx-threads --enable-libstdcxx-time=yes --enable-mingw-wildcard --with-gnu-ld --disable-werror --enable-nls --disable-win32-registry --enable-large-address-aware --disable-rpath --disable-symvers --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=https://github.com/jmeubank/tdm-gcc/issues
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.3.0 (tdm64-1)

Let me know if I can help with anything.

构建失败

D:/c/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: Dwarf Error: Can't find .debug_ranges section.
D:/Users/111/go/pkg/mod/github.com/buke/[email protected]/deps/libs/windows_amd64/libquickjs.a(quickjs-libc.nolto.o):quickjs-libc.c:(.text+0x2c5e): undefined reference to `__imp___p__environ

【feat】是否需要简单的集合操作?

感谢作者的努力,这是一个非常好的项目,但是实际使用下来发现少了一些针对js集合相关的操作,我在fork的基础上简单实现了下,已经通过了大部分的测试,请问作者是否需要这部分代码?如果可以的话,我将会提一个PR

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.