-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
lib installation on Windows #78
Comments
Sorry, I have no experience with using the Visual Studio buildsystem, so I can offer guesswork at best. Assuming you want to use the VS-generated build using files from the paths you mention, I think that you'll have to
I hope this helps. If it does, I'd be very happy about a documentation pull request. |
definitly, i know why i'll never dev something in C. sometimes you take more times to successfully compile third-party libraries than coding your own program... Anyway thanks for your help, it's seems to be better (even if i doesn't work for the moment). the linker seems to correctly parse my .lib file. However there are a lot of errors that i really don't how to deal with: Have you got any idea on how to solve this? |
Uh-oh. I never tried this before, but it seems like the Go toolchain can't link objects built with Visual C++ (see here). I think you are going to have to build libyara using MinGW. |
more complicated on windows than on linux but (with your help) i made progress. I installed MSYS2/mingw and managed to compile yara from bash. I gave up using pkg-config because it always returns an error, even from mingw. However running with tag "yara_no_pkg_config" is really better than before. It seems it's only missing one library. I've installed openssl and openssl-devel in mingw but it's not enough.
|
You need to pass flags to the linker so that it can find OpenSSL's |
Can you post the error messages that pkg-config gave you? |
Did the OpenSSL and YARA builds generate DLLs or only static libraries ( |
I'm currently at work, i'll check this when i'll be at home. Here's some elements that i remember:
Not sure to clearly understand your first comment. I need to pass this item to the linker like this, is it true? |
Assuming you are setting CGO_LDFLAGS from within bash, use a single pair of double quotes, e.g. export CGO_LDFLAGS="-L${YARA_LIB_PATH} -l yara -L${CRYPTO_LIB_PATH} -lcrypto" |
First of all, thank you for your help, because this time it works :) ... to be more precise, it NEARLY works, but maybe it's just my mistake and my lack of understanding of C linking process:
maybe you'll know how to solve this error
1/ add a comment on first line of "simple-yara.go": |
Alright, we're getting there. It seems that the pkg-config error happens because of a bad commit in YARA:
You should be able to work around this by removing the "m" from the I'll get this fixed properly (VirusTotal/yara#1408). Please post the error messages you get from |
and then tried to run it like this (but it return the same error as if it's trying to run it with pkg-config and return the exact same error): |
You can either pass |
I've never been so happy to see an error from a golang code 😂 . As you see, it finally works! First of all, thanks for your help. Even if i worked a lot to deal with a mountain of problems installing this lib, i probably wouldn't have gotten there without your help. My first mistake was to use msys2 terminal instead of mingw. Indeed, there was a problem with libcrypto and libssl (compiled as .a and .dll but source of conflicts. My second mistake was to directly clone VirusTotal yara repository to compile libyara. There are too much commit and it's the best way to deal with side effects. And last but not least, my third mistake was to compile libraries (like openssl) from source instead of leaving this task to the package manager (pacman on mingw). I confirm that your library works on Windows, even without cross compile from a linux distribution. In few words it's necessary to:
If you want, i can make a pull request with a specific documentation for Windows installation in a seperate txt/md file |
Glad we finally got things worked out. 👍 |
Hi,
I'm trying to use your library on Windows. I'm not familiar with C/C++ and linker/compilation problems but i've searched a lot before posting here. Maybe you could help me. First, i've installed mingw64 and also the latest version of visual studio. I've cloned the official yara repository and successfuly compiled libyara with visual studio. I saw that i've got the following folders:
I didn't understood what i need to put in CGO_LDFLAGS and CGO_CFLAGS env vars or if i need additional compilations to successfully go get github.com/hillu/go-yara.
Actually it just return the following error:
Any help would be appreciated :)
The text was updated successfully, but these errors were encountered: