Coder Social home page Coder Social logo

Comments (12)

netmiller avatar netmiller commented on August 21, 2024 2

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.

miekg avatar miekg commented on August 21, 2024

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.

netmiller avatar netmiller commented on August 21, 2024

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.

netmiller avatar netmiller commented on August 21, 2024

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.

miekg avatar miekg commented on August 21, 2024

Just the Go tool chain should be enough to cross build even with cgo (provided you have the libraries and headers installed).

from pkcs11.

netmiller avatar netmiller commented on August 21, 2024

Maybe not, you are right. What libs and headers do you mean (just remember I'm quite newbie with Go and C).

from pkcs11.

netmiller avatar netmiller commented on August 21, 2024

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.

mtharp avatar mtharp commented on August 21, 2024

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.

kaaposc avatar kaaposc commented on August 21, 2024

@netmiller try xgo. Here's what worked for me:

  1. put your package in $GOPATH/src (I tried from other place and xgo failed with can't load package: package .: no Go files in /)
  2. cd into $GOPATH/src/yourpackage
  3. xgo --deps="http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz" --targets windows/amd64 . (I need only win64)

from pkcs11.

CsterKuroi avatar CsterKuroi commented on August 21, 2024

@netmiller same problem

from pkcs11.

crackcomm avatar crackcomm commented on August 21, 2024

Seems to work when compiled from msys2 terminal.

from pkcs11.

shrirangrk avatar shrirangrk commented on August 21, 2024

@netmiller were you able to get a solution for this?

from pkcs11.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.