Code Monkey home page Code Monkey logo

Comments (17)

clausecker avatar clausecker commented on September 24, 2024

Thanks for the info. I have written this library many years ago and don't remember all the details. Please consider it to be experimental and essentially unmaintained. As of now I do not even have the hardware to test the code, so it is difficult for me to continue development on it.

I will however go ahead and amend the README to be more clear about the demands (which I don't quite recall).

from freefare.

alex-berliner avatar alex-berliner commented on September 24, 2024

@maitredede
Was this a problem that stopped the bindings from working for you? I've installed libfreefare 0.4.0 aka 530ccbc19309c8ab2b8160c2b57fefd747321d04 and I see a bunch of errors related to MifareKeyDeriver when I try to perform an import.

package main

import "github.com/clausecker/openkey"

func main() {
  fmt.Println("hello world")
}
$ go run main.go 
# github.com/clausecker/freefare
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:56:8: could not determine kind of name for C.FreefareTag
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:35:10: could not determine kind of name for C.MifareKeyDeriver
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:41:12: could not determine kind of name for C.mifare_key_deriver_begin
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:94:14: could not determine kind of name for C.mifare_key_deriver_end
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:107:12: could not determine kind of name for C.mifare_key_deriver_end_raw
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:69:12: could not determine kind of name for C.mifare_key_deriver_update_aid
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:79:12: could not determine kind of name for C.mifare_key_deriver_update_data
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:59:12: could not determine kind of name for C.mifare_key_deriver_update_uid

from freefare.

clausecker avatar clausecker commented on September 24, 2024

Yes, you'll need a newer version of libfreefare or an older version of this package. If you would like to continue to work with libfreefare 0.4.0, I can tag an older version in the new Go module style so you can use this package with libfreefare 0.4.0.

from freefare.

alex-berliner avatar alex-berliner commented on September 24, 2024

What is a sufficiently new version of libfreefare?
I tried this one which is about 25 commits after 0.4.0 but got the same error.

commit 646a20da34f5fc77e701e0123c73c1879071ccf5 (HEAD)
Author: Romain Tartière <[email protected]>
Date:   Sun Apr 13 19:47:56 2014 +0200

I don't have a requirement to use a particular version of any library.

Thanks for being so prompt on responding to this, I understand that you have not maintained this library for some time.

from freefare.

clausecker avatar clausecker commented on September 24, 2024

Version faac4ae5d881a12d7fb81fc831629ae1d1f10929 should work. That's the last commit before the breaking changes of 1.0.0.

from freefare.

clausecker avatar clausecker commented on September 24, 2024

I have prepared a new release based on the 0.3.1 branch that should work with Go modules and libfreefare version 0.4.0. Could you check if everything works fine if you change the freefare dependency to

github.com/clausecker/freefare@c4129c5480756a78318cdc7b94fbcaf2843c10a8

? If you report success, I'll go ahead and push a v0.3.2 release for use with libfreefare 0.4.0 ASAP.

from freefare.

clausecker avatar clausecker commented on September 24, 2024

This commit has now been pushed as v0.3.2. Please downgrade to v0.3.2 to use this wrapper with libfreefare-0.4.0.

from freefare.

alex-berliner avatar alex-berliner commented on September 24, 2024

Sorry I was taking a while to respond but I am still having some issues. I'm not that familiar with go but I think I'm performing this correctly so I made a reproduction of my steps for how I have installed the components.
This is the error:

pi@pokepi:~/code/nfc/go/helloworld $ go run main.go # initial error
# github.com/clausecker/freefare
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/tag.go:136:31: cannot use *tagptr (variable of type _Ctype_FreefareTag) as type _Ctype_MifareTag in argument to wrapTag
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/tag.go:140:12: cannot use (*_Ctype_MifareTag)(unsafe.Pointer(iptr)) (value of type *_Ctype_MifareTag) as type *_Ctype_FreefareTag in assignment
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/tag.go:159:38: cannot use *cinfo (variable of type _Ctype_struct___8) as type _Ctype_struct___5 in variable declaration
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/tag.go:171:17: cannot use ctag (variable of type _Ctype_FreefareTag) as type _Ctype_MifareTag in argument to wrapTag

libff.txt

from freefare.

clausecker avatar clausecker commented on September 24, 2024

This does not look like you have libfreefare 0.4.0 on your system. Rather, these symbols look like they are from after the symbol name change.

from freefare.

alex-berliner avatar alex-berliner commented on September 24, 2024

In my log I show that I have no other version of libfreefare installed on my system:

pi@pokepi:~/code/nfc/go/helloworld $ go run main.go # uninstalled libfreefare, showing no alternate version of libfreefare on system
# github.com/clausecker/freefare
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/aid.go:3:11: fatal error: freefare.h: No such file or directory
    3 | // #include <freefare.h>
      |           ^~~~~~~~~~~~
compilation terminated.

and then install the version you've indicated:

pi@pokepi:~/code/nfc/c/libfreefare $ git checkout faac4ae5d881a12d7fb81fc831629ae1d1f10929
HEAD is now at faac4ae Fix white spaces inconsistencies.
pi@pokepi:~/code/nfc/c/libfreefare $ git reset --hard && git clean -xdf # no repo modification
HEAD is now at faac4ae Fix white spaces inconsistencies.
pi@pokepi:~/code/nfc/c/libfreefare $ autoreconf -vis && ./configure --prefix=/usr && make && sudo make install # install libfreefare from source at target commit

and it appears to complete successfully with

Libraries have been installed in:
   /usr/lib

Maybe when I am performing make install I am relinking to a dormant version of libfreefare? but besides that I don't know how this would be happening

from freefare.

alex-berliner avatar alex-berliner commented on September 24, 2024

For reference...

pi@pokepi:~/code/nfc/go/helloworld $ apt list --installed "*freefare*"
Listing... Done

from freefare.

clausecker avatar clausecker commented on September 24, 2024

I repeat: the new v0.3.2 (which is what c4129c5 is) is for libfreefare-0.4.0. The release. Not any intermediate or development version.

What I was asking you to try earlier was to build v0.4.0 with libfreefare faac4ae5d881a12d7fb81fc831629ae1d1f10929. But it seems like I was wrong and picked too late of a commit. Perhaps try d946230aec3e81a9b641b49f4a8bf5845c246e1a with v0.4.0 if you want to stay on v0.4.0?

from freefare.

alex-berliner avatar alex-berliner commented on September 24, 2024

Ah apologies, I completely missed that this repository's tag numbering is similar to libfreefare's tag numbering and so I equated any reference to v0.4.0 or similar range with only that library.
The following combination appears to work for me and I can test anything else you like.
github.com/clausecker/freefare@c4129c5480756a78318cdc7b94fbcaf2843c10a8
libfreefare commit faac4ae5d881a12d7fb81fc831629ae1d1f10929

Thanks for the help

from freefare.

clausecker avatar clausecker commented on September 24, 2024

Great! github.com/clausecker/freefare@c4129c5480756a78318cdc7b94fbcaf2843c10a8 (aka github.com/clausecker/[email protected]) should also work with libfreefare-0.4.0, but of course it'll build fine with all libfreefare versions until the breaking changes.

Could you also test v0.4.0 of this package with libfreefare commit faac4ae5d881a12d7fb81fc831629ae1d1f10929? If you use libfreefare commit faac4ae5d881a12d7fb81fc831629ae1d1f10929, then you have everything that should be needed to build github.com/clausecker/[email protected].

from freefare.

alex-berliner avatar alex-berliner commented on September 24, 2024

github.com/clausecker/[email protected] + faac4ae5d881a12d7fb81fc831629ae1d1f10929
success

github.com/clausecker/[email protected] + faac4ae5d881a12d7fb81fc831629ae1d1f10929
fail

# github.com/clausecker/freefare
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:35:10: could not determine kind of name for C.MifareKeyDeriver
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:41:12: could not determine kind of name for C.mifare_key_deriver_begin
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:94:14: could not determine kind of name for C.mifare_key_deriver_end
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:107:12: could not determine kind of name for C.mifare_key_deriver_end_raw
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:69:12: could not determine kind of name for C.mifare_key_deriver_update_aid
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:79:12: could not determine kind of name for C.mifare_key_deriver_update_data
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:59:12: could not determine kind of name for C.mifare_key_deriver_update_uid

github.com/clausecker/[email protected] + d946230aec3e81a9b641b49f4a8bf5845c246e1a
fail

# github.com/clausecker/freefare
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:56:8: could not determine kind of name for C.FreefareTag
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:35:10: could not determine kind of name for C.MifareKeyDeriver
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:41:12: could not determine kind of name for C.mifare_key_deriver_begin
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:94:14: could not determine kind of name for C.mifare_key_deriver_end
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:107:12: could not determine kind of name for C.mifare_key_deriver_end_raw
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:69:12: could not determine kind of name for C.mifare_key_deriver_update_aid
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:79:12: could not determine kind of name for C.mifare_key_deriver_update_data
/home/pi/go/pkg/mod/github.com/clausecker/[email protected]/key-deriver.go:59:12: could not determine kind of name for C.mifare_key_deriver_update_uid

from freefare.

clausecker avatar clausecker commented on September 24, 2024

Fascinating. This should definitely build. Will have to investigate.

from freefare.

clausecker avatar clausecker commented on September 24, 2024

Seems like libfreefare commit b83cbcbb09b3467f455f3e1617f711d9327d4ed8 or later is needed for v0.4.0 of this wrapper. Apparently PR #8 had followed through with some of the upstream symbol renames.

from freefare.

Related Issues (7)

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.