No, there is no guide. I build the Windows release files on Linux using MinGW. See the script: tools/make-windows-release.
You may be able to build wimlib on Windows in a Cygwin environment with MinGW. Configure with: ./configure --host=i686-w64-mingw32. You must be able to satisfy the 3rd party library dependencies (libxml2, iconv, and winpthreads). For the actual release I now build these other libraries myself and statically link them into libwim.dll, but you don't have to do it that way.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It looks like the configure script didn't correctly detect the platform as MinGW, so the build isn't using the right compiler flags. What arguments did you pass to configure?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, it was necessary to pass --host=i686-w64-mingw32 to correctly enable the compiler.
But now link pass fails with this error:
src/.libs/libwim_la-timestamp.o: In function wim_timestamp_to_str':
C:\msys32\home\maxpat78\wimlib-1.8.0/src/timestamp.c:129: undefined reference togmtime_r'
collect2.exe: error: ld returned 1 exit status
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
gmtime_r() is not available natively on Windows, so I've been relying on MinGW to provide it. On my Linux system the time.h header provided by MinGW has this:
You said you are using MinGW as well, so you should figure out why this declaration doesn't seem to exist for you. Alternatively you could replace gmtime_r() with the Windows-specific gmtime_s() (which has flipped arguments). Note that there may be other functions with the same problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Funnily enough, I actually encountered this same problem on Linux after an upgrade of MinGW. I'll probably change configure.ac to set _POSIX_THREAD_SAFE_FUNCTIONS in the Windows-specific build flags.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks to your work, I compile it successfully on linux.
But it's very difficult to compile on windows.
I compile it with mingw(in cygwin, i686-pc-mingw32-gcc.exe),first the libxml2,then the libiconv,and then the wimlib.
But it reports a lot of errors,and it doesn't compile the files (win32_apply.c and etc)
So, is there any guide to compile wimlib on windows os?
No, there is no guide. I build the Windows release files on Linux using MinGW. See the script:
tools/make-windows-release
.You may be able to build wimlib on Windows in a Cygwin environment with MinGW. Configure with:
./configure --host=i686-w64-mingw32
. You must be able to satisfy the 3rd party library dependencies (libxml2, iconv, and winpthreads). For the actual release I now build these other libraries myself and statically link them into libwim.dll, but you don't have to do it that way....I tried with MSYS2 and mingw64 (gcc 4.9.2), but it stopped with the following error:
It looks like the configure script didn't correctly detect the platform as MinGW, so the build isn't using the right compiler flags. What arguments did you pass to
configure
?./configure --without-ntfs-3g
(it detects build & host as "i686-pc-msys")
Ok, it was necessary to pass --host=i686-w64-mingw32 to correctly enable the compiler.
But now link pass fails with this error:
src/.libs/libwim_la-timestamp.o: In function
wim_timestamp_to_str': C:\msys32\home\maxpat78\wimlib-1.8.0/src/timestamp.c:129: undefined reference to
gmtime_r'collect2.exe: error: ld returned 1 exit status
Hi,
gmtime_r() is not available natively on Windows, so I've been relying on MinGW to provide it. On my Linux system the time.h header provided by MinGW has this:
You said you are using MinGW as well, so you should figure out why this declaration doesn't seem to exist for you. Alternatively you could replace gmtime_r() with the Windows-specific gmtime_s() (which has flipped arguments). Note that there may be other functions with the same problem.
Thanks.
In my time.h (MSYS2+mingw64), gmtime_r gets defined only when _POSIX_THREAD_SAFE_FUNCTIONS is defined.
So I've manually set -D_POSIX_THREAD_SAFE_FUNCTIONS in Makefile for targets timestamp.c and imagex.c
Now the link pass succeeds, and the resulting executable seems to work fine.
Funnily enough, I actually encountered this same problem on Linux after an upgrade of MinGW. I'll probably change configure.ac to set _POSIX_THREAD_SAFE_FUNCTIONS in the Windows-specific build flags.
P.S.
Starting the MSYS2 console with mingw32_shell.bat instead of msys2_shell.bat, the --host= switch isn't anymore required with the configure script.
Thank you, I'll have a try.