all: fix the link error with Go 1.24.3#312
Conversation
|
See also: golang/go#73617 I don't know if this is an issue with Go, or with this module... |
|
I noticed: Lines 16 to 24 in 9059adf Is it intentional that this block is duplicated? |
At first glance, this looks like a regression in the Go toolchain itself.
I don't remember why I did it that way. I'm pretty confident the duplicated lines are unnecessary. We can remove it after the Go toolchain is resolved |
Don't we have to wait for the Go toolchain fix? |
|
The test failure for FreeBSD seems another issue by the way. |
We can remove it now it doesn't break any of the current Go versions but it's probably best to wait until things are resolved |
FreeBSD is having the same issue as macOS described in the Go issue |
Ah yes that's right. Maybe the CI doesn't run the latest Go for macOS yet, which is why the tests passed for macOS now. |
|
Removing the duplicated symbols didn't fix the issue. Hmm? |
I wouldn't think it would. The issue is in the linker not with our code |
|
@hajimehoshi this patch suggested by cherrymui appears to fix the issue Subject: [PATCH] uintptr -> uint8
---
Index: dlfcn.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/dlfcn.go b/dlfcn.go
--- a/dlfcn.go (revision 2c36c15debde48b37b30e9ae9dea32483ef79922)
+++ b/dlfcn.go (date 1746631095267)
@@ -83,17 +83,17 @@
// appear to work if you link directly to the C function on darwin arm64.
//go:linkname dlopen dlopen
-var dlopen uintptr
+var dlopen uint8
var dlopenABI0 = uintptr(unsafe.Pointer(&dlopen))
//go:linkname dlsym dlsym
-var dlsym uintptr
+var dlsym uint8
var dlsymABI0 = uintptr(unsafe.Pointer(&dlsym))
//go:linkname dlclose dlclose
-var dlclose uintptr
+var dlclose uint8
var dlcloseABI0 = uintptr(unsafe.Pointer(&dlclose))
//go:linkname dlerror dlerror
-var dlerror uintptr
+var dlerror uint8
var dlerrorABI0 = uintptr(unsafe.Pointer(&dlerror))
Index: internal/fakecgo/symbols.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/internal/fakecgo/symbols.go b/internal/fakecgo/symbols.go
--- a/internal/fakecgo/symbols.go (revision 2c36c15debde48b37b30e9ae9dea32483ef79922)
+++ b/internal/fakecgo/symbols.go (date 1746631236394)
@@ -126,85 +126,85 @@
}
//go:linkname _malloc _malloc
-var _malloc uintptr
+var _malloc uint8
var mallocABI0 = uintptr(unsafe.Pointer(&_malloc))
//go:linkname _free _free
-var _free uintptr
+var _free uint8
var freeABI0 = uintptr(unsafe.Pointer(&_free))
//go:linkname _setenv _setenv
-var _setenv uintptr
+var _setenv uint8
var setenvABI0 = uintptr(unsafe.Pointer(&_setenv))
//go:linkname _unsetenv _unsetenv
-var _unsetenv uintptr
+var _unsetenv uint8
var unsetenvABI0 = uintptr(unsafe.Pointer(&_unsetenv))
//go:linkname _sigfillset _sigfillset
-var _sigfillset uintptr
+var _sigfillset uint8
var sigfillsetABI0 = uintptr(unsafe.Pointer(&_sigfillset))
//go:linkname _nanosleep _nanosleep
-var _nanosleep uintptr
+var _nanosleep uint8
var nanosleepABI0 = uintptr(unsafe.Pointer(&_nanosleep))
//go:linkname _abort _abort
-var _abort uintptr
+var _abort uint8
var abortABI0 = uintptr(unsafe.Pointer(&_abort))
//go:linkname _sigaltstack _sigaltstack
-var _sigaltstack uintptr
+var _sigaltstack uint8
var sigaltstackABI0 = uintptr(unsafe.Pointer(&_sigaltstack))
//go:linkname _pthread_attr_init _pthread_attr_init
-var _pthread_attr_init uintptr
+var _pthread_attr_init uint8
var pthread_attr_initABI0 = uintptr(unsafe.Pointer(&_pthread_attr_init))
//go:linkname _pthread_create _pthread_create
-var _pthread_create uintptr
+var _pthread_create uint8
var pthread_createABI0 = uintptr(unsafe.Pointer(&_pthread_create))
//go:linkname _pthread_detach _pthread_detach
-var _pthread_detach uintptr
+var _pthread_detach uint8
var pthread_detachABI0 = uintptr(unsafe.Pointer(&_pthread_detach))
//go:linkname _pthread_sigmask _pthread_sigmask
-var _pthread_sigmask uintptr
+var _pthread_sigmask uint8
var pthread_sigmaskABI0 = uintptr(unsafe.Pointer(&_pthread_sigmask))
//go:linkname _pthread_self _pthread_self
-var _pthread_self uintptr
+var _pthread_self uint8
var pthread_selfABI0 = uintptr(unsafe.Pointer(&_pthread_self))
//go:linkname _pthread_get_stacksize_np _pthread_get_stacksize_np
-var _pthread_get_stacksize_np uintptr
+var _pthread_get_stacksize_np uint8
var pthread_get_stacksize_npABI0 = uintptr(unsafe.Pointer(&_pthread_get_stacksize_np))
//go:linkname _pthread_attr_getstacksize _pthread_attr_getstacksize
-var _pthread_attr_getstacksize uintptr
+var _pthread_attr_getstacksize uint8
var pthread_attr_getstacksizeABI0 = uintptr(unsafe.Pointer(&_pthread_attr_getstacksize))
//go:linkname _pthread_attr_setstacksize _pthread_attr_setstacksize
-var _pthread_attr_setstacksize uintptr
+var _pthread_attr_setstacksize uint8
var pthread_attr_setstacksizeABI0 = uintptr(unsafe.Pointer(&_pthread_attr_setstacksize))
//go:linkname _pthread_attr_destroy _pthread_attr_destroy
-var _pthread_attr_destroy uintptr
+var _pthread_attr_destroy uint8
var pthread_attr_destroyABI0 = uintptr(unsafe.Pointer(&_pthread_attr_destroy))
//go:linkname _pthread_mutex_lock _pthread_mutex_lock
-var _pthread_mutex_lock uintptr
+var _pthread_mutex_lock uint8
var pthread_mutex_lockABI0 = uintptr(unsafe.Pointer(&_pthread_mutex_lock))
//go:linkname _pthread_mutex_unlock _pthread_mutex_unlock
-var _pthread_mutex_unlock uintptr
+var _pthread_mutex_unlock uint8
var pthread_mutex_unlockABI0 = uintptr(unsafe.Pointer(&_pthread_mutex_unlock))
//go:linkname _pthread_cond_broadcast _pthread_cond_broadcast
-var _pthread_cond_broadcast uintptr
+var _pthread_cond_broadcast uint8
var pthread_cond_broadcastABI0 = uintptr(unsafe.Pointer(&_pthread_cond_broadcast))
//go:linkname _pthread_setspecific _pthread_setspecific
-var _pthread_setspecific uintptr
+var _pthread_setspecific uint8
var pthread_setspecificABI0 = uintptr(unsafe.Pointer(&_pthread_setspecific))
Index: internal/fakecgo/gen.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/internal/fakecgo/gen.go b/internal/fakecgo/gen.go
--- a/internal/fakecgo/gen.go (revision 2c36c15debde48b37b30e9ae9dea32483ef79922)
+++ b/internal/fakecgo/gen.go (date 1746631171875)
@@ -76,7 +76,7 @@
{{end}}
{{- range . }}
//go:linkname _{{.Name}} _{{.Name}}
-var _{{.Name}} uintptr
+var _{{.Name}} uint8
var {{.Name}}ABI0 = uintptr(unsafe.Pointer(&_{{.Name}}))
{{ end }} |
|
Yeah, the uint8 patch worked, thanks! |
|
I'll check-pick this fix to the stable branch 0.8, and tag it a few days later. |
This addresses the issue golang/go#73617. Closes #313
|
Hi @hajimehoshi thanks for fixing this so quickly! When can we expect a new release of this module? |
In a few days |
|
Yeah, and if you are in a hurry, please specify the commit hash directly (1638563) |
how to do this? |
go get github.com/ebitengine/purego@1638563e361522e5f63511d84c4541ae1c5fd704EDIT: We've released v0.8.3 go get github.com/ebitengine/purego@v0.8.3 |
bringing up the stack ebitengine/purego#312 --------- Signed-off-by: Eliott Bouhana <eliott.bouhana@datadoghq.com>
Bumps purego to fix a linker issue with dlopen on x86_64-darwin. ``` link: duplicated definition of symbol dlopen, from github.com/ebitengine/purego and github.com/ebitengine/purego ```` See ebitengine/purego#312
Bumps purego to fix a linker issue with dlopen on x86_64-darwin. ``` link: duplicated definition of symbol dlopen, from github.com/ebitengine/purego and github.com/ebitengine/purego ```` See ebitengine/purego#312
What issue is this addressing?
This addresses the issue golang/go#73617.
What type of issue is this addressing?
n/a
What this PR does | solves
Closes #313