Open oligamiq opened 1 year ago
libffi_go_print.lib(000005.o) : error LNK2019: unresolved external symbol fprintf referenced in function _cgo_beginthread
I don't see how we could begin to realistically solve this and make it stay solved? This is a missing function referenced by the Go code, and we don't know what steps CGo normally takes to make this compile and link correctly. It likely only links correctly by accident on Ubuntu.
This program succussed on mac-pc
On macOS all dynamic libraries which Go depend on are likely already depended on by Rust or added by default by the linker. On Windows this is likely not the case. You may want to open an issue for cgo_oligami as that crate is responsible for making sure everything necessary to successfully link Go is in place.
As for the alpine issue, you may be hitting https://github.com/golang/go/issues/13492.
@bjorn3 @workingjubilee
I search golang issue and found https://github.com/golang/go/issues/17014.
Golang is not support llvm on windows so Rust cannot link Golang staticlib on windows!!
This is bad news, but I know reason.
Thank you bjorn3, workingjubilee!!
On macOS all dynamic libraries which Go depend on are likely already depended on by Rust or added by default by the linker. On Windows this is likely not the case. You may want to open an issue for cgo_oligami as that crate is responsible for making sure everything necessary to successfully link Go is in place.
Coder went to the compiler one day, said they don't know what to do, said they don't know how to make Go on Windows link to Rust, said the world seems threatening and uncertain, and they're completely depressed! And the compiler said, "Treatment is simple. The great maintainer Oligami is in town tonight. Go and see them. They should fix your issue." And the coder bursts into tears, "Compiler, I am the great maintainer Oligami!"
I added dependencies on mac because stackoverflow sample. And generated file name is small failed etc., Forking source library cannot run without linux so, he may test on only linux.
Hi, I love rust and golang both!
Rust call golang by ffi. windows11: stable & beta & nightly:
wsl(ubuntu22): stable & beta & nightly: conplete
alpine(docker): stable & beta & nightly: segmentation fault on golang func
code on https://github.com/oligami-0424/ffi-rust-go I tried this code:
I expected to see this happen: success on all
Instead, this happened: success on only ubuntu
rustc --version --verbose
: windows11ubuntu(wsl)
alpine