Comments (12)
OK, tried to move my devtools to Win10 (at least to get it compiled). After that I will come back to cross-compiling which seems to be tricky enough (for me).
But installing in Windows I've got also errors :
C:\Users\esa\devel\u2f>go get github.com/miekg/pkcs11
# github.com/miekg/pkcs11
src\github.com\miekg\pkcs11\pkcs11.go:26:18: fatal error: ltdl.h: No such file or directory
compilation terminated.
Then I found some help from SO-answers, and downloaded libtool-1.5.26-lib.zip and copied ltdl.h to my toolchain include dir (TDM-GCC-64). But next error :
C:\Users\esa\devel\u2f>go get github.com/miekg/pkcs11
# github.com/miekg/pkcs11
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lltdl
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lltdl
collect2.exe: error: ld returned 1 exit status
So, what else do I have? Maybe missing still something.
Does it have something to do with cgo flags :
/*
#cgo windows CFLAGS: -DREPACK_STRUCTURES
#cgo windows LDFLAGS: -Wl,--no-as-needed -lltdl
#cgo linux LDFLAGS: -Wl,--no-as-needed -lltdl -ldl
#cgo darwin CFLAGS: -I/usr/local/share/libtool
#cgo darwin LDFLAGS: -lltdl -L/usr/local/lib/ -I/usr/local/share/libtool
#cgo openbsd CFLAGS: -I/usr/local/include/
#cgo openbsd LDFLAGS: -lltdl -L/usr/local/lib/
#cgo LDFLAGS: -lltdl
@miekg @mtharp have you any idea what to do (to get this installed).
Thanks in advise.
from pkcs11.
Don't know any windows, but:
GOOS=windows GOARCH=amd64 go build -o t5.exe test5.go
Not sure if all deps are cross compile correctly here. What happen with just a go clean
and go build
i.e. don't specify any Go files
Also we use cgo so cross compiling might harder?
from pkcs11.
I tried to get Yubikey:s own dll ( libykcs11-1.dll ) and put it in my ./lib/
dir.
Then changed source code:
// p := pkcs11.New("./lib/libykcs11.dylib")
p := pkcs11.New("./lib/libykcs11-1.dll")
so building should at least find valid .dll (works on Win).
But it throws same errors: ( I'm still in Osx env )
► iMac@pkcs11$ GOOS=windows GOARCH=amd64 go build -o t5.exe test5.go
# command-line-arguments
./test5.go:14:7: undefined: pkcs11.New
I have not enough experience compiling and cross-compiling !! So it was just a "brief try".
Do you think it has possibility to work if moving whole building-phase under Windows-env.
I must figure out what I'm missing in my toolchain (Windows), but is it worth to try.
I found also tool called gonative (https://github.com/inconshreveable/gonative).
But it seems a bit old, and I'm not sure if it might help??
Also some article https://inconshreveable.com/04-30-2014/cross-compiling-golang-programs-with-native-libraries/.
OK, maybe I will try pure Win-env for building, if you don't find anything to try within osx ?
Or do you think it doesn't help??
from pkcs11.
What about tool called gox ( https://github.com/mitchellh/gox ) ??
Not tried yet, but seems up-to-date tool; is it worth trying?
from pkcs11.
Just the Go tool chain should be enough to cross build even with cgo (provided you have the libraries and headers installed).
from pkcs11.
Maybe not, you are right. What libs and headers do you mean (just remember I'm quite newbie with Go and C).
from pkcs11.
Can you figure where I have to locate header files (ykpiv.h).
And should I have win_dll (libykcs11-1.dll) in my building env or is it needed just when running in windows?
Can it be some cgo flag which I'm missing (CGO_CFLAGS or CGO_LDFLAGS).
from pkcs11.
I've had luck using xgo https://github.com/karalabe/xgo (requires docker)
Example:
xgo --targets windows/amd64 --deps=http://mirror.clarkson.edu/gnu/libtool/libtool-2.4.6.tar.gz --ldflags '-extldflags -static' .
from pkcs11.
@netmiller try xgo
. Here's what worked for me:
- put your package in
$GOPATH/src
(I tried from other place and xgo failed withcan't load package: package .: no Go files in /
) cd
into$GOPATH/src/yourpackage
xgo --deps="http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz" --targets windows/amd64 .
(I need only win64)
from pkcs11.
@netmiller same problem
from pkcs11.
Seems to work when compiled from msys2 terminal.
from pkcs11.
@netmiller were you able to get a solution for this?
from pkcs11.
Related Issues (20)
- Is it possible to integrate this with GCloud KMS - HSM system?
- Panic in NewAttribute when use u/int16/32/64 as Attribute value
- Replace p11.Slot struct with interface HOT 4
- use v3? HOT 3
- Two constants no longer exit HOT 2
- Add CK_RSA_AES_KEY_WRAP_PARAMS to params.go HOT 6
- license issue related to the OASIS IPR Policy HOT 1
- p11.Slot.Mechanisms seems inadequate substitute for pkcs11.Ctx.GetMechanismList
- Cumbersome cryptographic operations for speed tests
- Error running in Ubuntu 18.04 I386 HOT 1
- Using AWS CloudHSM to sign ethereum transactions HOT 1
- RFE: RFC7512 URI support HOT 2
- RFE: Load p11-kit-proxy.so as default provider HOT 4
- Can't access functions of pkg HOT 1
- Error running the PKCS11 package on Windows HOT 4
- Returning attributes through GetAttributeValue in certain error scenarios
- Problem with "pkcs11.h" when running with "go build", "go run ." or "go run main.go"
- Non symetric AES keys
- Static build binary contained the pkcs11 package dlopen HOT 2
- no rsa verify test in pkcs11_test HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pkcs11.