2

I'm trying to compile R devel by this advice:

Build R with OpenBLAS

I use MSYS2 (Rtools 4.3), but now have strange error:

-------- Building ../../../bin/x64/Rblas.dll --------
gcc  -s -shared  -o ../../../bin/x64/Rblas.dll blas00.o ../../gnuwin32/dllversion.o Rblas.def \
   -L../../../bin/x64 -lR  -L""/c/Repository/AMD/WinLibs"" -fopenmp -lamdblas
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: internal error: aborting at ../../binutils-2.40/ld/ldlang.c:527 in compare_section
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: please report this bug
collect2.exe: error: ld returned 1 exit status
make[4]: *** [Makefile.win:14: ../../../bin/x64/Rblas.dll] Error 1
make[3]: *** [Makefile:236: Rblas] Error 2
make[2]: *** [Makefile:115: rbuild] Error 2
make[1]: *** [Makefile:17: all] Error 2
make: *** [Makefile:399: distribution] Error 2

I did just only one change in Makefile.win as described at link above:

-   -L../../../$(IMPDIR) -lR  -L"$(ATLAS_PATH)" -lf77blas -latlas
+   -L../../../$(IMPDIR) -lR  -L"$(ATLAS_PATH)" -fopenmp -lamdblas 

(with -lamdblas -lamdlapack instead of -lamdblas the problem is still existing). libamdblas, libamdlapack are just renamed versions of amd-blis and amd-libfire libraries from AOCL.

I found the same problem described earlier:

https://github.com/msys2/MINGW-packages/issues/15469

But I see that It can be fixed only with downgrading binutils to 2.39 or upgrade to 2.40-2. Unfortunately, I haven't found ways to do this on MSYS2 under Windows.

Could anyone help me, please?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Dmitriy
  • 847
  • 17
  • 39

1 Answers1

1

The root cause of the ld issue is explained in Bug 30079 - Mingw ld : linking against an import lib causes ld to abort() at compare_section in ldlang.c

But the crux of your question is: "how to downgrade/upgrade binutils in Msys2?".

That would be done with MSys2 package management

To downgrade binutils to version 2.39 or upgrade to version 2.40-2 with MSYS2 on Windows 11, you will need to use the pacman package manager.

Find the specific version of the binutils package that you want to install.

pacman -Ss binutils

This command will display a list of available binutils packages.

Then install it (with its dependencies) using:

pacman -S <name of the package>
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you, your answer fully correct, but unfortunatelly, the problem is deeper than installed binutils via pacman - I installed 2.39-2, but got the same problem with make distribution. I think It's connected with an installation package of RTools+R. – Dmitriy Jul 02 '23 at 16:11
  • @Dmitriy OK. Maybe some PATH conflict then? – VonC Jul 02 '23 at 16:32
  • I'll try to investigate. It's not so easy, because I still have no idea how to check structure of `rtools43-toolchain-libs-full-5550.tar.zst` (I suppose that binutils files are located at this "location". – Dmitriy Jul 03 '23 at 06:02