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

Regression related to zlib1.rc in the mingw build. #1038

Open
eukarpov opened this issue Feb 1, 2025 · 17 comments
Open

Regression related to zlib1.rc in the mingw build. #1038

eukarpov opened this issue Feb 1, 2025 · 17 comments

Comments

@eukarpov
Copy link

eukarpov commented Feb 1, 2025

aarch64-w64-mingw32-windres -O coff -DNO_FSEEKO -DZLIB_DLL -D_LARGEFILE64_SOURCE=1 -I /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/build/zlib -I /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/code/zlib /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/code/zlib/win32/zlib1.rc CMakeFiles/zlib.dir/win32/zlib1.rc.res

aarch64-w64-mingw32-windres: /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/code/zlib/win32/zlib1.rc:7: syntax error

more information here
https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/13085470592/job/36517132074

This change might be the reason of the regression.
1af1bb6

@madler
Copy link
Owner

madler commented Feb 1, 2025

@Vollstrecker ?

@eukarpov
Copy link
Author

eukarpov commented Feb 1, 2025

and MinGW and Cygwin testing has been disabled here.
fd00a94

@Vollstrecker
Copy link

And reenabled here: 7667ca5

The mentioned commit adds the rc-file on win32 platforms which (I guess) is correct for mingw also on arm, so I think this is correct. I don't know enough about win to judge if it's really needed. My first guess would be, that on arm maybe windres produces others files than .obj, so an additional check would be needed, or cmake itself detects the output wrong.

For me this looks like the second, but it doesn't seem like there was an issue created that got fixed. I'm back home on wednesday where I have access to a machine with mingw (no arm). Will this work with -DGCC_WINDRES or is something else needed? If so, I could try to replicate the test from the link.

@eukarpov
Copy link
Author

eukarpov commented Feb 2, 2025

Before regression:
aarch64-w64-mingw32-windres -D GCC_WINDRES -I /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/code/zlib -I /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/build/zlib -o /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/build/zlib/zlib1rc.obj -i /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/code/zlib/win32/zlib1.rc

Current changes:
aarch64-w64-mingw32-windres -O coff -DNO_FSEEKO -DZLIB_DLL -D_LARGEFILE64_SOURCE=1 -I /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/build/zlib -I /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/code/zlib /home/runner/work/mingw-woarm64-build/mingw-woarm64-build/code/zlib/win32/zlib1.rc CMakeFiles/zlib.dir/win32/zlib1.rc.res

@eukarpov
Copy link
Author

eukarpov commented Feb 2, 2025

The regression is detected starting with this change
1af1bb6

It looks like CMAKE cannot handle it, at least for aarch64 and custom command is needed.

@Vollstrecker
Copy link

You mean like the link I posted that said cmake doesn't detect this correct is right?

I have to check if the difference is really needed or if we can just delete the #ifdef in the rc-file (and the whole -DGCC_WINRES stuff). If not I guess just reading the rc_compiler name and reacting on that instead of the misdetected .obj extension should be sufficient. Or maybe turn it around and check for the extension MSVC produces as this seems to work and check for that (or better NOT that) to set the define.

This or the other way, everything is easy doable without any custom_command overhead, but not before wednesday.

@eukarpov
Copy link
Author

eukarpov commented Feb 2, 2025

It looks like the link provided earlier is a good lead. It was a confirmation that before 1af1bb6 aarch64-w64-mingw32 build was fine.
Switching to master branch is enough for now to validate aarch64-w64-mingw32 build.

It will be great if zlib CI can be extended with aarc64-w64-mingw build. Please let me know if you need help with that.

@vszakats
Copy link

vszakats commented Feb 2, 2025

Earlier fix proposal:

if(MINGW)
    set_source_files_properties(win32/zlib1.rc PROPERTIES COMPILE_FLAGS "-DGCC_WINDRES")
endif()

