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

uchar.h is missing on macOS #423

Closed
mbrobbel opened this issue Dec 3, 2019 · 13 comments · Fixed by #424
Closed

uchar.h is missing on macOS #423

mbrobbel opened this issue Dec 3, 2019 · 13 comments · Fixed by #424
Labels

Comments

@mbrobbel
Copy link

mbrobbel commented Dec 3, 2019

We're using cbindgen to generate both C and C++ headers in our project. However, the generated C header fails to build on macOS with the 0.10.1 release (QE-Lab/dqcsim#313) because uchar.h is missing on macOS.

target/include/dqcsim.h:5:10: fatal error: 'uchar.h' file not found
#include <uchar.h>
         ^~~~~~~~~
@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

What header defines char32_t? Is it built-in?

@emilio emilio added the bug label Dec 3, 2019
@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

(Sorry, I don't have a mac so I cannot test that myself)

@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

cc @adrianwong. Maybe we should just switch to uint32_t for now?

@mbrobbel
Copy link
Author

mbrobbel commented Dec 3, 2019

What header defines char32_t? Is it built-in?

I think there is no header available, and it's not built-in unfortunately. Something like this should work I guess:

#ifdef __APPLE__
#include <stdint.h>
typedef uint16_t char16_t;
typedef uint32_t char32_t;
#else
#include <uchar.h>
#endif

@laser
Copy link

laser commented Dec 3, 2019

This issue also impacted our Darwin builds once we updated cbindgen from 0.10.0 to 0.10.1.

emilio added a commit to emilio/cbindgen that referenced this issue Dec 3, 2019
emilio added a commit to emilio/cbindgen that referenced this issue Dec 3, 2019
This is technically a breaking change for C++, unfortunately.

Fixes mozilla#423.
@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

Ok, I put up #424 for this. I decided to use uint32_t because I also think it's needed for correctness, see the comment in the code there.

@adrianwong
Copy link
Contributor

@emilio Yeah, uint32_t seems like it'll be the most appropriate type to use. The build for #424 has some test failures, which I'm happy to try fixing as this is a bug I introduced.

@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

The tests in that PR seem unrelated to the change, I think it's a rust nightly change / regression (they're the cargo-expand tests, which require nightly)

emilio added a commit to emilio/cbindgen that referenced this issue Dec 3, 2019
This is technically a breaking change for C++, unfortunately.

Fixes mozilla#423.
@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

Ah no, I just forgot to run the tests locally as I had a stable compiler. Should be green now :)

@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

(But thanks a lot for the offer @adrianwong!)

@adrianwong
Copy link
Contributor

adrianwong commented Dec 3, 2019

Thanks for fixing this @emilio! And apologies all for not testing the <uchar.h> changes on macOS.

@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

No worries, I can't test it on mac myself either, and the CI situation there is not amazing (though may be better now? We should investigate adding Mac to our CI if possible).

Thanks for being responsive (and to the reporters for the fast issue-filing :)).

emilio added a commit that referenced this issue Dec 3, 2019
This is technically a breaking change for C++, unfortunately.

Fixes #423.
@emilio
Copy link
Collaborator

emilio commented Dec 3, 2019

Landed that and published v0.11.0, as it is technically a breaking change for C++ bindings unfortunately.

benma added a commit to benma/bitbox02-firmware that referenced this issue Feb 7, 2020
benma added a commit to benma/bitbox02-firmware that referenced this issue Feb 10, 2020
benma added a commit to benma/bitbox02-firmware that referenced this issue Feb 10, 2020
jaseemabid added a commit to jaseemabid/inc that referenced this issue Feb 22, 2020
uchar.h is not present on mac and this header broke all builds.

Ref mozilla/cbindgen#423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants