Closed truedat101 closed 5 years ago
Related to #56 .
I'm getting this error when running dub test
:
Error: Got .copyFiles-windows-x86 of type array, expected string.
From what directory? And what is the exact command?
From shelld/prototype
I use dub test
What platform? What compiler?
This specific issue is related to building on libkeccak on windows. The error you are pointing out is related to the prototype project build.
Yes, just the prototype. I'm using Debian and ldc2
Hmm, let me try to build on linux. Shouldn't have this error. Is this your first time trying to build on linux in a few months?
I've either been using windows or Mac.
Interesting, but I found this version here has been modified in a similar manner (for NIM, and compiles without error). It looks like they've included some macros in the .c file.
https://github.com/status-im/nim-keccak-tiny/tree/fix-c99-ci/keccak-tiny
Examine why this one works, see if I can just swap it out.
Right, will check this out and see if I can give some insight
Anyway, won't affect you since yours builds.
More helper stuff:
http://www.mingw.org/wiki/sampleDLL http://cygutils.fruitbat.org/dll-stuff/index.html
Anyway, I think I've got it figured out for windows.
Ok, got what looks like working code here: https://github.com/IoTone/nim-keccak-tiny. Note, this is a nem version wrapper around the library. We don't need the NEM portion, just the fork with a few tweaks. If this is all working ok, I'll probably merge the code changes from nim-keccak-tiny to the original keccak-tiny fork that I have.
I added a fix for checking the platform and choosing the right-ish shared object extension.
Just need to fix the dll loading stuff in the libkeccak-d dub.json. Sigh.
I notice using clang with the do.sh defaults, it fails. Fix that later.
So the windows builds, but I can't link successfully. I need to go back and work through the library generation.
I'm being honest here, I feel like nimlang is way more amazing than D.
Here's an example: https://nim-lang.org/docs/backends.html
There is a silly little compiler directive inside of nim code:
{.compile: "keccak_tiny/keccak-tiny.c".}
This is unbelievably special. It's a little macro expansion or pragma thing. It runs this:
gcc -c keccak-tiny.c ar rvs libkeccak-tiny.lib keccak-tiny.o
That by itself is the simple elegance of Nim. Did I have to build the library? No. Did it build by itself? Yes. Does that work for more complex scenarios like an open-cv or something? No, probably not. But still, wow.
And I've verified my output is good:
All unit tests have been run successfully.
I'm converting the library libkeccak-d to be classified as a library.
I've gotta sleep now, but will finish this off tomorrow. Steps left:
If this fix works, it should also knock out #66 .
Fixed by 5f4f5730717f0038c7a650748f316c25c4c7a358
We forked keccak-tiny, and have it here https://github.com/IoTone/keccak-tiny I need to ensure this builds on windows. The simple do.sh file doesn't properly address the question of what kind of library to produce and assumes it's either a mac or linux. So it produces a .dylib or a .so.
Second problem is that what it produces is odd: libkeccak-tiny.lib: PE32+ executable (DLL) (console) x86-64, for MS Windows
Third problem is it is named wrong. Windows is looking for keccak-tiny.lib, not libkeccak-tiny.lib. Deal with this later.
Also read: http://www.mingw.org/wiki/sampleDLL
https://forums.ni.com/t5/LabVIEW/create-a-dll-for-windows-with-gcc/td-p/332736
https://wiki.dlang.org/Win32_DLLs_in_D