(edit: Custom .rc files aren't expected on Cygwin, though the rest of the script enables it for this platform, so maybe this line should also be enabled for it.)

Though to repeat, the !GCC_WINDRES-guarded logic is Windows 16-bit-specific (Windows 3.11 and earlier), and even there, optional.

Refs:
cmake-remake@cda3a46
#677

@Neustradamus
Copy link

Hope a perfect solution for it!

@Vollstrecker
Copy link

set_source_files_properties(win32/zlib1.rc PROPERTIES
COMPILE_FLAGS $<$BOOL:${MINGW}:-DGCC_WINDRES>)

Does the same with less commands.

#677 suggests to just not make any difference which would make the whole line obsolete.

@vszakats
Copy link

vszakats commented Feb 3, 2025

The line is necessary unless the obsolete !GCC_WINDRES logic is deleted from zlib1.rc. IMO the best would be to delete all this legacy baggage.

petrutlucian94 added a commit to petrutlucian94/ceph that referenced this issue Feb 3, 2025
The zlib Windows build started to fail, probably because of this:
madler/zlib#1038

  Cloning into 'zlib'...
  make: *** No rule to make target 'zconf.h', needed by 'adler32.o'.

We'll pin the zlib version for now to unblock the Windows build.
petrutlucian94 added a commit to petrutlucian94/ceph that referenced this issue Feb 3, 2025
The zlib Windows build started to fail, probably because of this:
madler/zlib#1038

  Cloning into 'zlib'...
  make: *** No rule to make target 'zconf.h', needed by 'adler32.o'.

We'll pin the zlib version for now to unblock the Windows build.

Signed-off-by: Lucian Petrut <[email protected]>
idryomov pushed a commit to idryomov/ceph that referenced this issue Feb 3, 2025
The zlib Windows build started to fail, probably because of this:
madler/zlib#1038

  Cloning into 'zlib'...
  make: *** No rule to make target 'zconf.h', needed by 'adler32.o'.

We'll pin the zlib version for now to unblock the Windows build.

Signed-off-by: Lucian Petrut <[email protected]>
(cherry picked from commit ba9270d)
idryomov pushed a commit to idryomov/ceph that referenced this issue Feb 3, 2025
The zlib Windows build started to fail, probably because of this:
madler/zlib#1038

  Cloning into 'zlib'...
  make: *** No rule to make target 'zconf.h', needed by 'adler32.o'.

We'll pin the zlib version for now to unblock the Windows build.

Signed-off-by: Lucian Petrut <[email protected]>
(cherry picked from commit ba9270d)
@Vollstrecker
Copy link

Then I would suggest you just remove line and remove the cruft that causes it. At least if @madler is fine with it.

But I have to admit, it's always fascinating to see how much movement comes after such a change compared to how many people cared in the four weeks this change was in the making.

@vszakats
Copy link

vszakats commented Feb 3, 2025

Then I would suggest you just remove line and remove the cruft that causes it. At least if @madler is fine with it.

Tried that. Got no feedback from @madler for 2.5 years.

This is besides the point. This issue (broken mingw-builds) is fixed by the change suggested above, either your one-liner, or the other.

But I have to admit, it's always fascinating to see how much movement comes after such a change compared to how many people cared in the four weeks this change was in the making.

I submitted this patch as a PR early to your fork. You rejected abruptly saying it was a work-in-progress. Now it's too late?

@madler
Copy link
Owner

madler commented Feb 4, 2025

Tried that. Got no feedback from @madler for 2.5 years.

The feedback was in other threads, which was that there was a huge number of cmake pull requests that I had no ability to evaluate or almagamate. I was looking for someone to take a unified approach to a massive update of cmake for zlib. @Vollstrecker stepped up and did that.

@madler
Copy link
Owner

madler commented Feb 4, 2025

Then I would suggest you just remove line and remove the cruft that causes it. At least if @madler is fine with it.

I'm fine with whatever there is agreement on here. I don't know enough to evaluate it myself.

@vszakats
Copy link

vszakats commented Feb 4, 2025

@madler Thank for jumping in, and no worries.

If optimizing these resource bytes for Windows 3.x isn't of any explicit importance for you, these legacy flags can be safely deleted, along with all GCC_WINDRES mentions.

These two patch need to be applied for this:

  1. 0a45f55
    The CMakeLists.txt hunk has to be adapted to recent changes. It's a couple of lines.
  2. 454869f

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

5 participants