Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Bindgen can't find stddef.h #71

Open
jdm opened this issue Nov 15, 2017 · 10 comments
Open

Bindgen can't find stddef.h #71

jdm opened this issue Nov 15, 2017 · 10 comments

Comments

@jdm
Copy link
Member

jdm commented Nov 15, 2017

From servo/servo#19129 (comment):

error: failed to run custom build command for `gecko-media v0.1.0 (https://github.com/servo/gecko-media.git#0299b455)`
process didn't exit successfully: `/home/anholt/src/servo/servo/target/release/build/gecko-media-59486aef098dd7b4/build-script-build` (exit code: 101)

[...]

--- stderr
gecko/glue/include/GeckoMedia.h:10:10: fatal error: 'stddef.h' file not found
gecko/glue/include/GeckoMedia.h:10:10: fatal error: 'stddef.h' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', /checkout/src/libcore/result.rs:906:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Any suggestions?

@jdm
Copy link
Member Author

jdm commented Nov 15, 2017

(This is a linux builder)

@ferjm
Copy link
Contributor

ferjm commented Nov 15, 2017

Is this on Ubuntu? IIRC bindgen uses clang, so could it be https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1242300 ?

@MortimerGoro
Copy link

I have Ubuntu 16.04, and had this problem just running bindgen from CLI to manually generate some bindings. I think that it dependes on both the bindgen version and installed clang version: I have the problem on my desktop but not on the laptop (both 16.04)

I have not tried yet to build the latest Servo.

@anholt
Copy link

anholt commented Nov 15, 2017

I'm on debian unstable. I see lots of the referenced types of symlinks from that bug report that do point to directories containing stddef.h. This will probably need a giant strace to figure out what's missing.

@jonleighton
Copy link

I have encountered this problem too, on Fedora.

@BruceDai
Copy link

I tried to install clang on my PC on Ubuntu 16.04.3 LTS with Intel CPU, my reported #19300 was fixed, and I can build servo successfully. I'm not sure whether my solution works for this issue.

@jonleighton
Copy link

I ran with strace -f, here is the relevant output:

[pid  9764] open("/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/stddef.h", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  9764] open("/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/x86_64-redhat-linux/stddef.h", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  9764] open("/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/backward/stddef.h", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  9764] open("/usr/local/include/stddef.h", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  9764] open("/usr/include/stddef.h", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  9764] open("gecko/glue/include/stddef.h", O_RDONLY) = -1 ENOENT (No such file or directory)

The file is located at /usr/lib/gcc/x86_64-redhat-linux/7/include/stddef.h on my system.

I've no idea how to make it work, but perhaps this info helps...

@jonleighton
Copy link

Ok, finally I have been able to solve this on my system. The solution is embarrassing: when @BruceDai reported that he solved it by installing clang, I got confused between clang and cmake. I ended up verifying that cmake was installed, and then concluding that his solution didn't work for me.

So anyway, I have some more details. On Fedora, there is a clang-libs package, and a separate clang package. I had clang-libs installed but not clang. clang-libs provides, AFAICT, libclang. libclang is used by bindgen (via clang-sys) to parse the header files in order to generate the bindings. When libclang is invoked, it ends up looking for stddef.h, but fails to find it. On Fedora, the clang package contains the file /usr/lib64/clang/4.0.1/include/stddef.h, and once the clang package is installed, libclang is able to find the file.

I feel like somewhere along this chain, something should be shouting louder about the problem/solution, but I'm not exactly sure where that responsibility lies. Maybe in clang-sys? (cc @KyleMayes in case you have input on this.)

bors-servo pushed a commit to servo/servo that referenced this issue Nov 26, 2017
Add clang packages for non-debian linuxes.

Per servo/gecko-media#71 (comment).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19353)
<!-- Reviewable:end -->
bors-servo pushed a commit to servo/servo that referenced this issue Nov 26, 2017
Add clang packages for non-debian linuxes.

Per servo/gecko-media#71 (comment).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19353)
<!-- Reviewable:end -->
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Nov 27, 2017
… servo:jdm-patch-7); r=KiChjang

Per servo/gecko-media#71 (comment).

Source-Repo: https://github.com/servo/servo
Source-Revision: 10e5ae2c65575aeea4681a89da8ba6aead23af54

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 527e88303ca768901dd1c2f68eae77916f0c574e
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this issue Nov 28, 2017
… servo:jdm-patch-7); r=KiChjang

Per servo/gecko-media#71 (comment).

Source-Repo: https://github.com/servo/servo
Source-Revision: 10e5ae2c65575aeea4681a89da8ba6aead23af54
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this issue Nov 28, 2017
… servo:jdm-patch-7); r=KiChjang

Per servo/gecko-media#71 (comment).

Source-Repo: https://github.com/servo/servo
Source-Revision: 10e5ae2c65575aeea4681a89da8ba6aead23af54
@anholt
Copy link

anholt commented Dec 1, 2017

Similarly, I had libclang-3.9 on debian, but not clang itself.

@vks
Copy link

vks commented Jan 18, 2018

Also see rsmpi/rsmpi#1 (comment) for possibly fixing this issue by adding some pathes to C_INCLUDE_PATH.

gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 2, 2019
… servo:jdm-patch-7); r=KiChjang

Per servo/gecko-media#71 (comment).

Source-Repo: https://github.com/servo/servo
Source-Revision: 10e5ae2c65575aeea4681a89da8ba6aead23af54

UltraBlame original commit: f9be9bd0f9e255bcb698654505ce42a10511e5d9
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
… servo:jdm-patch-7); r=KiChjang

Per servo/gecko-media#71 (comment).

Source-Repo: https://github.com/servo/servo
Source-Revision: 10e5ae2c65575aeea4681a89da8ba6aead23af54

UltraBlame original commit: f9be9bd0f9e255bcb698654505ce42a10511e5d9
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 2, 2019
… servo:jdm-patch-7); r=KiChjang

Per servo/gecko-media#71 (comment).

Source-Repo: https://github.com/servo/servo
Source-Revision: 10e5ae2c65575aeea4681a89da8ba6aead23af54

UltraBlame original commit: f9be9bd0f9e255bcb698654505ce42a10511e5d9
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants