You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my Windows environment, zipfiles.nim does not work at all.
Situation
When execute nim compiling, compiler shows messages that compiling libzip_all.c is failed.
It seems that zlib.h is not linked.
Sample source code is following as:
import zip/zipfiles
proc main() =
var fpZip: ZipArchive
defer: fpZip.close()
discard fpZip.open(r"C:\Users\puruneko\archive.zip")
for path in fpZip.walkFiles:
echo path
when isMainModule:
main()
Example message of compiling is folloing as:
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x112): undefined reference to `zError'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x2be0): undefined reference to `crc32'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x2c86): undefined reference to `deflateInit2_'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x2d35): undefined reference to `deflateEnd'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x2da4): undefined reference to `crc32'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x2dce): undefined reference to `deflate'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x2ed6): undefined reference to `deflateEnd'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x37ad): undefined reference to `zError'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x3860): undefined reference to `inflateEnd'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x39bc): undefined reference to `crc32'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x3ab1): undefined reference to `crc32'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x3fff): undefined reference to `inflateInit2_'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x42ec): undefined reference to `crc32'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x69c7): undefined reference to `crc32'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x6a32): undefined reference to `inflate'
C:\Users\puruneko\nimcache\sample_d\libzip_all.c.o:libzip_all.c:(.text+0x6abd): undefined reference to `crc32'
Temporary solution
Compiling only libzip_all.c can succeed. (gcc -shared libzip_all.c -o libzip_all.dll -lz)
It seems that libzip_all.c is correct because of the above, so I checked libzip.nim.
Then, places that seems suspicious were found in the upper when blocks:
when defined(unix) and not defined(useLibzipSrc):
when defined(macosx):
{.pragma: mydll, dynlib: "libzip(|2|4).dylib".}
else:
{.pragma: mydll, dynlib: "libzip(|2).so(|.4|.2|.1|.0)".}
else:
when defined(unix):
{.passl: "-lz".}
{.compile: "zip/private/libzip_all.c".}
{.pragma: mydll.}
In the above code, when the case of windows machine, it seems that libzip_all.c is compiled without -lz option.
So, I changed codes following as:
Problem
On my Windows environment,
zipfiles.nim
does not work at all.Situation
When execute nim compiling, compiler shows messages that compiling
libzip_all.c
is failed.It seems that
zlib.h
is not linked.Sample source code is following as:
Example message of compiling is folloing as:
Temporary solution
Compiling only
libzip_all.c
can succeed. (gcc -shared libzip_all.c -o libzip_all.dll -lz
)It seems that
libzip_all.c
is correct because of the above, so I checkedlibzip.nim
.Then, places that seems suspicious were found in the upper
when
blocks:In the above code, when the case of windows machine, it seems that
libzip_all.c
is compiled without-lz
option.So, I changed codes following as:
It startrd to move for now...
But, is this a correct solution?
Postscripts
Please pardon my poor English.
The text was updated successfully, but these errors were encountered: