archives of rust-dev@mozilla.org (2010-2015)
 help / color / mirror / Atom feed
* [rust-dev] (FFI) Compile a dylib to x86 from a x86_64 machine and rust toolchain
@ 2014-12-28 19:11 Alfredo Di Napoli
  2014-12-28 19:21 ` Corey Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Alfredo Di Napoli @ 2014-12-28 19:11 UTC (permalink / raw)
  To: rust-dev

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

Hello Rustacean,

I’ll go straight to the point: I’m building a small FFI library which needs
to be called
from a C++ x86 project. I cannot change the arch of the latter (it’s Doom3,
and relies on x86 arch entirely).
Thus linker reject my Rust library as “file was built for x86_64 which is
not the architecture being linked (i386)”.

Thus my question: It’s possible (without rebuilding the toolchain) to
instruct cargo to generate a x86 dylib?
Something like (fantasy syntax):

cargo build —arch-type=x86

Thanks in advance!
Alfredo

[-- Attachment #2: Type: text/html, Size: 586 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [rust-dev] (FFI) Compile a dylib to x86 from a x86_64 machine and rust toolchain
  2014-12-28 19:11 [rust-dev] (FFI) Compile a dylib to x86 from a x86_64 machine and rust toolchain Alfredo Di Napoli
@ 2014-12-28 19:21 ` Corey Richardson
  2014-12-28 19:40   ` Alfredo Di Napoli
  0 siblings, 1 reply; 3+ messages in thread
From: Corey Richardson @ 2014-12-28 19:21 UTC (permalink / raw)
  To: Alfredo Di Napoli; +Cc: rust-dev

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

You need at least a 32-bit stdlib, but you can build with `cargo build
--target i686-unknown-linux-gnu` and it will "Just Work" assuming you have
the proper libs in $PREFIX/lib/rustlib/i686-unknown-linux-gnu.
http://doc.rust-lang.org/src/rustc_back/target/mod.rs.html#330 has a list
of the built-in targets, and
http://doc.rust-lang.org/rustc_back/target/index.html has docs on how to
create your own.

On Sun, Dec 28, 2014 at 2:11 PM, Alfredo Di Napoli <
alfredo.dinapoli@gmail.com> wrote:

> Hello Rustacean,
>
> I’ll go straight to the point: I’m building a small FFI library which
> needs to be called
> from a C++ x86 project. I cannot change the arch of the latter (it’s
> Doom3, and relies on x86 arch entirely).
> Thus linker reject my Rust library as “file was built for x86_64 which is
> not the architecture being linked (i386)”.
>
> Thus my question: It’s possible (without rebuilding the toolchain) to
> instruct cargo to generate a x86 dylib?
> Something like (fantasy syntax):
>
> cargo build —arch-type=x86
>
> Thanks in advance!
> Alfredo
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
>


-- 
http://octayn.net/

[-- Attachment #2: Type: text/html, Size: 2002 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [rust-dev] (FFI) Compile a dylib to x86 from a x86_64 machine and rust toolchain
  2014-12-28 19:21 ` Corey Richardson
@ 2014-12-28 19:40   ` Alfredo Di Napoli
  0 siblings, 0 replies; 3+ messages in thread
From: Alfredo Di Napoli @ 2014-12-28 19:40 UTC (permalink / raw)
  To: Corey Richardson; +Cc: rust-dev

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

Thanks Corey,

I will have a look into this ;)

Alfredo

On Sunday, 28 December 2014, Corey Richardson <corey@octayn.net> wrote:
> You need at least a 32-bit stdlib, but you can build with `cargo build
--target i686-unknown-linux-gnu` and it will "Just Work" assuming you have
the proper libs in $PREFIX/lib/rustlib/i686-unknown-linux-gnu.
http://doc.rust-lang.org/src/rustc_back/target/mod.rs.html#330 has a list
of the built-in targets, and
http://doc.rust-lang.org/rustc_back/target/index.html has docs on how to
create your own.
>
> On Sun, Dec 28, 2014 at 2:11 PM, Alfredo Di Napoli <
alfredo.dinapoli@gmail.com> wrote:
>>
>> Hello Rustacean,
>>
>> I’ll go straight to the point: I’m building a small FFI library which
needs to be called
>> from a C++ x86 project. I cannot change the arch of the latter (it’s
Doom3, and relies on x86 arch entirely).
>> Thus linker reject my Rust library as “file was built for x86_64 which
is not the architecture being linked (i386)”.
>>
>> Thus my question: It’s possible (without rebuilding the toolchain) to
instruct cargo to generate a x86 dylib?
>> Something like (fantasy syntax):
>>
>> cargo build —arch-type=x86
>>
>> Thanks in advance!
>> Alfredo
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev@mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
>>
>
>
>
> --
> http://octayn.net/

[-- Attachment #2: Type: text/html, Size: 2014 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-28 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-28 19:11 [rust-dev] (FFI) Compile a dylib to x86 from a x86_64 machine and rust toolchain Alfredo Di Napoli
2014-12-28 19:21 ` Corey Richardson
2014-12-28 19:40   ` Alfredo Di Napoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox