NordSecurity / uniffi-bindgen-go

Uniffi bindings generator for Golang
Mozilla Public License 2.0
75 stars 21 forks source link

undefined reference #16

Open gogo2464 opened 1 year ago

gogo2464 commented 1 year ago

I did go run .\testing.go

on

package main

import (
    "cryptatools"
    "fmt"
)

func main() {
    myvar := cryptatools.AlphabetNewEmpty() //Alphabet

    fmt.Println(myvar)
}

The line

import ( "cryptatools" "fmt" )

Does not immediately triggers any error.

Sadly I am having a lot of undefined references error.

C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\XXX\AppData\Local\Temp\go-link-4148466772\000001.o: in function _cgo_a8c9215c6423_Cfunc_cryptatools_ce1b_uniffy_opcode_group': /tmp/go-build/cgo-gcc-prolog:393: undefined reference tocryptatools_ce1b_uniffy_opcode_group' C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\XXX\AppData\Local\Temp\go-link-4148466772\000001.o: in function `_cgo_a8c9215c6423_Cfunc_ffi_cryptatools_ce1b_rustbuffer_free':

My python bindings are already working contrary to go bindings.

May it be due to the undone update to uniffy 0.24 please? I read this https://github.com/NordSecurity/uniffi-bindgen-go/pull/13

arg0d commented 1 year ago

Currently Go bindings only work with uniffi 0.23. If you are trying to mix different versions, you are by design going to encounter errors. This is because uniffi ABI is unstable, and you would encounter strange bugs if versions don't match. Consider downgrading your project to use uniffi 0.23 for the time being.

gogo2464 commented 1 year ago

Could I compile the existing forked pr in order to solve the issue please?

arg0d commented 1 year ago

I'm not sure what you mean. It doesn't look like the PR is finished. Is downgrading the uniffi version that you use to 0.23 not an option?

gogo2464 commented 1 year ago

Not really because I already have python bindings with the version 0.24 of uniffy.

gogo2464 commented 1 year ago

might work with cargo install uniffi-bindgen-go --git https://github.com/dignifiedquire/uniffi-bindgen-go --branch upgarde-uniffi-24. I am testing.

arg0d commented 1 year ago

I wouldn't use it until the PR is actually finished. It might look like it works, but there might be some hidden edge cases where it doesn't work right.

Not really because I already have python bindings with the version 0.24 of uniffy.

Are you using 0.24 specific features? I don't see why you shouldn't be able to downgrade to 0.23 for Python bindings.

gogo2464 commented 1 year ago

Because I upgraded my code to uniffy-rs 0.24 for python bindings. I want to reuse the same code for the go bindings.

gogo2464 commented 1 year ago

@arg0d https://github.com/NordSecurity/uniffi-bindgen-go/issues/16#issuecomment-1717894747 are you sure it is not only because I am on Windows? Maybe it is because I am on windows and because I am both on windows and old uniffy-rs version.

I will test at the end of the PR if I can directly use it on windows.

gogo2464 commented 10 months ago

hi. is it fixed?

arg0d commented 10 months ago

0.24 was skipped and not released, so you need to choose between 0.23 and 0.25.

gogo2464 commented 10 months ago

sure perfect! I will pick 0.25 directly!!! 0.25 is ok?

arg0d commented 10 months ago

yes, 0.25 is supposed to work fine.

gogo2464 commented 10 months ago

cool! I will test on my project!