Closed stv0g closed 5 months ago
Here is an example as used by go-rosenpass: https://github.com/stv0g/go-rosenpass/commit/fb93e83dbddd92b60da5feef68f5d0230d4a3684
@stv0g Thanks, I'll look into it this week
@stv0g The only way to link statically is a bit hacky.
In the cgo preamble of oqs.go
, immediately after the line https://github.com/open-quantum-safe/liboqs-go/blob/e3e87437a36ce5f154ad38f81b11278187c896a5/oqs/oqs.go#L5 add the line #cgo LDFLAGS: /usr/local/liboqs.a
(of course with the path corresponding to your location of liboqs.a). Make sure you don't add any additional new line(s).
Next, comment (add a #
in front of) the last line of .config/liboqs.pc
(the line starting with Libs:
), i.e., https://github.com/open-quantum-safe/liboqs-go/blob/e3e87437a36ce5f154ad38f81b11278187c896a5/.config/liboqs.pc#L9
Finally, do a go clean -cache
to force pkg-config to use the updated liboqs.pc
.
As far as I know, there's no elegant way of statically linking by only modifying the liboqs.pc
file.
Fixed by #37
Does liboqs-go support static linking against liboqs?
I would like to build a statically linked Go executable without external depdendencies..