ubolonton / emacs-module-rs

Rust binding and tools for Emacs's dynamic modules
336 stars 22 forks source link

Need some help getting started #25

Closed tarsius closed 4 years ago

tarsius commented 4 years ago

I am just getting started with rust and since I am coming from elisp I figured this would be a good place to get started. Unfortunately I am not even able to begin building the greeting example, things already fail when trying to build emacs:

$ cargo build                                                                              
   Compiling emacs v0.12.3                                                                     
error[E0425]: cannot find function `type_name` in module `any`                                 
  --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/types/us    er_ptr.rs:52:14                                                                                
   |                                                                                           
52 |         any::type_name::<Self>()                                                          
   |              ^^^^^^^^^ not found in `any`                                                 
help: possible candidates are found in other modules, you can import them into scope           
   |                                                                                           
1  | use core::intrinsics::type_name;                                                          
   |                                                                                           
1  | use std::intrinsics::type_name;                                                           
   |                                                                                           

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)                
 --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.rs:    4:5                                                                                            
  |                                                                                            
4 | use std::mem::MaybeUninit;                                                                 
  |     ^^^^^^^^^^^^^^^^^^^^^                                                                  

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)                
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.r    s:111:26                                                                                       
    |                                                                                          
111 |         let mut symbol = MaybeUninit::uninit();                                          
    |                          ^^^^^^^^^^^^^^^^^^^                                             

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)                
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.r    s:112:24                                                                                       
    |                                                                                          
112 |         let mut data = MaybeUninit::uninit();                                            
    |                        ^^^^^^^^^^^^^^^^^^^                                               

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)                
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.r    s:218:22                                                                                       
    |                                                                                          
218 |         symbol: &mut MaybeUninit<emacs_value>,                                           
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^                                            

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)                
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.r    s:219:20                                                                                       
    |                                                                                          
219 |         data: &mut MaybeUninit<emacs_value>,                                             
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^                                              

error[E0599]: no function or associated item named `uninit` found for type `std::mem::Maybe    Uninit<_>` in the current scope                                                                
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.r    s:111:39                                                                                       
    |
111 |         let mut symbol = MaybeUninit::uninit();
    |                          -------------^^^^^^
    |                          |
    |                          function or associated item not found in `std::mem::MaybeUninit<_>`

error[E0599]: no function or associated item named `uninit` found for type `std::mem::MaybeUninit<_>` in the current scope
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.rs:112:37
    |
112 |         let mut data = MaybeUninit::uninit();
    |                        -------------^^^^^^
    |                        |
    |                        function or associated item not found in `std::mem::MaybeUninit<_>`

error[E0599]: no method named `assume_init` found for type `std::mem::MaybeUninit<*mut emacs_module::emacs_value_tag>` in the current scope
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.rs:120:60
    |
120 |                     symbol: unsafe { TempValue::new(symbol.assume_init()) },
    |                                                            ^^^^^^^^^^^

error[E0599]: no method named `assume_init` found for type `std::mem::MaybeUninit<*mut emacs_module::emacs_value_tag>` in the current scope
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.rs:121:56
    |
121 |                     data: unsafe { TempValue::new(data.assume_init()) },
    |                                                        ^^^^^^^^^^^

error[E0599]: no method named `assume_init` found for type `std::mem::MaybeUninit<*mut emacs_module::emacs_value_tag>` in the current scope
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.rs:128:54
    |
128 |                     tag: unsafe { TempValue::new(tag.assume_init()) },
    |                                                      ^^^^^^^^^^^

error[E0599]: no method named `assume_init` found for type `std::mem::MaybeUninit<*mut emacs_module::emacs_value_tag>` in the current scope
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.rs:129:58
    |
129 |                     value: unsafe { TempValue::new(value.assume_init()) },
    |                                                          ^^^^^^^^^^^

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.rs:222:67
    |
222 |         unsafe_raw_call_no_exit!(self, non_local_exit_get, symbol.as_mut_ptr(), data.as_mut_ptr())
    |                                                                   ^^^^^^^^^^

error[E0658]: use of unstable library feature 'maybe_uninit' (see issue #53491)
   --> /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/emacs-0.12.3/src/error.rs:222:86
    |
222 |         unsafe_raw_call_no_exit!(self, non_local_exit_get, symbol.as_mut_ptr(), data.as_mut_ptr())
    |                                                                                      ^^^^^^^^^^

error: aborting due to 14 previous errors

Some errors occurred: E0425, E0599, E0658.
For more information about an error, try `rustc --explain E0425`.
error: Could not compile `emacs`.

To learn more, run the command again with --verbose.

I am such a beginner I have no idea yet how to proceed. Could you please help me out?

If I try to build the emacs-module-rs directly I get the same errors, prefixed with some warnings:

$ bin/build 
warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable
   Compiling emacs v0.12.3 (/home/jonas/git/pep/emacs-module/emacs-module-rs)
error[E0425]: cannot find function `type_name` in module `any`
  --> src/types/user_ptr.rs:52:14
...
ubolonton commented 4 years ago

What is your Rust's version? You can check it with rustc --version.

Since 0.12.0 emacs-module-rs requires Rust 1.38+.

tarsius commented 4 years ago

Ah... this embarrassing. Exactly the sort of lack of research I sometimes get pissed about when people do it when using things that I have created. Sorry about that. :flushed:

ubolonton commented 4 years ago

No worries. I actually considered adding a compile-time check, for a more helpful error message. This confirms that such a check would be useful.