vasi / pixz

Parallel, indexed xz compressor
BSD 2-Clause "Simplified" License
712 stars 61 forks source link

msys2 build failure #111

Closed AireagoirSteam closed 10 months ago

AireagoirSteam commented 11 months ago

tried to build on MSYS2/MinGW-w64 and it errors out not sure why but was wondering if it would be possable to make this compatable with msys2. heres the error message.

Thank you for any time taken on this log.txt

vasi commented 11 months ago

Thanks for the report! Can you share some more info about your build?

AireagoirSteam commented 11 months ago

heres a file with e commands I ran and the msys2 version I have and the contents of config.h. also the version of pixz used is the current master. msy2 version.txt

AireagoirSteam commented 11 months ago

also my make output make-output.txt

vasi commented 11 months ago

Do you know what msys2 environment you're using to build pixz?

vasi commented 11 months ago

I tried using the UCRT64 environment, and what seems like the obvious packages: autoconf automake libtool make gcc pkgconf liblzma-devel libarchive-devel openssl-devel asciidoc. It builds fine! This is on Windows 10, with msys2-runtime 3.4.9-3. Checks mostly pass--there's no cppcheck package so that's skipped, and msys2 has no working chmod, so the permissions test fails.

Specifically relevant to this issue, sysconf() seems to exist in /usr/include/unistd.h.

I imagine you must be in some different environment, or using a different gcc, and so your includes are different.

AireagoirSteam commented 11 months ago

which gcc did you install? also found a package for cppcheck for ucrt64

AireagoirSteam commented 11 months ago

just added all packages you mentioned and started a ucrt enviroment up and no joy

vasi commented 11 months ago

Can you share the output of pacman -Qe? This is what I get:

asciidoc 10.2.0-3
autoconf-wrapper 20221207-1
automake-wrapper 20221207-1
base 2022.06-1
filesystem 2023.02.07-1
gcc 13.2.0-2
git 2.43.0-1
libarchive-devel 3.7.2-1
liblzma-devel 5.4.5-1
make 4.4.1-1
mingw-w64-ucrt-x86_64-cppcheck 2.12.1-1
msys2-runtime 3.4.9-3
openssl-devel 3.1.4-1
pkgconf 2.1.0-1
vasi commented 11 months ago

Also, can you check if you have sysconf in unistd? Run grep sysconf /usr/include/unistd.h

AireagoirSteam commented 11 months ago

man-db 2.11.2-1 mingw-w64-ucrt-x86_64-asciidoc 10.2.0-3 mingw-w64-ucrt-x86_64-cppcheck 2.12.1-1 mingw-w64-ucrt-x86_64-gcc 13.2.0-2 mingw-w64-ucrt-x86_64-gcc-objc 13.2.0-2 mingw-w64-ucrt-x86_64-libarchive 3.7.2-1 mingw-w64-ucrt-x86_64-libtool 2.4.7-2 mingw-w64-ucrt-x86_64-make 4.4-2 mingw-w64-ucrt-x86_64-pkgconf 1~2.1.0-1 mingw-w64-x86_64-aria2 1.37.0-1 mingw-w64-x86_64-asciidoc 10.2.0-3 mingw-w64-x86_64-autotools 2023.09.28-1 mingw-w64-x86_64-binutils 2.41-2 mingw-w64-x86_64-ca-certificates 20230311-1 mingw-w64-x86_64-check 0.15.2-2 mingw-w64-x86_64-gcc 13.2.0-2 mingw-w64-x86_64-gcc-ada 13.2.0-2 mingw-w64-x86_64-gcc-fortran 13.2.0-2 mingw-w64-x86_64-gcc-libgfortran 13.2.0-2 mingw-w64-x86_64-gcc-objc 13.2.0-2 mingw-w64-x86_64-gdb 13.2-3 mingw-w64-x86_64-gdb-multiarch 13.2-3 mingw-w64-x86_64-kate 23.08.3-1 mingw-w64-x86_64-libarchive 3.7.2-1 mingw-w64-x86_64-libgccjit 13.2.0-2 mingw-w64-x86_64-libmangle-git 11.0.0.r404.g3a137bd87-1 mingw-w64-x86_64-libwinpthread-git 11.0.0.r404.g3a137bd87-1 mingw-w64-x86_64-make 4.4-2 mingw-w64-x86_64-pkgconf 1~2.1.0-1 mingw-w64-x86_64-pyqt5-sip 12.13.0-1 mingw-w64-x86_64-python-aiohttp 3.9.0-1 mingw-w64-x86_64-python-colorama 0.4.6-2 mingw-w64-x86_64-python-imageio 2.33.0-1 mingw-w64-x86_64-python-lxml 4.9.3-1 mingw-w64-x86_64-python-pip 23.3.1-1 mingw-w64-x86_64-python-pip-tools 7.3.0-1 mingw-w64-x86_64-python-progress 1.6-3 mingw-w64-x86_64-python-pycryptodome 3.19.0-1 mingw-w64-x86_64-python-pyqt5 5.15.10-1 mingw-w64-x86_64-python-requests 2.31.0-2 mingw-w64-x86_64-python-virtualenv 20.24.6-1 mingw-w64-x86_64-python-wrapt 1.15.0-2 mingw-w64-x86_64-python-yaml 6.0.1-1 mingw-w64-x86_64-python-yarl 1.9.2-3 mingw-w64-x86_64-sip 6.7.12-1 mingw-w64-x86_64-tools-git 11.0.0.r404.g3a137bd87-1 mingw-w64-x86_64-wget2 2.1.0-1 mingw-w64-x86_64-winpthreads-git 11.0.0.r404.g3a137bd87-1 mingw-w64-x86_64-winpty 0.4.3-2 mingw-w64-x86_64-winstorecompat-git 11.0.0.r404.g3a137bd87-1 msys2-runtime 3.4.9-3 openssl-devel 3.1.4-1 parallel 20231022-1 python 3.11.6-1 vim 9.0.2121-1 winpty 0.4.3-1

nothing shows up for sysconf

vasi commented 11 months ago

Here's a PR that ought to work: https://github.com/vasi/pixz/pull/112 . Passes tests (mostly), but there could easily be hidden breakages somewhere, Windows is weird.

I hope this was worth to you the several hours I spent on it!

AireagoirSteam commented 11 months ago

Here's a PR that ought to work: #112 . Passes tests (mostly), but there could easily be hidden breakages somewhere, Windows is weird.

I hope this was worth to you the several hours I spent on it!

Seems to build also thank you so much for the work and effort.

The only minor niggle is I don't get the help read out when only type pixz and get a werid output.

$ pixz ²7zXZ☺i"Ì6

Seems to work otherwise.

vasi commented 11 months ago

Oh weird, windows' isatty() function does weird things. Should be fixed now in that branch.

Btw, I'm curious what your use case is for building against winapi, and not against cygwin (aka the plain 'gcc' package in msys2).

AireagoirSteam commented 11 months ago

I hadn't tried it with cygwin yet since I think you can have issues if install cygwin and msys2 installed together.

I can gove it a go with cygwin also to be honest just thought msys2 might have built easier since think I tried like 2 months back with cyvwin. I'll try building with cygwin.

Also how would I build with the defences included in the exe static build think that is?

vasi commented 11 months ago

Oh sorry, I was unclear. I don't mean installing the "cygwin distribution" alongside msys2. What I was referring to is that msys2 has two kinds of packages in it:

  1. Mingw-based: Packages that link against the Windows APIs, and can't use POSIX (Unix-like) APIs. These packages have names like mingw-w64-x86_64-curl. You can build Windows API-ish code like this with compiler packages like mingw-w64-ucrt-x86_64-gcc.
  2. Cygwin-based: Packages that link against the cygwin POSIX-compatibility layer, which in msys2 is named msys-2.0.dll. These packages have unprefixed names, like just curl. You can build POSIX-ish code like this with the compiler package just named gcc.

You have always been able to just install plain old gcc in msys2 and build a type-2 pixz without Windows-specific fixes being necessary. Of course, you'd also need dependencies that use the POSIX-compatibility layer and have unprefixed names, like libarchive-devel.

The changes I made in the linked PR are only helpful if you really must use the Win API libraries from msys2 (type 1), rather than the POSIX ones (type 2). So I was trying to ask whether it's important to you to specifically use a type-1 pixz, and why.

It sounds like maybe you're trying to build a static library that runs on other users' systems, without needing msys2.dll? That's a cool use case, is it working with my patch?

AireagoirSteam commented 11 months ago

I tried with mingwx64 before in ucrt it worked with patch but then that weid emoji stuff haven't cloned the repo again yet to test current stuff.

So should I try building in plain msys2?

AireagoirSteam commented 11 months ago

Also reason for a static buold just saves me copying all the dlls to the folder as the exe which can be tedious.

vasi commented 10 months ago

I merged the PR, including a fix to the tty-detection code (so your "weird emoji" issue should be gone now. Feel free to build from master in either mingw or msys2. I'll be closing the issue, but do go ahead and comment if anything else looks broken.