You should be able to replace your call for the linux build with:
    
    
    nim c --cpu:amd64 --os:linux --opt:speed --embedsrc --threads:on 
--checks:on -d:release src/*.nim
    cp src/docker_nim_dev_example $my_pwd/dist/linux.exe
    
    
    Run

(notice the `-c` removal)

Similarly, you can do the same for the windows build but also add in the gcc 
linker/compiler:
    
    
    nim c --cpu:amd64 --os:windows --opt:speed --embedsrc --threads:on 
--checks:on  --gcc.exe:x86_64-w64-mingw32-gcc 
--gcc.linkerexe:x86_64-w64-mingw32-gcc -d:release src/*.nim
    cp src/docker_nim_dev_example.exe $my_pwd/dist/windows.exe
    
    
    Run

However, like I mentioned above, since the Windows build will compile libzip 
from a C file in the nim-lang/zip repo 
([here](https://github.com/nim-lang/zip/blob/master/zip/private/libzip_all.c#L34)),
 you need to compile and link zlib using `x86_64-w64-mingw32-gcc` from 
[here](https://zlib.net/zlib1211.zip).

After you compile it using:
    
    
    PREFIXDIR=/usr/x86_64-w64-mingw32 BINARY_PATH=$PREFIXDIR/bin 
INCLUDE_PATH=$PREFIXDIR/include LIBRARY_PATH=$PREFIXDIR/lib SHARED_MODE=1 
PREFIX=x86_64-w64-mingw32- make -f win32/Makefile.gcc
    
    
    Run

(The above basically tells the Makefile to use everything from the cross 
compiler directory.)

You can then do this:
    
    
    nim c --cpu:amd64 --os:windows --opt:speed --embedsrc --threads:on 
--checks:on  --gcc.exe:x86_64-w64-mingw32-gcc 
--gcc.linkerexe:x86_64-w64-mingw32-gcc -d:release 
--passL:"-L/home/joey/Downloads/zlib1211/zlib-1.2.11/ -lzlib1" 
--passC:"-I/home/joey/Downloads/zlib1211/zlib-1.2.11/" src/*.nim
    cp src/docker_nim_dev_example.exe $my_pwd/dist/windows.exe
    
    
    Run

Reply via email to