Comments (5)
The RUSTFLAGS
invocation is there to link libctru
against std
I believe, there may be a problem with link order.
from cargo-3ds.
I just saw this too, which may help some things: rust-lang/rust#47384 (comment)
Possibly unrelated to this issue, but more useful for stuff like linker fix.
from cargo-3ds.
Yeah, you can test without it, but since std is linked near the end and introduces new symbol usages, those symbols need to get filled in by libctru again. The linker by default goes through its arguments linearly and throws away symbols that aren't needed at each stage.
from cargo-3ds.
Reopened as of #40. Seems like network related functions still won't link without using RUSTFLAGS
.
from cargo-3ds.
I ran into a problem with this today, when linking ctrud
via the build script from ctru-sys
(but cargo-3ds
still passes an explicit -lctru
while building std
), resulting in duplicate definitions between libctrud
and libctru
at link time.
I think part of the problem here is that -Zbuild-std
builds the standard library with "plain" RUSTFLAGS
, but Cargo might end up passing different flags to ctru-sys
when it builds it (based on --release
, [profile."*"]
etc), resulting in different link flags between std
and the final executable build.
From doing a bit of searching, perhaps we can somehow use the --as-needed
flag rust-lang/rust#99424 ? (i.e. something like RUSTFLAGS="-Clink-arg=-Wl,--as-needed"
). A little bit of testing hasn't gotten me far with it, but maybe there's some way to use it to solve this...
I am not sure of a general way to unify the linker flags (specifically -lctru[d]
) between build-std
and the downstream libraries, unless there is some magic rustc
/cargo
flag to say --link-but-only-if-nothing-else-did=ctru
. Maybe something like https://doc.rust-lang.org/cargo/reference/unstable.html#profile-rustflags-option ?
Thus far I haven't found a relevant issue in https://github.com/rust-lang/wg-cargo-std-aware/ but that repo is rather large in scope so 🤷
If none of the above flags produce what we need, it's possible we could try to parse the cargo
flags and figure out whether we should link ctrud
or ctru
(similar to https://github.com/rust3ds/ctru-rs/blob/a636722b4978d36531e5c9e2a866cdec3387877e/ctru-sys/build.rs#L27-L33 except we'd have to figure out the PROFILE
based on the command invocation 😭) but this doesn't seem ideal.
from cargo-3ds.
Related Issues (20)
- Make tool parameters accessible HOT 6
- Handle empty "authors" in Cargo.toml HOT 1
- Allow using a prebuilt std if one is found HOT 3
- the current build seems broken HOT 22
- Missing values in `libc` in latest nightly HOT 9
- Rustdoc no longer working HOT 2
- Issue Building Project using cargo-3ds HOT 21
- `cargo 3ds new` and `init` commands HOT 1
- Add `test --doc` support
- Add basic CI / testing
- no license HOT 3
- Set environment variables for CC and CXX to allow building C/C++ wrapper crates HOT 6
- Build 3dsx for *all* executables built by a given command
- Respect `--no-run` when custom runner is set
- Not building when in release mode on Windows HOT 2
- More comprehensive CI coverage HOT 1
- [Help/Feature Request]: Support for winit and rustix HOT 2
- [Question]: Is the family supposed to say unix? HOT 3
- Error trying to compile on MacOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-3ds.