Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change from long to longlong #3235

Merged
merged 3 commits into from
Mar 22, 2024
Merged

Change from long to longlong #3235

merged 3 commits into from
Mar 22, 2024

Conversation

SeaRoll
Copy link
Contributor

@SeaRoll SeaRoll commented Mar 16, 2024

./module.go:119:64: cannot use _Ctype_long(stdinfd) (value of type _Ctype_long) as _Ctype_longlong value in variable declaration
./module.go:120:43: cannot use _Ctype_long(stdoutfd) (value of type _Ctype_long) as _Ctype_longlong value in variable declaration
./module.go:120:60: cannot use _Ctype_long(stderrfd) (value of type _Ctype_long) as _Ctype_longlong value in variable declaration
  • change from uint32 to uint64 due to casting error

@TianlongLiang
Copy link
Contributor

For this fix:

  • change from long to longlong due to error:
    It will error in my local environment
./module.go:119:64: cannot use _Ctype_longlong(stdinfd) (type _Ctype_longlong) as type _Ctype_long in assignment
./module.go:119:64: cannot use _Ctype_longlong(stdoutfd) (type _Ctype_longlong) as type _Ctype_long in assignment
./module.go:119:64: cannot use _Ctype_longlong(stderrfd) (type _Ctype_longlong) as type _Ctype_long in assignment

I think it better to make your modification a git patch and conditionally patch them based on uname -a output we could obtain in ./build.sh

PS: Here is my output for uname -a output:

Linux TL-Work-PC 5.15.0-94-generic #104~20.04.1-Ubuntu SMP Tue Jan 16 13:34:09 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

@SeaRoll
Copy link
Contributor Author

SeaRoll commented Mar 18, 2024

hmm.. I am using an m1 mac, maybe its different?

@TianlongLiang
Copy link
Contributor

I think it's indeed a platform-dependent problem, so we'd better conditionally patch it based on the platform

@SeaRoll
Copy link
Contributor Author

SeaRoll commented Mar 18, 2024

sounds like an idea

@TianlongLiang
Copy link
Contributor

I think we could use C.int64_t, in that way, it will be okay for both our platform: https://stackoverflow.com/questions/70243683/how-to-convert-c-uint64-t-to-cgo-consistently-across-os

@wenyongh wenyongh merged commit b4941b0 into bytecodealliance:main Mar 22, 2024
1 check passed
@wenyongh
Copy link
Contributor

@SeaRoll Thanks for reporting the issue and submitting PR to fix it, as @TianlongLiang mentioned and tested, using C.int64_t should be good, I manually changed your commit file and merged this PR. Please let us know if there is issue found.

wenyongh added a commit that referenced this pull request Apr 3, 2024
Apply patches which were fixed branch main to branch `release/1.3.x`:
- zephyr: Use zephyr sys_cache instead of CMSIS (#3162)
- Fix llvm jit push funcref/externref result type issue (#3169)
- Fix inconsistent coding convention (#3171)
- VSCode IDE enhancement and readme update (#3172)
- zephyr: include math only with minimal libc (#3177)
- Fix wasm loader handling opcode br_table (#3176)
- Specify language in the wasi socket ext project (#3183)
- lldb_function_to_function_dbi: Fix a null dereference (#3189)
- Fix LLVM assertion failure and update CONTRIBUTING.md (#3197)
- lldb_function_to_function_dbi: A hack to avoid crashing on C++ methods (#3190)
- Fix compilation errors on MinGW (#3217)
- Fix compilation errors on esp-idf platform (#3224)
- Fix aot relocation symbols not found on windows 32-bit (#3231)
- Fix nightly run tsan ASLR issue (#3233)
- Go binding: Change C.long to C.int64_t when call wasm_runtime_set_wasi_args_ex (#3235)
- posix_file.c: Correct the dirfd argument that passes to fstatat (#3244)
- Fix compilation errors on zephyr platform (#3255)
- Fix dynamic offset not updated in op_br for block with ret type (#3269)
- Fix CI error when install packages for macos-14 (#3270)
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
…_wasi_args_ex (bytecodealliance#3235)

- Change `C.long` to `C.int64_t` due to error:
```sh
./module.go:119:64: cannot use _Ctype_long(stdinfd) (value of type _Ctype_long) as _Ctype_longlong value in variable declaration
./module.go:120:43: cannot use _Ctype_long(stdoutfd) (value of type _Ctype_long) as _Ctype_longlong value in variable declaration
./module.go:120:60: cannot use _Ctype_long(stderrfd) (value of type _Ctype_long) as _Ctype_longlong value in variable declaration
```
- Change offset from `uint32` to `uint64` due to casting error

ps.
bytecodealliance#3220
https://stackoverflow.com/questions/70243683/how-to-convert-c-uint64-t-to-cgo-consistently-across-os
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants