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

'features' flags does not work #20

Closed
RazrFalcon opened this issue Jul 19, 2018 · 15 comments
Closed

'features' flags does not work #20

RazrFalcon opened this issue Jul 19, 2018 · 15 comments

Comments

@RazrFalcon
Copy link

This one:

        --features <FEATURES>     Space-separated list of features to activate
        --all-features            Activate all available features
        --no-default-features     Do not activate the `default` feature
@anderejd
Copy link
Contributor

Thanks for the report!

I actually did try them on your resvg crate and it seemed to me like it worked as expected. Can you elaborate a bit on "does not work"? :)

@RazrFalcon
Copy link
Author

If you set --all-features it should pull pango, cairo, resvg-qt dependencies. But according to the log - it's not.

@anderejd
Copy link
Contributor

I see the dependencies, pango, cairo and resvg-qt, they are scanned but "not used"...

...
0/4        0/879        0/2    0/0     0/75       ├── cairo-rs v0.4.1
...
0/0        0/1375       0/0    0/0     0/65       │   ├── pango v0.4.0
...
0/0        0/241        0/0    0/0     0/2        ├── resvg-qt v0.3.0 (https://github.com/RazrFalcon/resvg-qt?rev=fd0ed4f#fd0ed4f4)
...

Is this different from your results? I'm on macOS right now.
I might add that I can't build or cargo check --all-features due to 'QT_DIR is not set: NotPresent'.

@RazrFalcon
Copy link
Author

I have an error, so I don't know. According to the log in https://github.com/anderejd/cargo-geiger/issues/19, there are no pango, cairo, etc.

@anderejd
Copy link
Contributor

Do you get the panic when running cargo geiger or cargo geiger --all-features from the crate root too, directly from resvg? (not from resvg/tools/rendersvg).

I suspect that this issue will need to wait until the error handling is sorted out the the panics are resolved.

@RazrFalcon
Copy link
Author

Now I see it. Thanks.

@RazrFalcon
Copy link
Author

But I still have function is never used warnings, which indicates that --all-features was ignored in the process. Maybe this is ok.

@anderejd
Copy link
Contributor

But I still have function is never used warnings, which indicates that --all-features was ignored in the process. Maybe this is ok.

Yeah, I see those warnings here too. They seems to be identical to that warnings that show up when using cargo check or cargo build so that seems consistent with the normal cargo behavior at least.

I don't know if the warnings would go away on this system when adding --all-features since I get the QT_DIR missing error when trying that.

@anderejd
Copy link
Contributor

which indicates that --all-features was ignored in the process.

Ah... Now I get it. Yes. it seems like the normal cargo is doing something different with --all-features. I suspect that the build scripts could be involved in this issue. I'll open new issue for build scripts and reference this issue.

@anderejd
Copy link
Contributor

anderejd commented Jul 19, 2018

This error is reported by cargo check --all-features when running from the root in the resvg crate, on my system:

error: failed to run custom build command for `resvg-qt v0.3.0 (https://github.com/RazrFalcon/resvg-qt?rev=fd0ed4f#fd0ed4f4)`
process didn't exit successfully: `/Users/a/code/resvg/target/debug/build/resvg-qt-c1a47417ecc6dfb6/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'QT_DIR is not set: NotPresent', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

This is expected since this system doesn't have QT_DIR. However, when running cargo geiger --all-features the same error is expected to show up, but isn't. This indicates that either build scripts arn't run or that the --all-features mode has issues in cargo-geiger.

@RazrFalcon
Copy link
Author

However, when running cargo geiger --all-features the same error is expected to show up, but isn't.

--all-features must enable qt-backend, which requires QT_DIR on macOS.

@anderejd
Copy link
Contributor

--all-features must enable qt-backend, which requires QT_DIR on macOS

Yes, I did expect the same error to appear when running cargo geiger with --all-features, but there's no error for me, which makes me suspect that the build scripts are not triggered. Am I being confused? :)

@RazrFalcon
Copy link
Author

RazrFalcon commented Jul 19, 2018

My own cargo-bloat works correctly in this scenario, so I think that this is a geiger bug.

@anderejd
Copy link
Contributor

anderejd commented Jul 19, 2018

My own cargo-bloat works correctly in this scenario, so I think that this is geiger bug.

Yes I agree, I think I'm just failing to express myself in the last ~3 comments. I opened a new issue for suspected build script bugs in cargo-geiger and referenced this discussion as background.

@anderejd
Copy link
Contributor

The original issue was correct all along, the feature flags was not being used correctly. Fixed in master at: anderejd@33771aa

Thanks for the assistance! :)

I still think the build scripts needs to be investigated, but for different reasons, to scan the generated code from bindgen for example.

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

2 participants