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

Revert RUSTFLAGS removal #40

Merged
merged 2 commits into from
Jul 21, 2023
Merged

Revert RUSTFLAGS removal #40

merged 2 commits into from
Jul 21, 2023

Conversation

Meziu
Copy link
Member

@Meziu Meziu commented Jul 19, 2023

After my changes to the RUSTFLAGS before 0.1.0, I had tested ctru-rs to ensure known-to-not-work examples would in fact compile. However, I mistakenly did not test network-related examples, and I only now notice that those RUSTFLAGS changes are required to link all network related functions.

= note: /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `std::sys::unix::net::cvt_gai':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/net.rs:49: undefined reference to `gai_strerror'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `std::sys::unix::net::Socket::recv_with_flags':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/net.rs:247: undefined reference to `recv'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `std::sys::unix::net::Socket::shutdown':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/net.rs:385: undefined reference to `shutdown'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `std::sys::unix::net::Socket::set_nonblocking':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/net.rs:460: undefined reference to `ioctl'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `std::sys::unix::net::Socket::accept::{{closure}}':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/unix/net.rs:232: undefined reference to `accept'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `std::sys_common::net::setsockopt':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:68: undefined reference to `setsockopt'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `<std::sys_common::net::LookupHost as core::ops::drop::Drop>::drop':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:171: undefined reference to `freeaddrinfo'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `<std::sys_common::net::LookupHost as core::convert::TryFrom<(&str,u16)>>::try_from::{{closure}}':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:206: undefined reference to `getaddrinfo'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `std::sys_common::net::TcpStream::write':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:291: undefined reference to `send'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/Desktop/Programming/Rust/rust-3ds/ctru-rs/target/armv6k-nintendo-3ds/debug/deps/libstd-2aab5dc9bae7bd35.rlib(std-2aab5dc9bae7bd35.std.b2cd8dee9fb32859-cgu.14.rcgu.o): in function `std::sys_common::net::TcpListener::bind':
          /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:413: undefined reference to `bind'
          /opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.1.0/../../../../arm-none-eabi/bin/ld: /Users/andreaciliberti/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys_common/net.rs:428: undefined reference to `listen'
          collect2: error: ld returned 1 exit status

It's interesting to note how only networking functions are listed here, even though other functions (e.g. fopen and other fs functions) that are implemented in libctru don't have this issue.

I wonder if including these functions in the upstream newlib (maybe in a similar way to how the pthread functions are filled) would solve the issue...

@Meziu Meziu requested a review from a team as a code owner July 19, 2023 11:14
Copy link
Member

@ian-h-chamberlain ian-h-chamberlain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, it's surprising that this is needed, but I guess if the std network functions are linked before the final executable (and not discarded) like they would then maybe they need definitions on those symbols.

It would be nice if the new CI you set up caught stuff like this, maybe by trying to build all the examples in ctru-rs or something? I guess it makes more sense for ctru-rs to have its own CI do that, really ...

@Meziu Meziu merged commit 1372661 into master Jul 21, 2023
3 checks passed
@Meziu Meziu deleted the fix/rustflags branch July 21, 2023 14:01
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 this pull request may close these issues.

2 participants