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

Possible use of "two different versions of crate core_foundation_sys" #96

Closed
zeyonaut opened this issue Jan 20, 2019 · 7 comments
Closed

Comments

@zeyonaut
Copy link

zeyonaut commented Jan 20, 2019

I'm on macOS, with Rust stable-x86_64-apple-darwin.

I cloned the repo, and cargo buildfailed, giving me:

error[E0271]: type mismatch resolving `<core_foundation::string::CFString as core_foundation::base::TCFType>::Ref == *const core_foundation_sys::string::__CFString`           
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:74:50                                                 
   |                                                                                                                                                                           
74 |             let family_attr: CFString = unsafe { TCFType::wrap_under_get_rule(kCTFontFamilyNameAttribute) };                                                              
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |                                                                                                                                                                           
   = note: expected type `*const core_foundation::string::__CFString`                                                                                                          
              found type `*const core_foundation_sys::string::__CFString`                                                                                                      
note: Perhaps two different versions of crate `core_foundation_sys` are being used?                                                                                            
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:74:50                                                 
   |                                                                                                                                                                           
74 |             let family_attr: CFString = unsafe { TCFType::wrap_under_get_rule(kCTFontFamilyNameAttribute) };                                                              
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                 
                                                                                                                                                                               
error[E0271]: type mismatch resolving `<core_foundation::string::CFString as core_foundation::base::TCFType>::Ref == *const core_foundation_sys::string::__CFString`           
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:76:50                                                 
   |                                                                                                                                                                           
76 |             let traits_attr: CFString = unsafe { TCFType::wrap_under_get_rule(kCTFontTraitsAttribute) };                                                                  
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |                                                                                                                                                                           
   = note: expected type `*const core_foundation::string::__CFString`                                                                                                          
              found type `*const core_foundation_sys::string::__CFString`                                                                                                      
note: Perhaps two different versions of crate `core_foundation_sys` are being used?                                                                                            
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:76:50                                                 
   |                                                                                                                                                                           
76 |             let traits_attr: CFString = unsafe { TCFType::wrap_under_get_rule(kCTFontTraitsAttribute) };                                                                  
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                     
                                                                                                                                                                               
error[E0271]: type mismatch resolving `<core_foundation::string::CFString as core_foundation::base::TCFType>::Ref == *const core_foundation_sys::string::__CFString`           
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:77:59                                                 
   |                                                                                                                                                                           
