go-fitz icon indicating copy to clipboard operation
go-fitz copied to clipboard

undefined: purego.Dlsym

Open salvatoresaba opened this issue 1 year ago • 6 comments

Using this package I got this error: [email protected]\fitz_nocgo.go:666:25: undefined: purego.Dlsym

salvatoresaba avatar Dec 27 '24 08:12 salvatoresaba

And what would be your usage? Naively cross-compile with CGO_ENABLED=0 for some architecture the purego library doesn't handle? That is experimental, as written in README, to cross-compile, use CGO_ENABLED=1 and the C compiler for that platform.

gen2brain avatar Dec 31 '24 14:12 gen2brain

also seeing the same issue, using Windows 11 (intel chip)

kpotter-m2 avatar Jan 17 '25 20:01 kpotter-m2

Ok, same issue, but can one of you send the details so I don't have to guess?

gen2brain avatar Jan 17 '25 23:01 gen2brain

@gen2brain The issue is in fitz_nocgo.go. This file contains purego.Dlsym(), which is only available on Unix systems, but this file does not contain a !windows build constraint.

JupiterRider avatar Feb 10 '25 17:02 JupiterRider

Same issue, how to solve this problem

hankin-h-k avatar Apr 09 '25 06:04 hankin-h-k

@hankin-h-k For a start, do not use experimental purego implementation.

gen2brain avatar Apr 09 '25 06:04 gen2brain

我也遇见这个问题了, 求修复

zhangxinpeng-master avatar Jun 12 '25 11:06 zhangxinpeng-master

Build Error: go build -o D:\project\go\taier\zhao_shang_server\cmd__debug_bin3435999559.exe -gcflags all=-N -l .\main.go github.com/gen2brain/go-fitz C:\Users\Administrator\go\pkg\mod\github.com\gen2brain\[email protected]\fitz_nocgo.go:666:25: undefined: purego.Dlsym (exit status 1)

U8tou avatar Jun 16 '25 09:06 U8tou

Yes, it is experimental. When I find the time, I will fix it. But, maybe I will remove purego implementation, not sure why everyone is trying to use it. If I fix it next, there will be issues again about not handling crashes (it is not possible to use their fz_try/fz_catch) with the shared lib.

gen2brain avatar Jun 16 '25 09:06 gen2brain

Fixed in https://github.com/gen2brain/go-fitz/commit/5c0c7131883fbd596a7295fc15fb55871814ccde.

gen2brain avatar Jun 16 '25 11:06 gen2brain