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

Is it possible to cross compile with rextendr? #246

Closed
Jaage opened this issue Feb 23, 2023 · 4 comments
Closed

Is it possible to cross compile with rextendr? #246

Jaage opened this issue Feb 23, 2023 · 4 comments

Comments

@Jaage
Copy link

Jaage commented Feb 23, 2023

I am looking to cross compile to several architectures, at least x86_64-pc-windows-gnu and x86_64-apple-darwin, possible apple's ARM cpus as well. Is it possible to do this? I have tried to add a .cargo folder with config.toml file in it, but it seems rextendr::document() does not read it.

How can I cross-compile/specify a config.toml file? Thank you.

@CGMossa
Copy link
Member

CGMossa commented Feb 24, 2023

I ask that you always include outputs when creating issues on ExtendR-projects. Even though it is quite verbose, it does help us with troubleshooting the specific scenario that you're encountering.

I would say a .cargo/config.toml-file cannot be ignored by rextendr::doument(). Presumably what is happening is libR-sys is not cross-compile-compatible with the targets that you're specifying.
We (royal we) have recently merged these targets additionally to the targets we had before over at extendr/libR-sys#133 and extendr/libR-sys#134, etc.

This is mainly for you, as we have to address this challenge more structurally, {rextendr} depends on {ExtendR},
and the latter uses bindings for R-libraries that are generated and facilitated by a package called libR-sys.

So if you travel to all those three, surely you'll be able to pinpoint what needs to be changed. If you're already consulting the
manifest guide.

@Jaage
Copy link
Author

Jaage commented Feb 24, 2023

Here is the error I currently get:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-arch" "x86_64" "-m64" "C:\\Users\\jorda\\AppData\\Local\\Temp\\rustceowEfW\\symbols.o" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps\\proj-ea9d50a66859d78d.1ec4i2620iafl5a.rcgu.o" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps\\proj-ea9d50a66859d78d.29jdjgipr0svbdsa.rcgu.o" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps\\proj-ea9d50a66859d78d.2z2lo5pfigznritk.rcgu.o" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps\\proj-ea9d50a66859d78d.38zv7xjxq0fg49mq.rcgu.o" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps\\proj-ea9d50a66859d78d.3m7f1mbk8bwz2koa.rcgu.o" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps\\proj-ea9d50a66859d78d.5dyjjrzmglq1s3i9.rcgu.o" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps\\proj-ea9d50a66859d78d.3lmjuk0br8b3zokb.rcgu.o" "-L" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps" "-L" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\debug\\deps" "-L" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libstd-608df0ae1c572548.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libpanic_unwind-95c5c9c48ead4f97.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libobject-1b5b8b74eb1fe49b.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libmemchr-7ad2821aacb373ca.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libaddr2line-d429b08bf8bcef51.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libgimli-ae416598e36993ac.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\librustc_demangle-af74926fbb78b2ae.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libstd_detect-4495f6558cee3d93.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libhashbrown-21abda9416959b00.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libminiz_oxide-2896cfc1245ef3f4.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libadler-68c24a21e65f95bb.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\librustc_std_workspace_alloc-060d54bc54ff5cb3.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libunwind-55effca6be20123c.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libcfg_if-bde5aba3f4e24327.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\liblibc-0d107da2668a3a4d.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\liballoc-5dcfbe8982810c3d.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\librustc_std_workspace_core-1bf2f523c1bee03d.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libcore-d0a8c087921eb265.rlib" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib\\libcompiler_builtins-80a9ab50ea4822d6.rlib" "-lSystem" "-lc" "-lm" "-L" "C:\\Users\\jorda\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-apple-darwin\\lib" "-o" "C:\\Users\\jorda\\Documents\\Rust Resources\\Rust\\proj\\target\\x86_64-apple-darwin\\debug\\deps\\proj-ea9d50a66859d78d" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: cc: error: unrecognized command-line option '-arch'


error: could not compile `proj` due to previous error
PS C:\Users\jorda\Documents\Rust Resources\Rust\proj>

My .cargo/config.toml looks like this:

[build]
target = ["x86_64-pc-windows-gnu", "x86_64-apple-darwin"]

Note that this error is from calling cargo build and not document(). The reason for that is because document() does not seem to parse my .cargo/config.toml file. It will compile just fine, but does not produce two target folders. I can add random gibberish to the config and cargo build will not compile as it can't parse the gibberish, but document() runs just fine. My .cargo folder is in the same folder as cargo.toml, where I normally have it in a cargo project. Perhaps it needs to be elsewhere?

@Jaage
Copy link
Author

Jaage commented Feb 27, 2023

It seems that document() does not parse config.toml files if the source code has not been changed. Once I made a change to my source code, document() errored when trying to parse the config.toml finally.

@Jaage Jaage closed this as completed Feb 27, 2023
@CGMossa
Copy link
Member

CGMossa commented Feb 27, 2023

Hugh.. That's maybe something we need to make an issue for.

Good find! Thanks!

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

2 participants