Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into problems when trying to preserve C files #18

Open
VoR0220 opened this issue Aug 8, 2016 · 9 comments
Open

Running into problems when trying to preserve C files #18

VoR0220 opened this issue Aug 8, 2016 · 9 comments

Comments

@VoR0220
Copy link

VoR0220 commented Aug 8, 2016

tried this: glide vc --keep 'Makefile' '**/*.h' '**/*.cpp*'

but it still appears to be deleting my necessary cpp and such files...any hints?

@sgotti
Copy link
Owner

sgotti commented Aug 8, 2016

@VoR0220 Are these files inside a package that has been kept by glide-vc or inside a dir not kept by glide-vc? Currently --keep will only keep files inside needed go packages.

Can you describe your use case?

@VoR0220
Copy link
Author

VoR0220 commented Aug 8, 2016

it is inside a needed go package, but it's a C Go extension. Basically I'm trying to port in a crypto library whereby there is C GO extensions added in but I can't seem to figure out how to make that happen.

@VoR0220
Copy link
Author

VoR0220 commented Aug 8, 2016

it's a directory that's referenced by the package...

@VoR0220
Copy link
Author

VoR0220 commented Aug 8, 2016

I get the feeling I'm not going to like the answer I'm about to get...

@sgotti
Copy link
Owner

sgotti commented Aug 8, 2016

it's a directory that's referenced by the package...

glide-vc by default keeps cpp and hpp file inside the needed packages since this is how cgo works (https://golang.org/cmd/cgo/)

I'm not sure how you make cgo work if you put cpp/hpp files in a directory outside the using package and why this is inside the vendor dir (is it a program vendoring your cgo based go library?).

Can you provide some details on your program and what you are trying to do since it's not completely clear to me (or just a github repo with the whole project)?

@VoR0220
Copy link
Author

VoR0220 commented Aug 9, 2016

I think I've come to the conclusion that it's not VC that's the problem, it's the way I'm structuring my dockerfile. If I run into any more problems though, I will be certain to contact you. Thanks for your help. I hope the day comes when this is implemented into the main glide.

@VoR0220 VoR0220 closed this as completed Aug 9, 2016
@VoR0220 VoR0220 reopened this Oct 2, 2016
@VoR0220
Copy link
Author

VoR0220 commented Oct 2, 2016

Okay I can reproduce the issue now. Basically it's this directory right here: https://github.com/ethereum/go-ethereum/tree/master/crypto/secp256k1

Basically the problem is that I try to keep libsecp256k1 directory intact, and I can't seem to get it to keep it. I've tried many variations of this below example:

glide vc --keep 'go-ethereum/crypto/*' 'go-ethereum/crypto/secpk256k1/*' './vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/*' 'vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/include/*' 'vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/obj/*' 'vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/*' --dryrun

@VoR0220
Copy link
Author

VoR0220 commented Oct 2, 2016

I should clarify, I manage to get crypto and secpk256k1, just not the subsequent c libs.

@sgotti
Copy link
Owner

sgotti commented Oct 3, 2016

@VoR0220 Thanks for the additional information. https://github.com/ethereum/go-ethereum/tree/master/crypto/secp256k1 is using cgo in a strange way. It bundles libsecp256k1 source code and builds the cgo required functions using relative includes to some of its .c and .h files. I think this is done to avoid the user having libsecp256k1 installed on their system and link against it (like its usually done) but instead compile and link only the required functions during a go build.

There's no way (without code analysis) for glide-vc to infer the additional cgo required files inside other dirs like this case. So I can think of two solutions:

  • Just implement an additional step that will copy back ./vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/ after running glide-vc
  • Extend --keep to also keep any file in the vendor dir. Now --keep only keeps additional files inside required packages dir (not subdirs or other non required packages) but probably this can be relaxed (and add better documentation to explain that --keep shouldn't be needed and used only for special cases like this and not to fix improper glide configurations/missing packages).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants