From tom@@@k@||ber@ @end|ng |rom gm@||@com  Thu May 11 09:05:59 2023
From: tom@@@k@||ber@ @end|ng |rom gm@||@com (Tomas Kalibera)
Date: Thu, 11 May 2023 09:05:59 +0200
Subject: [Rd] 
 R-4.2.3 build from source on Windows (w Rtools42) - lto1.exe error
In-Reply-To: <000701d983a4$ea7cc160$bf764420$@gmail.com>
References: <000701d983a4$ea7cc160$bf764420$@gmail.com>
Message-ID: <2bc1b922-3fa4-33d2-7ec0-f8c2316280bf@gmail.com>


On 5/11/23 03:07, Gmail wrote:
> Windows 11 PRO Version??10.0.22621 Build 22621
> Processor: Intel(R) Core(TM) i7-1065G7 "Icelake-client"
> ```
> ?svn info	
> Path: .
> Working Copy Root Path: /d/R_DEV/R-4/R42/R-4-2-branch
> URL: https://svn.r-project.org/R/branches/R-4-2-branch
> Relative URL: ^/branches/R-4-2-branch
> Repository Root: https://svn.r-project.org/R
> Repository UUID: 00db46b3-68df-0310-9c12-caf00c1e9a41
> Revision: 84417
> Node Kind: directory
> Schedule: normal
> Last Changed Author: kalibera
> Last Changed Rev: 84249
> Last Changed Date: 2023-04-13 07:12:24 +0000 (Thu, 13 Apr 2023)
> ```
>
> Only adaptation done in MkRules.local was adding: `EOPTS = -march=native`  - that's why I included the cpu-type info above;
> running make all recommended? fails at/with:
> ```
> gcc -shared -s -static-libgcc -o utils.dll tmp.def init.o io.o size.o sock.o stubs.o utils.o hashtab.o windows/dataentry.o windows/dialogs.o windows/registry.o windows/util.o windows/widgets.o ../../../gnuwin32/dllversion.o -lRgraphapp -lversion -L/x86_64-w64-mingw32.static.posix/lib/x64 -llzma -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -L../../../../bin/x64 -lR
>
> lto1.exe: fatal error: bytecode stream in file 'windows/dataentry.o' generated with LTO version 9.3 instead of the expected 9.4
> compilation terminated.
>
> lto-wrapper.exe: fatal error: C:\rtools42\x86_64-w64-mingw32.static.posix\bin\gcc.exe returned 1 exit status
> compilation terminated.
> C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: error: lto-wrapper failed
> collect2.exe: error: ld returned 1 exit status
> cp: cannot stat 'utils.dll': No such file or directory
> make[4]: *** [Makefile.win:36: shlib] Error 1
> make[3]: *** [../../../share/make/basepkg.mk:145: mksrc-win2] Error 1
> make[2]: *** [Makefile.win:24: all] Error 2
> make[1]: *** [Makefile.win:34: R] Error 1
> make: *** [Makefile:18: all] Error 2
> ```
> Any hints/ideas on how to fix this? I guess I could
> gcc -c -flto ... windows/dataentry.c -o windows/dataentry.o
> with the exact path of that fiile ...

All of the object files are generated on your system during the build. 
If dataentry.o is generated using an older version than other object 
files, maybe there is some configuration problem on the system. It might 
be worth checking the compilers and linkers from Rtools42 are used, and 
then running "make distclean", and then trying the build again.

I never tried building R with LTO on Windows myself, I don't know if 
that works even on a system set up according to the documentation for R 
4.2 (https://cran.r-project.org/bin/windows/base/howto-R-4.2.html).

> and it hopefully will fix that but I guess it would make sense to add a Revision to update that LTO version mismatch there, and I don't know yet if this is the only one?

Perhaps it is better to use Rtools43 and R-devel if you can, so that if 
you find some problem in either, it can still be fixed.

> Greetings,
> W

Best,
Tomas

>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] R-4.2.3 build from source on Windows (w Rtools42) - lto1.exe error
Tomas Kalibera