77 |             let symbolic_traits_attr: CFString = unsafe { TCFType::wrap_under_get_rule(kCTFontSymbolicTrait) };                                                           
   |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::string::__CFString`, found struct `core_foundation_sys::string::__CFString`
   |                                                                                                                                                                           
   = note: expected type `*const core_foundation::string::__CFString`                                                                                                          
              found type `*const core_foundation_sys::string::__CFString`                                                                                                      
note: Perhaps two different versions of crate `core_foundation_sys` are being used?                                                                                            
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:77:59                                                 
   |                                                                                                                                                                           
77 |             let symbolic_traits_attr: CFString = unsafe { TCFType::wrap_under_get_rule(kCTFontSymbolicTrait) };                                                           
   |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                              
                                                                                                                                                                               
error[E0308]: mismatched types                                                                                                                                                 
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:85:50                                                 
   |                                                                                                                                                                           
85 |             font_descriptor::new_from_attributes(&attributes)                                                                                                             
   |                                                  ^^^^^^^^^^^ expected struct `core_foundation::dictionary::CFDictionary`, found a different struct `core_foundation::dictionary::CFDictionary`
   |                                                                                                                                                                           
   = note: expected type `&core_foundation::dictionary::CFDictionary<core_foundation::string::CFString, core_foundation::base::CFType>` (struct `core_foundation::dictionary::CFDictionary`)
              found type `&core_foundation::dictionary::CFDictionary<core_foundation::string::CFString, core_foundation::base::CFType>` (struct `core_foundation::dictionary::CFDictionary`)
note: Perhaps two different versions of crate `core_foundation` are being used?                                                                                                
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:85:50                                                 
   |                                                                                                                                                                           
85 |             font_descriptor::new_from_attributes(&attributes)                                                                                                             
   |                                                  ^^^^^^^^^^^                                                                                                              
                                                                                                                                                                               
error[E0599]: no method named `as_concrete_TypeRef` found for type `&core_text::font_descriptor::CTFontDescriptor` in the current scope                                        
  --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:95:54                                                 
   |                                                                                                                                                                           
95 |                 CTFontDescriptorCopyAttribute(config.as_concrete_TypeRef(), kCTFontURLAttribute);                                                                         
   |                                                      ^^^^^^^^^^^^^^^^^^^                                                                                                  
   |                                                                                                                                                                           
   = help: items from traits can only be used if the trait is in scope                                                                                                         
   = note: the following trait is implemented but not in scope, perhaps add a `use` for it:                                                                                    
           `use core_foundation::base::TCFType;`                                                                                                                               
                                                                                                                                                                               
error[E0599]: no method named `as_concrete_TypeRef` found for type `&mut core_text::font_descriptor::CTFontDescriptor` in the current scope                                    
   --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:128:26                                               
    |                                                                                                                                                                          
128 |                 property.as_concrete_TypeRef(),                                                                                                                          
    |                          ^^^^^^^^^^^^^^^^^^^                                                                                                                             
    |                                                                                                                                                                          
    = help: items from traits can only be used if the trait is in scope                                                                                                        
    = note: the following trait is implemented but not in scope, perhaps add a `use` for it:                                                                                   
            `use core_foundation::base::TCFType;`                                                                                                                              
                                                                                                                                                                               
error[E0271]: type mismatch resolving `<core_foundation::array::CFArray<core_text::font_descriptor::CTFontDescriptor> as core_foundation::base::TCFType>::Ref == *const core_foundation_sys::array::__CFArray`
   --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:131:13                                               
    |                                                                                                                                                                          
131 |             TCFType::wrap_under_create_rule(descs)                                                                                                                       
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `core_foundation::array::__CFArray`, found struct `core_foundation_sys::array::__CFArray`             
    |                                                                                                                                                                          
    = note: expected type `*const core_foundation::array::__CFArray`                                                                                                           
               found type `*const core_foundation_sys::array::__CFArray`                                                                                                       
note: Perhaps two different versions of crate `core_foundation_sys` are being used?                                                                                            
   --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:131:13                                               
    |                                                                                                                                                                          
131 |             TCFType::wrap_under_create_rule(descs)                                                                                                                       
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                       
                                                                                                                                                                               
error[E0599]: no method named `map` found for type `core_foundation::array::CFArrayIterator<'_, core_text::font_descriptor::CTFontDescriptor>` in the current scope            
   --> /Users/Home/.cargo/git/checkouts/azul-dependencies-70bb1f94316762f9/2e1783a/fschutt.font-loader-0.8.0/src/macos.rs:135:14                                               
    |                                                                                                                                                                          
135 |             .map(|desc| desc.family_name())                                                                                                                              
    |              ^^^                                                                                                                                                         
    |                                                                                                                                                                          
    = note: the method `map` exists but the following trait bounds were not satisfied:                                                                                         
            `core_foundation::array::CFArrayIterator<'_, core_text::font_descriptor::CTFontDescriptor> : std::iter::Iterator`                                                  
            `&mut core_foundation::array::CFArrayIterator<'_, core_text::font_descriptor::CTFontDescriptor> : std::iter::Iterator`                                             
                                                                                                                                                                               
error: aborting due to 8 previous errors                                                                                                                                       
                                                                                                                                                                               
Some errors occurred: E0271, E0308, E0599.                                                                                                                                     
For more information about an error, try `rustc --explain E0271`.                                                                                                              
error: Could not compile `font-loader`.                                                                                                                                        
warning: build failed, waiting for other jobs to finish...
error: build failed                 

The hints, as you might see, seem to suggest multiple versions of the CoreFoundation library being used. I'm not versed enough in Rust to know if this is true.

Nightly has the same issue.

This probably isn't relevant, but I might as well include it for completion:

warning: use of deprecated item 'core::str::<impl str>::trim_right_matches': superseded by `trim_end_matches`
    --> azul-css-parser/src/css_parser.rs:1450:41
     |
1450 |         Ok(QuoteStripped(quote_contents.trim_right_matches("\"")))
     |                                         ^^^^^^^^^^^^^^^^^^
     |
     = note: #[warn(deprecated)] on by default

warning: use of deprecated item 'core::str::<impl str>::trim_right_matches': superseded by `trim_end_matches`
    --> azul-css-parser/src/css_parser.rs:1456:41
     |
1456 |         Ok(QuoteStripped(quote_contents.trim_right_matches("'")))
     |                                         ^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'core::str::<impl str>::trim_left_matches': superseded by `trim_start_matches`
   --> azul-css-parser/src/css.rs:437:23
    |
437 |     let value = value.trim_left_matches(START_BRACE);
    |                       ^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'core::str::<impl str>::trim_right_matches': superseded by `trim_end_matches`
   --> azul-css-parser/src/css.rs:438:23
    |
438 |     let value = value.trim_right_matches(END_BRACE);
    |                       ^^^^^^^^^^^^^^^^^^
@Narigo
Copy link

Narigo commented Jan 24, 2019

I've tried to fix it by changing versions in the various vendored dependencies over here: https://github.com/maps4print/azul-dependencies/pull/1

I could start a simple App on Mac (see my example code - mostly the hot reload example, but without the cat) to show this:
image

@fschutt fschutt closed this as completed Jan 24, 2019
@fschutt
Copy link
Owner

fschutt commented Jan 24, 2019

Oh wow it actually works on a Mac? I honestly didn't expect that after what happened with #5. Do you have any other issues with resizing (or did they magically solve themselves now just by upgrading webrender)? Thanks for looking into this - I expected the CI for Mac to catch this, but it's not always very reliable.

@fschutt
Copy link
Owner

fschutt commented Jan 24, 2019

Reopening because it's not fixed yet in azul, only in the dependencies

@fschutt fschutt reopened this Jan 24, 2019
@Narigo
Copy link

Narigo commented Jan 24, 2019

Reopening because it's not fixed yet in azul, only in the dependencies

Yes, I've used a path to the dependencies to test this.

On Mac, I experience some flashing, especially when resizing and I'm unsure if the hover effect is really working correctly. I can see the orange part getting yellow, but moving the mouse around seems to let it flash a bit. There might also be an issue with Retina displays: When the app opens on a regular monitor, it does not show all of what you see above, it's about only the left half of it, resizing it shows a bit more. Still, it's not the best experience, but I actually just wanted to try out the API and see a bit for myself if I could create a GUI with Rust... :)

@Yatekii
Copy link
Contributor

Yatekii commented Jan 24, 2019

Did you compile in release mode? The hot reloading of the CSS somehow would make things flicker in debug mode in the past.

@Narigo
Copy link

Narigo commented Jan 24, 2019

I've used cargo run... When using cargo run --release, the flickering is really better. The hover effect seems to be working as well when compiling as --release. When I resize the window, it's still a bit odd (scaling while dragging and a redraw with a flash when done).

When doing cargo run --release, I could also compile glium without having to comment out the debug_assert!() line and the whole app started @fschutt - However:

  1. It looks like using cargo run --release removes the ability to hot reload
  2. The app starts with a black screen on the retina display and only resizing (on the retina display) or moving the window to my secondary (non-retina) display makes it appear

So I'd keep the "fix" removing the debug_assert line in glium, especially because of the missing hot reload otherwise.

@nicoburns
Copy link

@Narigo The odd behaviour when resizing is probably due to this known issue in winit: rust-windowing/winit#219

I believe it's considered a high-priority issue, but the fix involves refactoring the core event loop of winit.

fschutt added a commit that referenced this issue May 13, 2019
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

5 participants