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

On Windows, default rust needs to be gnu, not msvc #19

Closed
clauswilke opened this issue Jan 11, 2021 · 57 comments · Fixed by #20
Closed

On Windows, default rust needs to be gnu, not msvc #19

clauswilke opened this issue Jan 11, 2021 · 57 comments · Fixed by #20

Comments

@clauswilke
Copy link
Member

Apparently, under some circumstances, the default Rust on Windows needs to be gnu, not msvc.

See:
#15 (comment)
and
#7 (comment)

Is there any way to remove this requirement?

cc @Ilia-Kosenkov @CGMossa @yutannihilation

@clauswilke
Copy link
Member Author

clauswilke commented Jan 11, 2021

This is particularly frustrating since building an R package with extendr on Windows requires msvc to be the default toolchain. I would prefer to be able to tell people to always make msvc the default.

@CGMossa
Copy link
Member

CGMossa commented Jan 11, 2021

I can offer this workaround, that I think is fairly okay to use..

rustup run stable-gnu cargo build

Even if the default is nightly-msvc, it would run this under that toolchain and host.

Although, I'm not sure rustup is on linux/mac.

Loosely, the build commands would then be like

#...
  status <- system2(
    command = "rustup",
    args = c(
      "run",
      "stable-gnu",
      "cargo",
      "build",
...

@yutannihilation
Copy link
Contributor

@CGMossa
Could you share the error message you got when you run it with msvc default? I'm curious about the cause, though I'm not sure if it's what we can fix or not.

@CGMossa
Copy link
Member

CGMossa commented Jan 11, 2021

I did share it, see the link that Claus posted, or here:

error[E0463]: can't find crate for `std`                       
  |
  = note: the `x86_64-pc-windows-gnu` target may not be installed

While I'm at it: Using cargo +stable-gnu build does not work, as I think you can only write few things in cargo +<here>.

@yutannihilation
Copy link
Contributor

Oh, I see. Sorry. I thought you got some different error after you added the target. Hmm...

@clauswilke
Copy link
Member Author

Before implementing some workaround I'd like to understand what the issue is. We're just calling cargo build on a regular Rust crate, I don't understand why this would be a problem. We're doing this exact same thing when building R packages or extendr standalone binaries and we don't have errors there.

@CGMossa
Copy link
Member

CGMossa commented Jan 11, 2021

Ok.

I added rustup target add x86_64-pc-windows-gnu and somehow that added it to stable-msvc. This made
a new error appear:

error: linker `x86_64-w64-mingw32-gcc` not found
  |
  = note: The system cannot find the file specified. (os error 2)

Then I added gcc that comes from rtools onto the path; Via

PS C:\Users\angus> $env:Path += ";C:\rtools40\usr\bin\;C:\rtools40\mingw64\bin\";

And then I get another error:

[omitted]
  = note: C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_eh
          collect2.exe: error: ld returned 1 exit status

And now I think this is just not possible to get past.

> Sys.which("ld")
                                  ld 
"C:\\rtools40\\mingw64\\bin\\ld.exe"

That's it from me; I don't know what else to do about this.

@yutannihilation
Copy link
Contributor

Thanks. So, maybe we came back to this issue...?

rust-lang/cargo#8990 (comment)

(Sorry, I don't follow the discussion around this topic during the last year-end... It needs some time for me to catch up.)

@clauswilke
Copy link
Member Author

cannot find -lgcc_eh is normally the problem when you're not making msvc the default toolchain. Weird. Maybe some problem with paths that get set when R is running. It should not be using the rtools linker but instead the msvc one, I believe.

@clauswilke
Copy link
Member Author

In the extendr github action scripts, we're explicitly adding C:\msys64\mingw64\bin to the path:
https://github.com/extendr/extendr/blob/f714309fc6806f953cf82a6a30b0863a5d4eff1d/.github/workflows/test.yml#L231

We may need something similar here. You can set environment variables in .Renviron: https://rstats.wtf/r-startup.html

@clauswilke
Copy link
Member Author

Ok, I think I'm starting to see how this all fits together. The problem is always the linker. For standalone Rust binaries, we need to use the msvc tool chain to get things linking correctly. For dynamic libraries (the use case here), we would also need the msvc tool chain. But when we're building an R package with extendr (as here: https://github.com/extendr/helloextendr/blob/main/src/Makevars.win) we're building a static library that we then let R link. This works fine with the msvc tool chain also, but the actual linking happens with the Rtools tool chain controlled by R.

What is breaking here is trying to build a dynamic library directly using a mixed tool chain. It makes sense that this wouldn't work. We need to make sure that the Rtools ld.exe doesn't get picked when linking the final dynamic library.

Alternatively, we could mimic the approach of building an R package, that is, use cargo only to build a static library and then use R to build a dynamic library. That's probably possible but a little more work on our end. (And I've never done this, so I don't know off the top of my head how to do it. But there's this: https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/SHLIB)

@Ilia-Kosenkov
Copy link
Member

I am sorry I fail to understand what actually triggered the linker error? Was it some simple test code?
I have seen a lot of different error combinations on Windows, but what I learned is that everything works if we take msvc toolchain and provide the correct target(s).

Could you please try setting up default toolchain

rustup default stable-x86_64-pc-windows-msvc

and then adding two targets

rustup target add x86_64-pc-windows-gnu --toolchain stable-x86_64-pc-windows-msvc
rustup target add i686-pc-windows-gnu --toolchain stable-x86_64-pc-windows-msvc

If PATH is contaminated by Rtools binaries, all sorts of weird things happen. Remove all references to Rtools subfolder, but ensure that you have a separate env variable RTOOLS40_HOME, which is set by default by the installer.

Then it should work. And if it does not, please provide a minimal reproducible example and detailed output.

@yutannihilation
Copy link
Contributor

Hmm..., I think I followed your instruction, but it failed.

> rust_function("fn add(a:f64, b:f64) -> f64 { a + b }")
build directory: C:\Users\HIROAK~1\AppData\Local\Temp\RtmpKOZj3U\file198858e28f7

    Updating crates.io index
   Compiling rextendr3 v0.0.1 (C:\Users\HIROAK~1\AppData\Local\Temp\RtmpKOZj3U\file198858e28f7)
error: linker `x86_64-w64-mingw32-gcc` not found
  |
  = note: 謖・ョ壹&繧後◆繝輔ぃ繧、繝ォ縺瑚ヲ九▽縺九j縺セ縺帙s縲・(os error 2)

error: aborting due to previous error

error: could not compile `rextendr3`

To learn more, run the command again with --verbose.
Error: Rust code could not be compiled successfully. Aborting.
> p <- Sys.getenv("PATH")
> p <- strsplit(p, ";", fixed = TRUE)[[1]]
> idx <- grepl("rtools", p, ignore.case = TRUE)
> p[idx]
character(0)
> Sys.getenv("RTOOLS40_HOME")
[1] "C:\\rtools40"
> system("rustup toolchain list")
stable-i686-pc-windows-gnu
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (default)
[1] 0

@Ilia-Kosenkov
Copy link
Member

@yutannihilation,
I see. The missing linker comes from MSYS2, which is added to my path. If you have it installed, could you temporarily add msys2\mingw64\bin to your PATH to see if it resolves the issue?

@yutannihilation
Copy link
Contributor

Thanks, confirmed it works (In my environment, the path seems msys64\mingw64\bin). Then, do you mean we need to require Windows users to install MSYS2 to use rextendr?

> library(rextendr)
> p <- Sys.getenv("PATH")
> Sys.setenv(PATH = paste0("C:\\msys64\\mingw64\\bin", ";", p))
> rust_function("fn add(a:f64, b:f64) -> f64 { a + b }")
build directory: C:\Users\HIROAK~1\AppData\Local\Temp\RtmpoVe16y\file307874ec3870

    Updating git repository `https://github.com/extendr/extendr`
    Updating crates.io index
   Compiling winapi-build v0.1.1
   Compiling winapi v0.3.9
   Compiling winapi v0.2.8
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.58
   Compiling extendr-engine v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling lazy_static v1.4.0
   Compiling kernel32-sys v0.2.2
   Compiling quote v1.0.8
   Compiling extendr-macros v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling libR-sys v0.2.1
   Compiling extendr-api v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling rextendr1 v0.0.1 (C:\Users\HIROAK~1\AppData\Local\Temp\RtmpoVe16y\file307874ec3870)
    Finished dev [unoptimized + debuginfo] target(s) in 52.52s
> add(2.5, 4.7)
[1] 7.2

@Ilia-Kosenkov
Copy link
Member

@yutannihilation,
I reproduced your error by removing msys2 from my path.
My observation, we need either:

  • stable-msvc + MSYS2
  • stable-gnu

In both cases we need to provide --target as I did in #16, otherwise x86 R will not be able to load the library (which is rare, but important).

So, my suggestion is to allow for toolchain optional parameter to override what toolchain is used.
This can be passed to various rust_* functions. The default NULL value corresponds to the default toolchain (i.e. no extra parameter). I believe this will help people with complex environment setups to control how the library is built.
It can be also tested in CI.

@clauswilke
Copy link
Member Author

@Ilia-Kosenkov Feel free to implement the toolchain parameter you suggest.

Also, it would be great if you could add brief instructions on how to get things going on Windows here:
https://github.com/extendr/rextendr/blob/main/vignettes/setting_up_rust.Rmd

@Ilia-Kosenkov
Copy link
Member

@clauswilke,
About to open PR, finishing with the docs.

@yutannihilation
Copy link
Contributor

So, my suggestion is to allow for toolchain optional parameter to override what toolchain is used.

Thanks! I now understand what you meant. Confirmed #20 works on my environment.

Without toolchain

> rust_function("fn add(a:f64, b:f64) -> f64 { a + b }")
build directory: C:\Users\HIROAK~1\AppData\Local\Temp\RtmpWIVDm3\file24205dfb5677

    Updating git repository `https://github.com/extendr/extendr`
    Updating crates.io index
   Compiling winapi-build v0.1.1
   Compiling winapi v0.3.9
   Compiling winapi v0.2.8
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.58
   Compiling extendr-engine v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling lazy_static v1.4.0
   Compiling kernel32-sys v0.2.2
   Compiling quote v1.0.8
   Compiling extendr-macros v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling libR-sys v0.2.1
   Compiling extendr-api v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling rextendr1 v0.0.1 (C:\Users\HIROAK~1\AppData\Local\Temp\RtmpWIVDm3\file24205dfb5677)
error: linker `x86_64-w64-mingw32-gcc` not found
  |
  = note: 謖・ョ壹&繧後◆繝輔ぃ繧、繝ォ縺瑚ヲ九▽縺九j縺セ縺帙s縲・(os error 2)

error: aborting due to previous error

error: could not compile `rextendr1`

To learn more, run the command again with --verbose.
Error: Rust code could not be compiled successfully. Aborting.

With toolchain specified

> rust_function("fn add(a:f64, b:f64) -> f64 { a + b }", toolchain = "stable-gnu")
build directory: C:\Users\HIROAK~1\AppData\Local\Temp\RtmpWIVDm3\file24205dfb5677

    Updating crates.io index
   Compiling winapi-x86_64-pc-windows-gnu v0.4.0
   Compiling winapi-build v0.1.1
   Compiling winapi v0.3.9
   Compiling winapi v0.2.8
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.58
   Compiling extendr-engine v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling lazy_static v1.4.0
   Compiling kernel32-sys v0.2.2
   Compiling quote v1.0.8
   Compiling extendr-macros v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling libR-sys v0.2.1
   Compiling extendr-api v0.1.11 (https://github.com/extendr/extendr#f714309f)
   Compiling rextendr2 v0.0.1 (C:\Users\HIROAK~1\AppData\Local\Temp\RtmpWIVDm3\file24205dfb5677)
    Finished dev [unoptimized + debuginfo] target(s) in 57.77s

@Ilia-Kosenkov
Copy link
Member

I am reopnening this issue because I am unable to setup simple Windows CI using stable-gnu toolchain.
The build fails with linker complaining about lgcc_eh, similar to what was reported here earlier.
I will try to investigate this further.

@Ilia-Kosenkov Ilia-Kosenkov reopened this Jan 13, 2021
@Ilia-Kosenkov
Copy link
Member

The root cause is that setup-r action incorrectly updates PATH when installing rtools.
By default, PATH should only contain C:\rtools40\usr\bin to get access to make.
setup-r adds C:\rtools40\mingw64\bin, similar to what @CGMossa did in #19 (comment). As a result, an incorrect linker is pulled from the PATH, which results in cannot find -lgcc_eh error when building rust library.
I have opened an issue r-lib/actions#228 to see if we can get help with this, as I believe setup-r is misconfigured.
The current solution is to rewrite paths, throwing away the ones matching rtools and mingw, like the following:

$temp = $env:Path -split [System.IO.Path]::PathSeparator | ? {$_ -notlike "*rtools*mingw*"} | join-string -Separator $([System.IO.Path]::PathSeparator)
echo $temp | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8

@yutannihilation
Copy link
Contributor

yutannihilation commented Jan 13, 2021

How about overriding PATH variable on rextendr's side? Probably we only need Rtools' toolchain and cargo. Here's a quick example: yutannihilation@1100936

I mean, I'm wondering if it's a common case not only for setup-r action but also for ordinary Windows users to misconfigure PATH with another MinGW toolsets, which might be bundled with various tools.

@Ilia-Kosenkov
Copy link
Member

@yutannihilation,
The PATH problem is unique to the Github Actions we use.
There is no need to fix it in code as regular users with correctly installed rtools will not experience it.

In fact, my issues has already been addressed and closed (r-lib/actions@1efbdeb), I will try this modified CI step in my script.

@yutannihilation
Copy link
Contributor

regular users with correctly installed rtools will not experience it.

OK, sounds fair. I probably thought of those who "incorrectly" installed rtools, but they need to do it right to compile packages anyway.

my issues has already been addressed and closed

So quick!

@Ilia-Kosenkov
Copy link
Member

@yutannihilation,
Unfortunately it appears to be bugged because the author of the fix put string value in the if condition. So basically trying to check if ("true") or if ("false") , which appears to be always true.
I am trying to fix it in my fork and reopen that issue.

@Ilia-Kosenkov
Copy link
Member

People @ r-lib fixed rtools path issue in r-lib/actions@30e0be0, which I have tested in my CI.

Notice however that to get latest updates the correct action is r-lib/actions/setup-r@master, not r-lib/actions/setup-r@v1.

@Ilia-Kosenkov
Copy link
Member

@clauswilke in discussion of #26 made a good point that we should have consistent tools throughout *extendr projects.
So far, because of problems with rust gnu toolchain, we use everywhere stable-msvc and rely on MSYS2.
This is acually a good and universal setup that allows building for both architectures, and it also supports binding generation of libR-sys.

With this in mind, rextendr will rely on default toolchain (which is expected to be *-msvc).
A user can override this behavior by specifying toolchain.
As @yutannihilation suggested, it will be up to the user to provide correct toolchain for each architecture.

Right now CI uses stable-msvc

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release', rust-version: 'stable-msvc'}
- {os: macOS-latest, r: 'release', rust-version: 'stable'}
- {os: ubuntu-20.04, r: 'release', rust-version: 'stable', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rust-version: 'stable', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

And setts up MSYS2 paths

- name: Configure Windows
if: startsWith(runner.os, 'Windows')
run: |
rustup target add x86_64-pc-windows-gnu
rustup target add i686-pc-windows-gnu
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\msys64\mingw32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh

Which allows rextendr to pass rcmdcheck with --force-multiarch.

@yutannihilation
Copy link
Contributor

@Ilia-Kosenkov
Thanks for investigation and wrapping up! At first, I slightly preferred gnu toolchains as it seemed a bit heavy to install MSYS2, but I now agree with you on this.

This is acually a good and universal setup that allows building for both architectures, and it also supports binding generation of libR-sys.

Probably we should require installing MSYS2 at the moment in case we ask them to try compilation w/ bindgen (and I expect the ordinary Windows users who just install the packages can use pre-compiled binaries c.f. extendr/extendr#51).

@clauswilke @CGMossa
IIUC, now we can simply

tell people to always make msvc the default.

Can we close this issue? Are there any points on this topic that we still need to discuss?

@clauswilke
Copy link
Member Author

Sounds good. I think the issue can be closed. Are the installation instructions for Windows here correct or not?

@yutannihilation
Copy link
Contributor

I think the instructions are mostly correct. One thing, users need to define MSYS_ROOT by themselves (c.f. https://github.com/extendr/libR-sys/#windows-specific-instructions, this is because MSYS2 can be installed by various ways thus the root varies).

@clauswilke
Copy link
Member Author

Thanks. For simplicity, I just removed MSYS_ROOT entirely from the instructions. I don't think it's needed for rextendr. We're not using it in the GH Action scripts.

@yutannihilation
Copy link
Contributor

Looks good, but I guess you probably meant msys2 instead of msys32...?

#27

@clauswilke
Copy link
Member Author

I did mean msys32, but maybe msys64 is better.

The screenshot on the msys2 page uses msys32: https://www.msys2.org/#installation

But these days, we normally use 64-bit systems, which would go into msys64:
https://www.msys2.org/wiki/MSYS2-installation/

@clauswilke
Copy link
Member Author

There's one thing I still don't understand: If we don't compile libR-sys with bindgen, why can't we use the toolchain that comes with Rtools even when using stable-msvc, if in the end we're using mingw linkers anyway? Is this a version incompatibility, or would we have to install other packages through Rtools?

@Ilia-Kosenkov
Copy link
Member

@clauswilke,
There is a mismatch in gcc versions, at least. Rtools ships 8.3.0, msys2 has 10.2.0.
Your build will fail with linker error of missing gcc_eh library, which is not present in 8.3.0.
I was actually experimenting with this today.
Essentially, rtools is modified msys2, so a user needs two nearly identical subsystems installed simultaneously.
We cannot install newer gcc onto rtools because packages rely on 8.3.0.

Now I am not sure from where this gcc_eh library requirement comes from.
If we can find out, we can probably solve this problem with rtools only.

@clauswilke
Copy link
Member Author

Is gcc_eh not present in gcc 8.3 or not present in Rtools? gcc 8.3 is only two years old, it's not that unreasonable to ship it in my opinion. gcc_eh is definitely older. Maybe it's a problem with how Rtools sets up their compiler? I know they're setting up everything to link statically, maybe that's what's causing the issue. (Though gcc_eh is needed for static builds, so that's confusing to me.)

@Ilia-Kosenkov
Copy link
Member

@clauswilke,
I cannot say. msys2's package manager does not seem to support package versioning (or, rather, repositories have only current version of a package), so I tried building gcc 8.3.0 using PKGBUILD script from mingw repository, but it unfortunately errored while building gcc from source, and I am not sure why.

I think we should somehow install older version of mingw64 toolchain, or just older gcc. If it has gcc_eh, then it is rtools. If it does not, then it is older version of gcc or some rust configuration (perhaps rust requires newer gcc).

gcc_eh is passed as -lgcc_eh to rustc, so I doubt we have any power over it.

@clauswilke
Copy link
Member Author

Here is the explanation, from this old, random bug report:

Note that if enabled_shared is set to yes, then libgcc-eh is built; otherwise, it is added to libgcc. And this confirms what I am seeing, which is that gcc built with --disable-shared does not produce a libgcc_eh.a (totally weird that if shared is enabled, libgcc_eh.a, which is not a shared library, does get built).

Rtools builds with --disabled-shared:
https://github.com/r-windows/rtools-packages/blob/df6b4363b0422db30abf7dd78378022666a24ab4/mingw-w64-gcc/PKGBUILD#L167

msys2 builds with --enable-shared:
https://github.com/msys2/MINGW-packages/blob/950bcf391e5b247ebc7f2b2f5f5d10a03c3fdd63/mingw-w64-gcc/PKGBUILD#L223

This is fundamentally a gcc bug, and in particular when cross-compiling. See e.g. this old message from some development mailing list:
https://sourceware.org/legacy-ml/libc-alpha/2003-09/msg00100.html

Rtools could fix it by building with --enable-shared, but I guess one of their main points is that they don't want to allow shared builds.

@Ilia-Kosenkov
Copy link
Member

Ilia-Kosenkov commented Jan 17, 2021

@clauswilke,
I tried building mingw-w64-gcc from rtools-packages after replacing --disabled-shared with --enabled-shared, but ultimately failed with the strangest error:

.../PKGBUILD: line 168: --enable-shared: command not found

It looks like it was removed/disabled on purpose.

@Ilia-Kosenkov
Copy link
Member

@clauswilke,
OK, the weirdest thing happened.
I applied the single most straightforward solution to the problem: copied gcc-10.2.0 libgcc_eh.a into rtools gcc-8.3.0 folder, and it worked. Not sure how reliable it is, but I can run libR-sys tests (no bindgen), extendr tests (but not the bindgen ones), and it seems that rextendr works as well.
Perhaps if we can get libgcc_eh from gcc-8.3.0, we can "patch" rtools (or ship this library with our packages, as long as it is found on PATH it should be ok).

@Ilia-Kosenkov
Copy link
Member

Another observation in rtools, ming32 version of gcc contains libgcc and libgcc_eh, both files are of exactly same (and large size).
I believe what happens is that for mingw 32 the include issue was solved by duplicating libgcc as libgcc_eh, but this procedure was not carried out for mingw64.

I think this is possible because from what @clauswilke wrote, gcc compiles everything into libgcc and libgcc_eh is not needed, so simple copying of the same file solves the problem by pleasing the linker.

I think we should ask rtools people to implement this bypass for mingw64 as well.

Here is proof that mingw32 files are identical:

("C:\rtools40\mingw32\lib\gcc\i686-w64-mingw32\8.3.0\libgcc.a", "C:\rtools40\mingw32\lib\gcc\i686-w64-mingw32\8.3.0\libgcc_eh.a") 
| Get-FileHash
Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          621AEF2A5AD649F24D17081657F611F9DFB20E2E26B74B30F7D5756A00DD9217       C:\rtools40\mingw32\lib\gcc\i686-w64-mingw32\8.3.0\libgcc.a
SHA256          621AEF2A5AD649F24D17081657F611F9DFB20E2E26B74B30F7D5756A00DD9217       C:\rtools40\mingw32\lib\gcc\i686-w64-mingw32\8.3.0\libgcc_eh.a

@Ilia-Kosenkov
Copy link
Member

And here is the commit that introduced that hack, apparently
r-windows/rtools-packages@7d084d6

https://github.com/r-windows/rtools-packages/blob/df6b4363b0422db30abf7dd78378022666a24ab4/mingw-w64-gcc/PKGBUILD#L305-L309

The comment says this hack is for rustc, so I guess this is what we want.

@clauswilke
Copy link
Member Author

This is a great find! Could you open an issue about this with rtools-packages, and maybe also a PR? (I would always do an issue first if you're not a frequent contributor to a project, even if the PR is straightforward.)

@Ilia-Kosenkov
Copy link
Member

Ilia-Kosenkov commented Jan 18, 2021

I can confirm that after implementing this fix for mingw64

creating a new gcc package using makepkg-mingw --syncdeps,
installing it onto a fresh copy of rtools using pacman -U mingw-w64-x86_64-gcc-8.3.0-9500-any.pkg.tar.xz,
the issue with x86_64 build using stable-msvc and mingw64 from rtools is resolved.

EDIT01: Note that building package from source took more than an hour on a decent desktop.

@clauswilke
Copy link
Member Author

Can we close this issue?

@Ilia-Kosenkov
Copy link
Member

Can we close this issue?

Yes, we decided to go with msvc and cross-compile using Rtools.

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

Successfully merging a pull request may close this issue.

4 participants