MINGW-packages icon indicating copy to clipboard operation
MINGW-packages copied to clipboard

UNC paths now unreadable by GNU binutils (ld)

Open Subsentient opened this issue 1 year ago • 7 comments

I upgraded my MSYS2 toolchain with pacman -Syu after a few months of leaving it alone, since I was afraid of breakage. It appears my fears were well-founded. Since at least 2019, I've been using MSYS2 to build multi-gigabyte repos over UNC paths/mapped network drives. The problem with network drives on Windows is that the applications can see that the mapped drive is a network drive, and GNU binutils is now seeing that Z: is a UNC path, and spitting "invalid argument" when attempting to access some files there, suggesting to me that something is using a Windows API call wrong.

Any help would be appreciated. fk

Subsentient avatar Aug 19 '22 17:08 Subsentient

This package appears to work, though I haven't tested others in the 2.39 series other than the latest. https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-binutils-2.38-4-any.pkg.tar.zst

Subsentient avatar Aug 19 '22 17:08 Subsentient

At a quick glance I'd say one of:

  • https://github.com/bminor/binutils-gdb/commit/cb7da2a640c405e0658c135b3ab2ac5be2fdc53a
  • https://github.com/bminor/binutils-gdb/commit/ba0eb22c8beb1166780d7c7e11ef4e623b8017e9
  • https://github.com/bminor/binutils-gdb/commit/5f3fc928df037b21ee401d7115951b988a3ea571

lb90 avatar Aug 19 '22 19:08 lb90

Also see https://github.com/bminor/binutils-gdb/commits/master/bfd/bfdio.c

lb90 avatar Aug 19 '22 19:08 lb90

Which environment are you compiling the code in ? I am only asking because the msys version of /usr/include/locale.h does not contain the "___lc_codepage_func(void);" definition but the /mingw64/include/locale.h does.

stevenclarke9 avatar Aug 20 '22 08:08 stevenclarke9

It'd be the best if you contacted Binuts developers directly because we don't develop it.

mati865 avatar Aug 20 '22 09:08 mati865

Hi! Open the MSYS2 64bit > MSYS2 MSYS shell and enter the following commands:

  • git clone https://github.com/msys2/MINGW-packages.git
  • cd MINGW-packages/mingw-w64-binutils
  • export MINGW_ARCH=mingw64
  • export PKGEXT=.pkg.tar
  • makepkg-mingw

You should see the following output:

$ makepkg-mingw
==>  MINGW_ARCH: mingw64
  -> Building mingw64...
==> Making package: mingw-w64-binutils 2.39-2
...
  • Note: if you get an error about failed PGP checks:
    ==> Verifying source file signatures with gpg...
        binutils-2.39.tar.xz ... FAILED (unknown public key 13FCEF89DD9E3C4F)
    ==> ERROR: One or more PGP signatures could not be verified!
    
    Simply add the --skippgpcheck argument: makepkg-mingw --skippgpcheck

From there on, you can make any modification you want to the source code located in MINGW-packages/mingw-w64-binutils/src/binutils-2.39, then just build a new package with the following command:

  • makepkg-mingw -f --noextract --install

Refer to https://man.archlinux.org/man/makepkg.8.en for more informations

lb90 avatar Aug 20 '22 10:08 lb90

not related but since this is about binutils heres a patch adding reproducible libraries to dlltool, taken from upstream and considered in testing but seems to work fine. pr29489.zip

revelator avatar Aug 21 '22 11:08 revelator

@revelator could you open a PR for the reproducible builds patch?

lb90 avatar Oct 31 '22 13:10 lb90

not home atm. but ill see what i can do.

revelator avatar Oct 31 '22 13:10 revelator

Thanks! 😃 Anyway no rush, whenever you feel like!

lb90 avatar Oct 31 '22 13:10 lb90

if in a hurry to try it out then the maintainer for the package can just add it at the end of the other patches for binutils :) been using it myself for several months and it works fine for my part (using it with python mostly since that package seems to use dlltool extensivly and no problems so far).

revelator avatar Nov 01 '22 13:11 revelator

mingw-w64-binutils.zip

added the patch and upped the build number, may have to update the checksums cant remember if i did that beforehand. dlltool defaults to deterministic when binutils are build with --enable-deterministic-archives so it should be on by default. built all python packages using this and no problems so far.

revelator avatar Nov 14 '22 18:11 revelator