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

build error with localy built toolchain on macos x #104

Open
bentxt opened this issue Jan 17, 2023 · 6 comments
Open

build error with localy built toolchain on macos x #104

bentxt opened this issue Jan 17, 2023 · 6 comments

Comments

@bentxt
Copy link

bentxt commented Jan 17, 2023

Like described under 'Installation' but for macos:

 curl -s -o ./.rust/rustup-init.tmp -- https://static.rust-lang.org/rustup/dist/x86_64-apple-darwin/rustup-init

With this resulting toolchain

which cargo
/Users/ben/builds/vonuvoli-scheme/vonuvoli-scheme/.rust/rustup/toolchains/nightly-x86_64-apple-darwin/bin/cargo

But it doesn't build

[I] ben@moonraker ~/b/v/vonuvoli-scheme (development)> cargo build
   Compiling vonuvoli-scheme v0.0.7 (/Users/ben/builds/vonuvoli-scheme/vonuvoli-scheme)
error[E0425]: cannot find value `RUSAGE_THREAD` in crate `ext::libc`
    --> sources/runtime.rs:425:39
     |
425  |         if ext::libc::getrusage (ext::libc::RUSAGE_THREAD, &mut resources) == 0 {
     |                                             ^^^^^^^^^^^^^ help: a constant with a similar name exists: `SIGEV_THREAD`
     |
    ::: /Users/ben/builds/vonuvoli-scheme/vonuvoli-scheme/.rust/cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.139/src/unix/bsd/apple/mod.rs:4356:1
     |
4356 | pub const SIGEV_THREAD: ::c_int = 3;
     | ------------------------------- similarly named constant `SIGEV_THREAD` defined here

error[E0308]: mismatched types
    --> sources/builtins_filesystem.rs:1354:32
     |
1354 |     let kind = metadata.mode () & ext::libc::S_IFMT;
     |                                   ^^^^^^^^^^^^^^^^^ expected `u32`, found `u16`

error[E0277]: no implementation for `u32 & u16`
    --> sources/builtins_filesystem.rs:1354:30
     |
1354 |     let kind = metadata.mode () & ext::libc::S_IFMT;
     |                                 ^ no implementation for `u32 & u16`
     |
     = help: the trait `BitAnd<u16>` is not implemented for `u32`
     = help: the following other types implement trait `BitAnd<Rhs>`:
               <&'a u32 as BitAnd<u32>>
               <&u32 as BitAnd<&u32>>
               <u32 as BitAnd<&u32>>
               <u32 as BitAnd>

Some errors have detailed explanations: E0277, E0308, E0425.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `vonuvoli-scheme` due to 3 previous errors
@cipriancraciun
Copy link
Member

It seems there are some incompatibilities with OSX.

I'll try to fix the build for OSX in the weekend if I get some time.

However, you could quickly try to patch the code to fix these minor incompatibilities. (For example a (ext::libc::S_IFMT as u32) would work for some, and the other is just find the equivalent of RUSAGE_THREAD for OSX.

@Machine-Jonte
Copy link

I also seem to have issue building on MacOS. This has not been fixed right?

 ~/programming/vonuvoli-scheme (development): cargo +nightly build
   Compiling vonuvoli-scheme v0.0.7 (/Users/jonathanosterberg/programming/vonuvoli-scheme)
error[E0425]: cannot find value `RUSAGE_THREAD` in crate `ext::libc`
    --> sources/runtime.rs:425:39
     |
425  |         if ext::libc::getrusage (ext::libc::RUSAGE_THREAD, &mut resources) == 0 {
     |                                             ^^^^^^^^^^^^^ help: a constant with a similar name exists: `SIGEV_THREAD`
     |
    ::: /Users/jonathanosterberg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.139/src/unix/bsd/apple/mod.rs:4356:1
     |
4356 | pub const SIGEV_THREAD: ::c_int = 3;
     | ------------------------------- similarly named constant `SIGEV_THREAD` defined here

error: ambiguous glob re-exports
   --> sources/lib.rs:614:10
    |
614 |     pub use super::constants::exports::*;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the name `exports` in the type namespace is first re-exported here
...
657 |     pub use super::runtime::exports::*;
    |             -------------------------- but the name `exports` in the type namespace is also re-exported here
    |
note: the lint level is defined here
   --> sources/lib.rs:19:11
    |
19  | #![ deny (warnings) ]
    |           ^^^^^^^^
    = note: `#[deny(ambiguous_glob_reexports)]` implied by `#[deny(warnings)]`

error[E0308]: mismatched types
    --> sources/builtins_filesystem.rs:1354:32
     |
1354 |     let kind = metadata.mode () & ext::libc::S_IFMT;
     |                                   ^^^^^^^^^^^^^^^^^ expected `u32`, found `u16`

error[E0277]: no implementation for `u32 & u16`
    --> sources/builtins_filesystem.rs:1354:30
     |
1354 |     let kind = metadata.mode () & ext::libc::S_IFMT;
     |                                 ^ no implementation for `u32 & u16`
     |
     = help: the trait `BitAnd<u16>` is not implemented for `u32`
     = help: the following other types implement trait `BitAnd<Rhs>`:
               <&'a u32 as BitAnd<u32>>
               <&u32 as BitAnd<&u32>>
               <u32 as BitAnd<&u32>>
               <u32 as BitAnd>

Some errors have detailed explanations: E0277, E0308, E0425.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `vonuvoli-scheme` (lib) due to 4 previous errors

@cipriancraciun
Copy link
Member

@Machine-Jonte nop, not yet. (I mainly use Linux, thus I didn't cross-compile it for OSX, especially given how clumsy the whole Rust cross-compiling experience is.)

If you could try to fix the compile errors and let me know the patch that makes it work, I could try to put in some #cfg[...] items in the code to make it work.

Else, I'll have to find a weekend and make it work. (I've already experienced the Rust cross compiling to OSX on another project, I just need to port the scripts into this project.)

@Machine-Jonte
Copy link

@cipriancraciun I did some quick hackaround but not sure how to test out if it actually works.

I expected this to work (i.e. running cargo run --bin vonuvoli-scheme-interpreter ./examples/benchmark--controls.ss )

λ ~/programming/vonuvoli-scheme (development): cargo  run --bin vonuvoli-scheme-interpreter ./examples/benchmark--controls.ss 
warning: ambiguous glob re-exports
   --> sources/lib.rs:614:10
    |
614 |     pub use super::constants::exports::*;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the name `exports` in the type namespace is first re-exported here
...
657 |     pub use super::runtime::exports::*;
    |             -------------------------- but the name `exports` in the type namespace is also re-exported here
    |
    = note: `#[warn(ambiguous_glob_reexports)]` on by default

warning: `vonuvoli-scheme` (lib) generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/vonuvoli-scheme-interpreter ./examples/benchmark--controls.ss`
[ee] [VS~tools_interpreter][375a8302] |  invalid arguments;  see `--help`;  aborting!

@cipriancraciun
Copy link
Member

Yes, it compiles and works, just that the arguments of the interpreter are perhaps a bit counter-intuitive.

See the help at:

--------------------------------------------------------------------------------
---- How to execute scripts?
vonuvoli-scheme-interpreter -s /.../script.ss [ script-argument ... ]
vonuvoli-scheme-interpreter -c '(scheme code)' [ script-argument ... ]
The first `--` argument terminates the parsing of interpreter arguments,
and starts the script arguments; it is also removed from the resulting list.
Note, that any argument after the `-s /.../script.ss` or `-c '(scheme code)'`
is considered an argument for the script.
However the first `--` is processed as described above.

Basically you need to use -s script.ss.

@cipriancraciun
Copy link
Member

@Machine-Jonte if you happen to use Discord, there is a channel dedicated to this project https://discord.gg/WuCr5rzfq2, and it could perhaps work a bit better than back-and-forth on GitHub for smaller problems.

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

3 participants