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

Not compiling on windows #49

Open
Milerius opened this issue Dec 18, 2019 · 3 comments
Open

Not compiling on windows #49

Milerius opened this issue Dec 18, 2019 · 3 comments

Comments

@Milerius
Copy link

Milerius commented Dec 18, 2019

Hello, this package doesn't seem's to compile on Windows:

CC: libzip_all
Error: execution of an external compiler program 'clang.exe -c  -w -DWIN32_LEAN_AND_MEAN -IC:\Users\roman\Documents\vcpkg/installed/x64-windows/include  -IC:\Users\roman\Desktop\nim-1.0.4\lib -IC:\Users\roman\CLionProjects\atomicDEX-QT\atomic_dex_desktop\tools -o C:\Users\roman\nimcache\dependencies_d\libzip_all.c.o C:\Users\roman\.nimble\pkgs\zip-0.2.1\zip\private\libzip_all.c' failed with exit code: 1

C:\Users\roman\.nimble\pkgs\zip-0.2.1\zip\private\libzip_all.c:193:17: error: function cannot return function type 'int (void *, void *, size_t, enum zip_source_cmd)' (aka 'int (void *, void *, unsigned long long, enum zip_source_cmd)')
typedef ssize_t (*zip_source_callback)(void *state, void *data,
                ^
C:\Users\roman\.nimble\pkgs\zip-0.2.1\zip\private\libzip_all.c:226:29: error: function cannot return function type 'ssize_t' (aka 'int (int *)')
ZIP_EXTERN ssize_t zip_fread(struct zip_file *, void *, size_t);
                            ^
C:\Users\roman\.nimble\pkgs\zip-0.2.1\zip\private\libzip_all.c:505:5: error: unknown type name 'zip_source_callback'
    zip_source_callback f;
    ^
C:\Users\roman\.nimble\pkgs\zip-0.2.1\zip\private\libzip_all.c:719:9: error: use of undeclared identifier 'pid_t'
        pid_t pid;
        ^
C:\Users\roman\.nimble\pkgs\zip-0.2.1\zip\private\libzip_all.c:727:9: error: use of undeclared identifier 'pid'
        pid = getpid();

Compiler: clang-9
Nim Compiler: 1.0.4
Windows 10.

Usage:

when defined(windows):
    {.passC: "-I"  & os.getEnv("VCPKG_ROOT") & "/installed/x64-windows/include"}
    {.passL: "-L"  & os.getEnv("VCPKG_ROOT") & "/installed/x64-windows-static/lib -lzlib -lz"}
import zip/zipfiles
@bubthegreat
Copy link

It looks like the package assumes that you have zlib1.dll in your path already. For linux, this is true, but for windows this is only the case if you've installed and configured vscode or something similar already. For a bare install of windows you'll have to download the dll from somewhere (I used vcpkg) and make sure it's added to your path.

It seems more reasonable to include the dll, so, etc files in the nim package and then choose which one to use based on OS, rather than assuming that the OS has it installed.

@matkuki
Copy link

matkuki commented Mar 12, 2020

I have a different problem:

C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x117): undefined reference to `zError'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x2dcb): undefined reference to `crc32'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x2e71): undefined reference to `deflateInit2_'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x2f1c): undefined reference to `deflateEnd'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x2f8a): undefined reference to `crc32'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x2fb4): undefined reference to `deflate'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x30bc): undefined reference to `deflateEnd'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x3997): undefined reference to `zError'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x3a4a): undefined reference to `inflateEnd'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x3ba9): undefined reference to `crc32'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x3c9d): undefined reference to `crc32'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x4251): undefined reference to `inflateInit2_'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x453f): undefined reference to `crc32'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x6cfe): undefined reference to `crc32'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x6d69): undefined reference to `inflate'
C:\...\nim_builder_d\libzip_all.c.o:libzip_all.c:(.text+0x6df5): undefined reference to `crc32'

Any ideas what's missing?

@pietroppeter
Copy link

pietroppeter commented Nov 17, 2020

I also have the same issue as @matkuki. This is compiling a file with only the line: import zip/zipfiles on windows 10, nim 1.4, gcc 8.1.0 (also tried to nimble install zip@#head).

edit: the fix in #33 works for me on windows. Unfortunately that is a closed issue and less visible.

I think all info is there for a new PR that incorporates #38 and also fixes this issue with windows. It probably could be good to add CI (zip does not seem to be in important packages). I will try to come up with a PR. Incidentally I also noticed that some of the readme examples are broken (some discard are missing, I guess they were taken from test files removing check and require...), I could probably fix that too.

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

4 participants