Code Monkey home page Code Monkey logo

gl-rs's Introduction

gl-rs

Build Status

Overview

This repository contains the necessary building blocks for OpenGL wrapper libraries. For more information on each crate, see their respective READMEs listed below.

The following crates are contained in this repository:

gl

Version License Downloads

README

An OpenGL function pointer loader for the Rust Programming Language.

[dependencies]
gl = "0.14.0"

gl_generator

Version License Downloads

README

Code generators for creating bindings to the Khronos OpenGL APIs.

[build-dependencies]
gl_generator = "0.14.0"

khronos_api

Version License Downloads

README

The Khronos XML API Registry, exposed as byte string constants.

[build-dependencies]
khronos_api = "3.1.0"

Compiling from source

khronos_api makes use of git submodules. You will need to initialize these before building:

git submodule update --init

webgl_generator

Version License Downloads

README

Code generators for creating bindings to the WebGL APIs.

[build-dependencies]
webgl_generator = "0.2.0"

webgl-stdweb

Version License Downloads

README

WebGL bindings using stdweb

[build-dependencies]
webgl_stdweb = "0.3.0"

gl-rs's People

Contributors

alfredr avatar bfops avatar brendanzab avatar bvssvni avatar bzomak avatar csherratt avatar dependabot-preview[bot] avatar dependabot-support avatar diggsey avatar eijebong avatar emberian avatar gmorenz avatar heroesgrave avatar jhasse avatar jonas-schievink avatar jutuon avatar kvark avatar leonkunert avatar msiglreith avatar nathansizemore avatar ozkriff avatar rpjohnst avatar serge-rgb avatar serpis avatar simonsapin avatar tomaka avatar tyoverby avatar xales avatar zeux avatar zokier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gl-rs's Issues

KHR_debug emulation

It is possible with a loader to emulate the key feature of KHR_debug, calling a registered callback when an error occurs. This would mainly be done by generating a wrapper around each GL function that calls glGetError afterward. This blog gives more detailed reasoning and implementation information.

Multiple gl Versions?

For rust-graphics, we need to implement the OpenGL backend for multiple versions of OpenGL. Is there a way to run gl_generator with multiple (or all) versions?

Plans for 1.0?

Syntax extensions won't be part of stable Rust 1.0, which means that gl-rs won't be usable as-is.

I can see three possibilities:

  • Revert the changes to a syntax extension, and use a regular generator again.
  • Manually generate a gl.rs using the syntax extension, and make this file usable with Rust stable.
  • Tell people that gl-rs can't be used with Rust 1.0.

Update to the last rust-nightly (faa7ba7).

This is just to let you know that I have a commit that updates gl-rs to the last rust-nightly here that you might want to cherry-pick some times in the future.

I am not submitting a pull request because it would include some commits that mess with the submodules to use my own forks of glfw-rs and sax-rs.

Pointer-sized integer types

Hi everyone

I am new in rust, so may be I propose some sheet.

Now, in gl-rs the generator matches the pointer-sized integer types (like GLintptr) with types i32 or i64, depending on the platform. This implies platform-dependent fragments in the application code.
You could avoid this by using the int type instead. According to the specification it is sized as a pointer but you don’t need to change it for each platform.

What is your opinion on this?

Does not compile

make lib -C deps/sax-rs
make[1]: Entering directory '/home/{user}/learn-rust/piston/gl-rs/deps/sax-rs'
make[1]: *** No rule to make target 'lib'.  Stop.
make[1]: Leaving directory '/home/{user}/learn-rust/piston/gl-rs/deps/sax-rs'
make: *** [gen-deps] Error 2

Even running the make gen-lib && make -f rust-empty.mk returned the same thing. I assume it's an issue with the formatting of the Makefile.

Build instructions outdated

README.md says that the way to compile this library is by typing make. The Makefile was removed recently, and so that does not work any more. The build instructions should be updated.

Support using `gl_generator` as a stand-alone

There are several things that need to be fixed before someone can use gl_generator outside of gl:

  • Move view items from gl/lib.rs to the code generated by gl_generator.
  • Fix the path to deps/khronos-api/ which is currently relative to gl/lib.rs. (edit: 27b127b)
    This is probably the trickiest point. Should gl_generator call include_bin! on all the xml files of khronos-api (my favorite solution)? Should it store an absolute path to the khronos-api directory during its compilation (I'm not sure that this is reliable)? Should it call git clone/svn clone during the invocation?
  • Define a clear API for gl_generator. (edit: 1bd4257)
    This includes removing the first parameter of gl_generator (it should be deduced from the second) and refactoring the last parameter to take an array instead of a string.
  • Add tests.

There is also a question here: should gl_generator create a module where the symbols are defined, or you should it directly write all functions/constants/etc. in the same module where it is invoked (as it currently does)?

Build failed

I get the following output when trying to build (as a dependency to opengl_graphics)

Could not execute process ./.build.sh (status=2)
--- stdout
make lib -C deps/sax-rs
make[1]: Entering directory '/home/otremblay/.cargo/git/checkouts/gl-rs-1669fe424cfaeccd/master/deps/sax-rs'
mkdir -p lib
rustc --out-dir=lib -O src/sax.rs
make[1]: Leaving directory '/home/otremblay/.cargo/git/checkouts/gl-rs-1669fe424cfaeccd/master/deps/sax-rs'
rustc -L deps/sax-rs/lib src/gen/main.rs -o bin/glrsgen
Makefile:86: recipe for target 'gen' failed
--- stderr
src/sax.rs:162:5: 170:7 warning: use of deprecated item: use .as_ptr(), #[warn(deprecated)] on by default
src/sax.rs:162 src.to_c_str().with_ref(|c_str| {
src/sax.rs:163 let (sender, receiver) = channel();
src/sax.rs:164 unsafe {
src/sax.rs:165 ffi::xmlSAXUserParseMemory(&extfn::new_handler(),
src/sax.rs:166 mem::transmute(&sender),
src/sax.rs:167 c_str, len);
...
src/gen/main.rs:204:25: 204:48 error: cannot index a value of type &str
src/gen/main.rs:204 let ident = if (enm.ident.as_slice()[0] as char).is_digit() {
^~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
make: *** [gen] Error 101

Can't find `deps/khronos-api/gl.xml`

acrichto confirmed on IRC that the current working directory when compiling a package should always be the package's root directory.

This means that if a package depends on gl-rs, then it will try looking for deps/khronos-api/gl.xml in the package's directory and fail to compile.

It should be possible to modify gl_generator to look into the right path, similar to what include_bin! does.

Unknown format trait `c`

generators/struct_gen.rs:161:14: 161:17 error: unknown format trait `c`
generators/struct_gen.rs:161         ns = *ns,
                                          ^~~
generators/struct_gen.rs:220:14: 220:17 error: unknown format trait `c`
generators/struct_gen.rs:220         ns = *ns,
                                          ^~~
error: aborting due to 2 previous errors
Could not compile `gl_generator`.

Doesn't work on Windows without support for recent OpenGL versions

This library works great on my system and another computer that uses Windows 7, but I tried it on a Windows machine with OpenGL drivers that only support up to version 3.1, and I got the error "opengl profile requested but WGL_ARB_create_context_profile is unavailable". Other games that use OpenGL (Minecraft, a game I made using LWJGL, etc) work fine, so I'm guessing the problem has something to do with this library.

I'm using essentially the same initialization code as the static_triangle example, and I'm pretty sure I'm not doing anything that would require an OpenGL version newer than 3.1.

Add Rust-Empty as 'rust-empty.mk' to allow flat workspace

The latest version of Rust-Empty supports custom entry files. This will make it easier to integrate with the Piston infrastructure. This will not affect the existing way of building, but some extra filters might be added to .gitignore.

Rust-Empty supports one executable and one library per repository, so the generator can be executed before building the library.

Add a "compiletime" generator

Calling egl::load_with or wgl::load_with makes no sense. We need a generator that creates regular bindings that are linked at compile-time.

Travis CI is for opengl_graphics is failing on gl-rs

$ cargo build
Updating git repository `https://github.com/bjz/gl-rs`
Updating git repository `https://github.com/PistonDevelopers/rust-image`
Updating git repository `https://github.com/PistonDevelopers/rust-graphics`
Compiling gl v0.0.1 (https://github.com/bjz/gl-rs)
Could not execute process `./.build.sh` (status=2)

Perhaps add a chmod +x .build.sh?

Opengl versioning.

Looking at #31 and @cmr #32 I am wondering if there is a way to use the create_id to differentiate between the different opengl versions.

It's currently for all branches

#[crate_id = "github.com/bjz/gl-rs#gl:0.1"];

There maybe there is some clever way to use this.

// opengl 4.0
#[crate_id = "github.com/bjz/gl-rs#gl:4.0"];
// opengl 2.1
#[crate_id = "github.com/bjz/gl-rs#gl:2.1"];

This is not a problem I am currently facing; I am just curious if the crate_id is powerful enough to do the work for us.

"warning: literal out of range for its type" on 32 bit systems

I think this has to do with 32 bit systems (I only get this warning on Windows):

src\gl\lib.rs:132:37: 132:55 warning: literal out of range for its type, #[warn(type_overflow)] on by default
src\gl\lib.rs:132 pub static TIMEOUT_IGNORED: GLenum = 0xFFFFFFFFFFFFFFFF;
                                                       ^~~~~~~~~~~~~~~~~~

Problem compiling

lib.rs:89:5: 89:19 error: unresolved import `syntax::ptr::P`. Could not find `ptr` in `syntax`.
lib.rs:89 use syntax::ptr::P;
              ^~~~~~~~~~~~~~

Supply -L libxml2.lib on Windows

The linker is getting -lxml2 which is causing it to search for libxml2.a, which isn't available on Windows. I can't even find it for Linux. I think LibXML would need to be built specifically to output the .a version, and it's not necessarily simple to build.

libxml2.lib is available for Windows but the linker doesn't want to look for it. So it needs to be supplied with the correct argument.

I'm not sure if it's rustc that's doing this or the makefile but this is currently not building on Windows.

cargo build output:

C:\Users\Austin\Documents\GitHub\gl-rs>cargo build
       Fresh sax-rs v0.0.1 (https://github.com/bjz/sax-rs)
   Compiling gl_generator v0.0.1 (file:C:\Users\Austin\Documents\GitHub\gl-rs)
Could not execute process `rustc src\gl_generator.rs --crate-name gl_generator -
-crate-type dylib -C metadata=gl_generator:-:0.0.1:-:file:C:\Users\Austin\Docume
nts\GitHub\gl-rs -C extra-filename=-90e4e7200f31b7b7 --out-dir C:\Users\Austin\D
ocuments\GitHub\gl-rs\target\deps -L C:\Users\Austin\Documents\GitHub\gl-rs\targ
et\deps -L C:\Users\Austin\Documents\GitHub\gl-rs\target\deps --extern sax=C:\Us
ers\Austin\Documents\GitHub\gl-rs\target\deps/libsax-87020080d427910b.rlib` (sta
tus=101)
--- stderr
error: linking with `gcc` failed: exit code: 1
note: gcc '-m32' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\l
ib' '-o' 'C:\Users\Austin\Documents\GitHub\gl-rs\target\deps\gl_generator-90e4e7
200f31b7b7.dll' 'C:\Users\Austin\Documents\GitHub\gl-rs\target\deps\gl_generator
-90e4e7200f31b7b7.o' '-Wl,--whole-archive' '-lmorestack' '-Wl,--no-whole-archive
' 'C:\Users\Austin\Documents\GitHub\gl-rs\target\deps\gl_generator-90e4e7200f31b
7b7.metadata.o' '-shared-libgcc' '-Wl,--enable-long-section-names' '-L' 'C:\Prog
ram Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-lrustc-4e7c5e5c' '-L' 'C
:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-ltime-4e7c5e5c' '-
L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-lgraphviz-4e7
c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-lrus
tc_llvm-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\
lib' '-larena-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mi
ngw32\lib' '-lrustc_back-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib
\i686-pc-mingw32\lib' '-lflate-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\r
ustlib\i686-pc-mingw32\lib' '-lgetopts-4e7c5e5c' '-L' 'C:\Program Files (x86)\Ru
st\bin\rustlib\i686-pc-mingw32\lib' '-lsyntax-4e7c5e5c' '-L' 'C:\Program Files (
x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-lfmt_macros-4e7c5e5c' '-L' 'C:\Prog
ram Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-lterm-4e7c5e5c' '-L' 'C:
\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-ldebug-4e7c5e5c' '-
L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-lserialize-4e
7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib' '-llo
g-4e7c5e5c' 'C:\Users\Austin\Documents\GitHub\gl-rs\target\deps\libsax-87020080d
427910b.rlib' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\lib'
 '-lstd-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-mingw32\
lib' '-lsync-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\i686-pc-min
gw32\lib' '-lrustrt-4e7c5e5c' '-L' 'C:\Users\Austin\Documents\GitHub\gl-rs\targe
t\deps' '-L' 'C:\Users\Austin\Documents\GitHub\gl-rs\src\gl_generator\.rust' '-L
' 'C:\Users\Austin\Documents\GitHub\gl-rs\src\gl_generator' '-Wl,-Bdynamic' '-ls
hell32' '-lpsapi' '-limagehlp' '-lm' '-lstdc++' '-lkernel32' '-lxml2' '-lgcc_s'
'-shared' '-lcompiler-rt'
note: c:/program files (x86)/mingw-builds/x32-4.8.1-win32-dwarf-rev5/mingw32/bin
/../lib/gcc/i686-w64-mingw32/4.8.1/../../../../i686-w64-mingw32/bin/ld.exe: cann
ot find -lxml2
collect2.exe: error: ld returned 1 exit status

error: aborting due to previous error

Investigate using RustyXML to generate loader

It would be nice if we could remove our dependency on glloadgen. It is mighty hard to keep up to date with the mercurial repository and the architecture of the lib is rather complex to work with. Also, with the new XML API registry, this will be much easier than with the old .spec files.

I have been recently attempting to use libxml2, but it's been a pain. Thankfully it seems @Florob has created RustyXML which could serve our purposes nicely. It would also be a good test of RustyXML if we could get it working.

We would need to be able to generate two loaders:

  • A loader that uses static muts to store function pointers, with a failing function set as the default.
  • A loader that stores the function pointers in a GL struct. Each field would have a bool showing whether the function was successfully loaded or not. This could be used for managing multiple contexts in the same application.

Have pregenerated bindings for older OpenGL versions.

Not everybody has the latest hardware, and using the generator can be a bit of a pain if you don't have scripts for it, so I think there needs to be some pre-generated versions for the more 'major' OpenGL versions.

I'm not that familiar with which ones are common, but I think something like the following:

  • The latest version.
  • OpenGL 3.3
  • OpenGL 3.1
  • OpenGL 3.0
  • OpenGL 2.1

generated interface different between 32 and 64 bit platforms

I've written some code that uses gl::BufferData. On Linux 64 bit the buffer size parameter is i64 but on Windows 32 bit it's i32. It seems like the size parameter should actually be int (or uint even) so that calling code is portable between 32 and 64 bit architectures.

Add fallbacks for identical but renamed functions

Many functions exist as glFooEXT or glFooARB before being named glFoo. There's a C library that does this, and I thought it was Waffle, but it isn't, so I'm not sure what the prior art is. We'll probably need to curate our own mapping. I'm working on this.

Quote expansion warnings

Even rust-xml is updated, I get the same quote expansion warnings of this kind (netvl/xml-rs#34):

<quote expansion>:654:39: 654:48 warning: \U00ABCD12 and \uABCD escapes are deprecated
<quote expansion>:654                     '\U000e0100' ...'\U000e01ef' => true,
                                                            ^~~~~~~~~
<quote expansion>:654:39: 654:48 help: use \u{ABCD12} escapes instead
<quote expansion>:654                     '\U000e0100' ...'\U000e01ef' => true,
                                                            ^~~~~~~~~

Cargo says it compiles Compiling xml-rs v0.1.2 (https://github.com/netvl/xml-rs#8e68b6cf)

What is going on here?

Can't install using cargo-lite

$ cargo-lite install --git https://github.com/bjz/gl-rs.git
note: Inferred pkgname gl-rs from path https://github.com/bjz/gl-rs.git
error: The build command for gl-rs failed with exit code 101
error: 

  RAN: './.build.sh'

  STDOUT:
make lib -C deps/sax-rs
make[1]: Entering directory `/home/jhasse/.rust/src/gl-rs/deps/sax-rs'
make[1]: Leaving directory `/home/jhasse/.rust/src/gl-rs/deps/sax-rs'


  STDERR:
make[1]: *** No rule to make target `lib'.  Stop.
make: *** [gen-deps] Error 2
error: couldn't read src/gl/lib.rs: no such file or directory (No such file or directory)
error: make[1]: *** No rule to make target `lib'.  Stop.
make: *** [gen-deps] Error 2
error: couldn't read src/gl/lib.rs: no such file or directory (No such file or directory)

Missing gl.xml for Cargo build

Cargo does not seem to do a submodule update when I try to build gl-rs. I think we have to force cargo to do a submodule update.

Steps To Reproduce

git clone https://github.com/bjz/gl-rs
cargo build

Output

   Compiling sax-rs v0.0.1 (https://github.com/bjz/sax-rs)
   Compiling gl_generator v0.0.1 (file:/home/colin/Source/gl-rs)
   Compiling gl v0.0.1 (file:/home/colin/Source/gl-rs)
src/lib.rs:38:1: 38:49 error: couldn't open file (no such file or directory (No such file or directory); path=deps/khronos-api/gl.xml; mode=open; access=read)
src/lib.rs:38 generate_gl_bindings!("gl", "gl", "core", "4.3")
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not execute process `rustc src/lib.rs --crate-name gl --crate-type lib -C metadata=gl:-:0.0.1:-:file:/home/colin/Source/gl-rs -C extra-filename=-b892937f05034225 --out-dir /home/colin/Source/gl-rs/target -L /home/colin/Source/gl-rs/target -L /home/colin/Source/gl-rs/target/deps --extern gl_generator=/home/colin/Source/gl-rs/target/deps/libgl_generator-d72ff9e48f84526f.so` (status=101)

Where does the preprocesor get invoked?

I've been browsing through the code to try to understand it, but I've ran into a question I can't seem to figure out. The XML specifications needs to have a C preprocessor to run over it, where is that preprocessor invoked? I can't seem to find anything related to the preprocessesor before consume_registry, and that seems to be already reading the XML.

Unable to checkout '...' in submodule path 'deps/khronos-api'

Building gl-init-rs (has gl-rs as dependency) fails with

    Updating git repository `https://github.com/bjz/gl-rs`
fatal: reference is not a tree: 31765e5b0d656812d4f700cbedaa09baf10a7c5a
Unable to checkout '31765e5b0d656812d4f700cbedaa09baf10a7c5a' in submodule path 'deps/khronos-api'
Unable to update https://github.com/bjz/gl-rs

and cargo build for gl-rs fails with

cargo build
    Updating git repository `https://github.com/netvl/rust-xml`
   Compiling rust-xml v0.1.0 (https://github.com/netvl/rust-xml#74d77462)
   Compiling gl_generator v0.0.1 (file:///home/manuel/dev/gl-rs)
   Compiling gl v0.0.1 (file:///home/manuel/dev/gl-rs)
src/gl/lib.rs:35:1: 35:94 error: couldn't open file (no such file or directory (No such file or directory); path=/home/manuel/dev/gl-rs/deps/khronos-api/gl.xml; mode=open; access=read)
src/gl/lib.rs:35 generate_gl_bindings!("gl", "core", "4.5", "static", [ "GL_EXT_texture_filter_anisotropic" ])
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `gl`.

Static loader is unsafe

Scenario:

Thread 1              |  Thread 2
========              |  ========
driver1::make_current |
gl::load_with         |
                      |  driver2::make_current
                      |  gl::Begin() // crash!

In general, loading GL functions can be thread-specific, and only the struct loader can deal with this. Every function in the static loader should be marked unsafe, and it should be heavily discouraged.

generation of glfw submodule breaking?

building with latest nightly, I get the "expected int but found i32" errors, that were fixed in a recent commit to glfw-rs by changing "repr(C)" to "repr(i32)".

Apparently the deps/glfw-rs/src/glfw.rs file is auto-generated, and is being given the out-of-date "repr(C)" annotation on its enums. But I don't know how to fix that. Is there a cached rlib somewhere that needs removed? or is there just something that needs updated here.

Cargo always marks this as dirty

This is probably a rustc and not a gl-rs problem but I wanted to make an issue here to track the issue for whom it is going to be most effected. gl-rs is always marked as dirty by cargo because rustc does not mark the files it depends on correctly.

The root of the problem is shown here:

> rustc src/lib.rs --dep-info tmp  --no-analysis --no-trans -L target/deps/
> cat tmp 
libgl.rlib: src/lib.rs unknown

src/lib.rs is correct but unknown is not. This causes cargo to mark gl-rs as dirty since it can't check of a file that does not exist is up to date or not.

Generators is_numeric method error

I am receiving this error on compilation. Using cargo build with 0.13.0.nightly.

generators/mod.rs:23:54: 23:66 error: type char does not implement any method in scope named is_numeric
generators/mod.rs:23 let ident = if (enm.ident.as_slice().char_at(0)).is_numeric() {
^~~~~~~~~~~~
error: aborting due to previous error
Could not compile gl_generator.

glrsgen doesn't work on Windows

(gdb) run --xml deps/khronos-api/gl.xml
Starting program: d:\Baczyslaw\progz\rust\piston-workspace\gl-rs/bin/glrsgen.exe --xml deps/khronos-api/gl.xml
[New Thread 6340.0x2cb8]

Program received signal SIGSEGV, Segmentation fault.
0x6805b0f6 in strsep () from C:\Program Files (x86)\Git\bin\msys-1.0.dll
(gdb) bt
#0  0x6805b0f6 in strsep () from C:\Program Files (x86)\Git\bin\msys-1.0.dll
#1  0x6802cfe9 in msys-1.0!calloc ()
   from C:\Program Files (x86)\Git\bin\msys-1.0.dll
#2  0x68094e7c in wctype () from C:\Program Files (x86)\Git\bin\msys-1.0.dll
#3  0x6802cd50 in msys-1.0!malloc ()
   from C:\Program Files (x86)\Git\bin\msys-1.0.dll
#4  0x70e6f622 in xmlNewMutex () from c:\MinGW\bin\msys-xml2-2.dll
#5  0x70e32724 in xmlInitMemory () from c:\MinGW\bin\msys-xml2-2.dll
#6  0x70e207ec in xmlInitParser () from c:\MinGW\bin\msys-xml2-2.dll
#7  0x0049984a in parse_str::closure.3746 ()
#8  0x0054662d in one::Once::doit::h714768cedc4a4b4aK9b::v0.11.0.pre ()
#9  0x004994a9 in parse_str::h2f464349d6bc4373fZa::v0.1 ()
#10 0x0040378f in registry::RegistryBuilder::parse::haae85b4af3e271b1Spa::v0.1
    ()
#11 0x0040367a in registry::Registry::from_xml::h003bee27738626d3vfa::v0.1 ()
#12 0x0044a1f3 in main::hf878778f1f103e9aUSb::v0.1 ()
#13 0x0048b938 in start::closure.7234 ()
#14 0x0054e29c in task::Task::run::closure.5416 ()
#15 0x00550595 in unwind::try::try_fn::h1fe867e1154595bbSqd::v0.11.0.pre ()
#16 0x00551c16 in rust_try ()
#17 0x00550415 in unwind::try::h07a76d9a36570aebvod::v0.11.0.pre ()
#18 0x0054e05e in task::Task::run::hce4db6be7cbaab92fTc::v0.11.0.pre ()
#19 0x0048b7c6 in start::h702fffe28bf59d87jye::v0.11.0.pre ()
#20 0x0048b661 in lang_start::h092be248edef1c25Dxe::v0.11.0.pre ()
#21 0x0044a3d0 in main ()
(gdb)

library versions:

libxml2-2.7.6-1-msys-1.0.13
libiconv-1.14-1-msys-1.0.17
libcharset-1.14-1-msys-1.0.17

Failure building gl_generator

I have no idea if this is an issue with gl-rs or with my build environment, but any assistance would be great!

Rust Version

rustc 0.12.0-pre-nightly (f50e4ee559c0e6253e9d46a8e6763e25f7b90d90 2014-07-18 00:01:22 +0000)

Cargo Version

cargo-nightly 0.1.0-pre (fa13929 2014-07-19 01:08:05 +0000)

cargo build

    Updating git repository `https://github.com/PistonDevelopers/rust-graphics.git`
    Updating git repository `https://github.com/PistonDevelopers/glfw_game_window.git`
    Updating git repository `https://github.com/PistonDevelopers/piston`
    Updating git repository `https://github.com/PistonDevelopers/opengl_graphics.git`
    Updating git repository `https://github.com/bjz/glfw-rs`
    Updating git repository `https://github.com/bjz/gl-rs`
    Updating git repository `https://github.com/bjz/sax-rs`
    Updating git repository `https://github.com/PistonDevelopers/rust-image`
   Compiling image v0.0.0 (https://github.com/PistonDevelopers/rust-image)
       Fresh piston v0.0.0 (https://github.com/PistonDevelopers/piston)
       Fresh graphics v0.0.0 (https://github.com/PistonDevelopers/rust-graphics.git)
       Fresh glfw v0.0.1 (https://github.com/bjz/glfw-rs)
       Fresh sax-rs v0.0.1 (https://github.com/bjz/sax-rs)
   Compiling gl_generator v0.0.1 (https://github.com/bjz/gl-rs)
Build failed, waiting for other jobs to finish...
Could not execute process `rustc src/gl_generator.rs --crate-name gl_generator --crate-type dylib -C metadata=gl_generator:-:0.0.1:-:https://github.com/bjz/gl-rs -C extra-filename=-0b27c215b798fc73 --out-dir /home/ty/workspace/rust/Piston-Tutorial/target/deps -L /home/ty/workspace/rust/Piston-Tutorial/target/deps -L /home/ty/workspace/rust/Piston-Tutorial/target/deps --extern sax=/home/ty/workspace/rust/Piston-Tutorial/target/deps/libsax-a002b9f722ac6474.rlib` (status=101)

--- stderr
src/gl_generator.rs:163:29: 163:42 warning: use of deprecated item: prefer using indexing, e.g., vec[0], #[warn(deprecated)] on by default
src/gl_generator.rs:163         expr_to_string(ecx, values.get(0).clone(), "expected string literal").map(|e| match e { (s, _) => s.get().to_string() }),
                                                    ^~~~~~~~~~~~~
src/gl_generator.rs:164:29: 164:42 warning: use of deprecated item: prefer using indexing, e.g., vec[0], #[warn(deprecated)] on by default
src/gl_generator.rs:164         expr_to_string(ecx, values.get(1).clone(), "expected string literal").map(|e| match e { (s, _) => s.get().to_string() }),
                                                    ^~~~~~~~~~~~~
src/gl_generator.rs:165:29: 165:42 warning: use of deprecated item: prefer using indexing, e.g., vec[0], #[warn(deprecated)] on by default
src/gl_generator.rs:165         expr_to_string(ecx, values.get(2).clone(), "expected string literal").map(|e| match e { (s, _) => s.get().to_string() }),
                                                    ^~~~~~~~~~~~~
src/gl_generator.rs:166:29: 166:42 warning: use of deprecated item: prefer using indexing, e.g., vec[0], #[warn(deprecated)] on by default
src/gl_generator.rs:166         expr_to_string(ecx, values.get(3).clone(), "expected string literal").map(|e| match e { (s, _) => s.get().to_string() }),
                                                    ^~~~~~~~~~~~~
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-o' '/home/ty/workspace/rust/Piston-Tutorial/target/deps/libgl_generator-0b27c215b798fc73.so' '/home/ty/workspace/rust/Piston-Tutorial/target/deps/gl_generator.o' '-Wl,--whole-archive' '-lmorestack' '-Wl,--no-whole-archive' '/home/ty/workspace/rust/Piston-Tutorial/target/deps/gl_generator.metadata.o' '-nodefaultlibs' '-Wl,--as-needed' '/home/ty/workspace/rust/Piston-Tutorial/target/deps/libsax-a002b9f722ac6474.rlib' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lrustc-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lgraphviz-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-ltime-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lrustc_back-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lsyntax-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lterm-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lserialize-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-llog-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lrustc_llvm-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-larena-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lflate-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-ldebug-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lfmt_macros-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lgetopts-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lstd-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lsync-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lrustrt-4e7c5e5c' '-L' '/home/ty/workspace/rust/Piston-Tutorial/target/deps' '-L' '/home/ty/.cargo/git/checkouts/gl-rs-1669fe424cfaeccd/master/src/gl_generator/.rust' '-L' '/home/ty/.cargo/git/checkouts/gl-rs-1669fe424cfaeccd/master/src/gl_generator' '-Wl,-Bdynamic' '-lxml2' '-lrt' '-lpthread' '-lrt' '-ldl' '-lm' '-lstdc++' '-ldl' '-lpthread' '-lgcc_s' '-lpthread' '-lc' '-lm' '-shared' '-lcompiler-rt'
note: /usr/bin/ld: cannot find -lxml2
collect2: error: ld returned 1 exit status

Rust HEAD compiler bug when building gl

Just a heads up more than anything. Trying to build anything of the Piston stack ends up hitting the gl package and crashing. I'm relatively new to Rust so I'm not sure how to pair down what exactly the compiler doesn't like but maybe you can pinpoint this quicker?

I'm on Mac OS X 10.9. Rust built from rust-lang/rust@36131f5

roelofs@Trillian:~/Development/rust/piston/gl-rs (master)
] RUST_BACKTRACE=1 cargo build --verbose
    Updating git repository `https://github.com/bjz/glfw-rs`
    Updating git repository `https://github.com/netvl/rust-xml`
    Updating git repository `https://github.com/rust-lang/semver`
     Running `rustc src/lib.rs --crate-name xml --crate-type lib -C metadata=7318f524c11b08da -C extra-filename=-7318f524c11b08da --out-dir /Users/roelofs/Development/rust/piston/gl-rs/target/deps --dep-info /Users/roelofs/Development/rust/piston/gl-rs/target/.fingerprint/rust-xml-7318f524c11b08da/dep-lib-xml -L /Users/roelofs/Development/rust/piston/gl-rs/target/deps -L /Users/roelofs/Development/rust/piston/gl-rs/target/deps`
     Running `rustc lib.rs --crate-name gl_generator --crate-type dylib -C metadata=9c839233faf7935f -C extra-filename=-9c839233faf7935f --out-dir /Users/roelofs/Development/rust/piston/gl-rs/target/deps --dep-info /Users/roelofs/Development/rust/piston/gl-rs/target/.fingerprint/gl_generator-9c839233faf7935f/dep-lib-gl_generator -L /Users/roelofs/Development/rust/piston/gl-rs/target/deps -L /Users/roelofs/Development/rust/piston/gl-rs/target/deps --extern xml=/Users/roelofs/Development/rust/piston/gl-rs/target/deps/libxml-7318f524c11b08da.rlib --extern khronos_api=/Users/roelofs/Development/rust/piston/gl-rs/target/deps/libkhronos_api-9ad43b83a4f5be98.rlib`
     Running `rustc /Users/roelofs/Development/rust/piston/gl-rs/src/khronos_api/src/lib.rs --crate-name khronos_api --crate-type lib -C metadata=9ad43b83a4f5be98 -C extra-filename=-9ad43b83a4f5be98 --out-dir /Users/roelofs/Development/rust/piston/gl-rs/target/deps --dep-info /Users/roelofs/Development/rust/piston/gl-rs/target/.fingerprint/khronos_api-9ad43b83a4f5be98/dep-lib-khronos_api -L /Users/roelofs/Development/rust/piston/gl-rs/target/deps -L /Users/roelofs/Development/rust/piston/gl-rs/target/deps`
     Running `rustc src/gl/lib.rs --crate-name gl --crate-type lib -C metadata=0f50a76ab0218212 -C extra-filename=-0f50a76ab0218212 --out-dir /Users/roelofs/Development/rust/piston/gl-rs/target --dep-info /Users/roelofs/Development/rust/piston/gl-rs/target/.fingerprint/gl-0f50a76ab0218212/dep-lib-gl -L /Users/roelofs/Development/rust/piston/gl-rs/target -L /Users/roelofs/Development/rust/piston/gl-rs/target/deps --extern gl_generator=/Users/roelofs/Development/rust/piston/gl-rs/target/deps/libgl_generator-9c839233faf7935f.dylib`
       Fresh rust-xml v0.1.0 (https://github.com/netvl/rust-xml#3a3f37e7)
       Fresh khronos_api v0.0.1 (file:///Users/roelofs/Development/rust/piston/gl-rs)
       Fresh gl_generator v0.0.1 (file:///Users/roelofs/Development/rust/piston/gl-rs)
   Compiling gl v0.0.1 (file:///Users/roelofs/Development/rust/piston/gl-rs)
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 56 but the index is 101', /private/tmp/rust-ti9GlH/src/libsyntax/lib.rs:1

stack backtrace:
   1:        0x112226915 - rt::backtrace::imp::write::h707bc57c4049722cyGr
   2:        0x112229ae3 - failure::on_fail::h55d1d7ac493f7330rXr
   3:        0x1124f1b95 - unwind::begin_unwind_inner::h1c25a930baf814afufe
   4:        0x1124f17cb - unwind::begin_unwind_fmt::h63f035d370d79728Uce
   5:        0x1124f1622 - rust_begin_unwind
   6:        0x1125400cc - failure::begin_unwind::h88305ef830828471nAk
   7:        0x112546dd6 - failure::fail_bounds_check::hb03765f0e0dd4420zyk
   8:        0x11938ac62 - util::interner::StrInterner::get::h0e781b8a051c9525Zpa
   9:        0x1193a0b88 - ast::Name::as_str::h580a9d395f90dde8cPb
  10:        0x11944c4c0 - parse::parser::Parser<'a>::lit_from_token::he90de202977ed234SvM
  11:        0x119450c0c - parse::parser::Parser<'a>::parse_lit::h3d685eed3727c168WxM
  12:        0x11945482c - parse::parser::Parser<'a>::parse_bottom_expr::hdfcc5411568cd26fsPM
  13:        0x119459d87 - parse::parser::Parser<'a>::parse_dot_or_call_expr::hfc7380c0f166e28267M
  14:        0x11945ced9 - parse::parser::Parser<'a>::parse_prefix_expr::hdae9395a0730e1ee0pN
  15:        0x11945d8f7 - parse::parser::Parser<'a>::parse_binops::hb9b82865ffafd6devwN
  16:        0x11945e21d - parse::parser::Parser<'a>::parse_assign_expr::hff4328011a73503cYzN
  17:        0x1194c186b - ext::base::get_exprs_from_tts::h8ffec2cd7f6c0f70su4
  18:        0x11769b7b7 - parse_macro_arguments::hf61e7512da1cd07d5cd
  19:        0x117682a58 - macro_handler::h9f2d1d7e7e382f40V2c
  20:        0x110531a13 - ext::base::BasicMacroExpander.TTMacroExpander::expand::hfc38e0801b525d2d4Y3
  21:        0x1105ce46c - ext::expand::expand_item_mac::h6734795168f1a4de2Qa
  22:        0x1105cbb28 - ext::expand::expand_item::hfb3ba13aba409890JIa
  23:        0x1105d3a83 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_item::hae346ad85c05575c1ub
  24:        0x1105d3a1c - fold::noop_fold_mod::closure.52082
  25:        0x110567aab - iter::Iterator::collect::h8724619765003732602
  26:        0x1105d2f6c - fold::Folder::fold_mod::h5506224055224769546
  27:        0x11060a062 - ext::expand::expand_crate::h79c351cc4ef29555Uxb
  28:        0x10f8877ca - driver::driver::phase_2_configure_and_expand::closure.134535
  29:        0x10f67ec17 - driver::driver::phase_2_configure_and_expand::ha0b3e956958afd03NYz
  30:        0x10f83ff54 - driver::driver::compile_input::hd160577e6e11aff9eSz
  31:        0x10f8e9aa2 - driver::run_compiler::h41a80a311e303b3f8pD
  32:        0x10f8e8186 - driver::main_args::closure.137869
  33:        0x10f8fa1ab - task::TaskBuilder<S>::try_future::closure.138986
  34:        0x10f8fa0b5 - task::TaskBuilder<S>::spawn_internal::closure.138963
  35:        0x1120e0a5c - task::spawn_opts::closure.8429
  36:        0x112555c8c - rust_try_inner
  37:        0x112555c76 - rust_try
  38:        0x1124eef6b - unwind::try::h4f40e0e711b8b6ebK3d
  39:        0x1124eed0b - task::Task::run::h6d860cfd31ac4c87Bad
  40:        0x1120e08ba - task::spawn_opts::closure.8374
  41:        0x1124f0b26 - thread::thread_start::h178e748fc71cabc9nzd
  42:     0x7fff96c38899 - _pthread_body
  43:     0x7fff96c3872a - _pthread_struct_init

Could not compile `gl`.

Caused by:
  Process didn't exit successfully: `rustc src/gl/lib.rs --crate-name gl --crate-type lib -C metadata=0f50a76ab0218212 -C extra-filename=-0f50a76ab0218212 --out-dir /Users/roelofs/Development/rust/piston/gl-rs/target --dep-info /Users/roelofs/Development/rust/piston/gl-rs/target/.fingerprint/gl-0f50a76ab0218212/dep-lib-gl -L /Users/roelofs/Development/rust/piston/gl-rs/target -L /Users/roelofs/Development/rust/piston/gl-rs/target/deps --extern gl_generator=/Users/roelofs/Development/rust/piston/gl-rs/target/deps/libgl_generator-9c839233faf7935f.dylib` (status=101)

Problems with building `khronos_api`

rustc 0.13.0-nightly (399ff259e 2014-11-20 00:27:07 +0000)

/Users/sven/rust/gl-rs/src/khronos_api/src/lib.rs:4:36: 4:66 error: couldn't read /Users/sven/rust/gl-rs/src/khronos_api/api/gl.xml: couldn't open file (no such file or directory (No such file or directory); path=/Users/sven/rust/gl-rs/src/khronos_api/api/gl.xml; mode=open; access=read)
/Users/sven/rust/gl-rs/src/khronos_api/src/lib.rs:4 pub static GL_XML: &'static [u8] = include_bin!("../api/gl.xml");
                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sven/rust/gl-rs/src/khronos_api/src/lib.rs:7:37: 7:68 error: couldn't read /Users/sven/rust/gl-rs/src/khronos_api/api/egl.xml: couldn't open file (no such file or directory (No such file or directory); path=/Users/sven/rust/gl-rs/src/khronos_api/api/egl.xml; mode=open; access=read)
/Users/sven/rust/gl-rs/src/khronos_api/src/lib.rs:7 pub static EGL_XML: &'static [u8] = include_bin!("../api/egl.xml");
                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sven/rust/gl-rs/src/khronos_api/src/lib.rs:10:37: 10:68 error: couldn't read /Users/sven/rust/gl-rs/src/khronos_api/api/wgl.xml: couldn't open file (no such file or directory (No such file or directory); path=/Users/sven/rust/gl-rs/src/khronos_api/api/wgl.xml; mode=open; access=read)
/Users/sven/rust/gl-rs/src/khronos_api/src/lib.rs:10 pub static WGL_XML: &'static [u8] = include_bin!("../api/wgl.xml");
                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sven/rust/gl-rs/src/khronos_api/src/lib.rs:13:37: 13:68 error: couldn't read /Users/sven/rust/gl-rs/src/khronos_api/api/glx.xml: couldn't open file (no such file or directory (No such file or directory); path=/Users/sven/rust/gl-rs/src/khronos_api/api/glx.xml; mode=open; access=read)
/Users/sven/rust/gl-rs/src/khronos_api/src/lib.rs:13 pub static GLX_XML: &'static [u8] = include_bin!("../api/glx.xml");
                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 4 previous errors
Build failed, waiting for other jobs to finish...
Could not compile `khronos_api`.

Catch failures in gl_generator

A failure while parsing the XML or generating the bindings would trigger an ICE.
Failures should be catched by spawning a task and outputting a proper compilation error.

RFC: Add a trait to load the OpenGL functions

In addition to gl::load_with, add a gl::load function that takes a trait:

trait GlFunctionsSource {
    fn get_proc_addr(&self, &str) -> *const ();
}

That would allow the library to be used with gl::load(&glfw), gl::load(&sdl) or gl::load(&glutin).

The trait would need to be defined in its own crate (for example gl_common) in order to be usable by gl_generator.

Keep load_with for retro-compatibility and deprecate it as soon as glfw, sdl and glutin implement the trait.

Alternatives

Implement the trait GlFunctionsSource for |&str| -> *const () in order to be retro-compatible. Unfortunately you can only invoke closures with a &mut self, so that would require changing the trait.

Drawbacks

This requires glfw, glutin and sdl2 to depend on gl_common in order to implement the trait.

This also creates a new crate just for this.

Getting errors when using crates.io dependency

This blocks "pistoncore-sdl2_window" and "pistoncore-glfw_window" from being published at crates.io

Perhaps create a branch "crates.io"?

Errors:

registry.rs:301:17: 301:38 error: `events::StartDocument` does not name a structure
registry.rs:301                 events::StartDocument{..} => (),
                                ^~~~~~~~~~~~~~~~~~~~~
registry.rs:302:17: 302:32 error: unresolved enum variant, struct or const `Comment`
registry.rs:302                 events::Comment(_) => (),
                                ^~~~~~~~~~~~~~~
registry.rs:303:17: 303:35 error: unresolved enum variant, struct or const `Whitespace`
registry.rs:303                 events::Whitespace(_) => (),
                                ^~~~~~~~~~~~~~~~~~
registry.rs:304:17: 304:36 error: unresolved enum variant, struct or const `EndDocument`
registry.rs:304                 events::EndDocument => panic!("The end of the document has been reached"),
                                ^~~~~~~~~~~~~~~~~~~
registry.rs:305:17: 305:30 error: unresolved enum variant, struct or const `Error`
registry.rs:305                 events::Error(err) => panic!("XML error: {}", err),
                                ^~~~~~~~~~~~~
registry.rs:315:13: 315:31 error: unresolved enum variant, struct or const `Characters`
registry.rs:315             events::Characters(ref ch) => ch.clone(),
                            ^~~~~~~~~~~~~~~~~~
registry.rs:322:13: 322:33 error: `events::StartElement` does not name a structure
registry.rs:322             events::StartElement{ref name, ref attributes, ..}
                            ^~~~~~~~~~~~~~~~~~~~
registry.rs:330:13: 330:31 error: `events::EndElement` does not name a structure
registry.rs:330             events::EndElement{ref name} if n == name.local_name.as_slice() => (),
                            ^~~~~~~~~~~~~~~~~~
registry.rs:338:17: 338:36 error: unresolved enum variant, struct or const `EndDocument`
registry.rs:338                 events::EndDocument => panic!("Expected {}, but reached the end of the document.",
                                ^~~~~~~~~~~~~~~~~~~
registry.rs:360:17: 360:35 error: unresolved enum variant, struct or const `Characters`
registry.rs:360                 events::Characters(_) | events::Comment(_) => (),
                                ^~~~~~~~~~~~~~~~~~
registry.rs:360:41: 360:56 error: unresolved enum variant, struct or const `Comment`
registry.rs:360                 events::Characters(_) | events::Comment(_) => (),
                                                        ^~~~~~~~~~~~~~~
registry.rs:361:17: 361:37 error: `events::StartElement` does not name a structure
registry.rs:361                 events::StartElement{ref name, ..}
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:363:41: 363:59 error: `events::EndElement` does not name a structure
registry.rs:363                         self.skip_until(events::EndElement { name: name.clone() }),
                                                        ^~~~~~~~~~~~~~~~~~
registry.rs:364:17: 364:37 error: `events::StartElement` does not name a structure
registry.rs:364                 events::StartElement{ref name, ..}
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:366:41: 366:59 error: `events::EndElement` does not name a structure
registry.rs:366                         self.skip_until(events::EndElement { name: name.clone() }),
                                                        ^~~~~~~~~~~~~~~~~~
registry.rs:369:17: 369:37 error: `events::StartElement` does not name a structure
registry.rs:369                 events::StartElement{ref name, ..} if name.local_name.as_slice() == "groups" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:372:29: 372:49 error: `events::StartElement` does not name a structure
registry.rs:372                             events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "group" => {
                                            ^~~~~~~~~~~~~~~~~~~~
registry.rs:377:29: 377:47 error: `events::EndElement` does not name a structure
registry.rs:377                             events::EndElement{ref name} if name.local_name.as_slice() == "groups" => break,
                                            ^~~~~~~~~~~~~~~~~~
registry.rs:384:17: 384:37 error: `events::StartElement` does not name a structure
registry.rs:384                 events::StartElement{ref name, ..} if name.local_name.as_slice() == "enums" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:389:17: 389:37 error: `events::StartElement` does not name a structure
registry.rs:389                 events::StartElement{ref name, ..} if name.local_name.as_slice() == "commands" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:395:17: 395:37 error: `events::StartElement` does not name a structure
registry.rs:395                 events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "feature" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:400:17: 400:37 error: `events::StartElement` does not name a structure
registry.rs:400                 events::StartElement{ref name, ..} if name.local_name.as_slice() == "extensions" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:403:29: 403:49 error: `events::StartElement` does not name a structure
registry.rs:403                             events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "extension" => {
                                            ^~~~~~~~~~~~~~~~~~~~
registry.rs:406:29: 406:47 error: `events::EndElement` does not name a structure
registry.rs:406                             events::EndElement{ref name} if name.local_name.as_slice() == "extensions" => break,
                                            ^~~~~~~~~~~~~~~~~~
registry.rs:413:17: 413:35 error: `events::EndElement` does not name a structure
registry.rs:413                 events::EndElement{ref name} if name.local_name.as_slice() == "registry" => break,
                                ^~~~~~~~~~~~~~~~~~
registry.rs:511:17: 511:37 error: `events::StartElement` does not name a structure
registry.rs:511                 events::StartElement{ref name, ref attributes, ..} => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:531:17: 531:35 error: `events::EndElement` does not name a structure
registry.rs:531                 events::EndElement{ref name} => {
                                ^~~~~~~~~~~~~~~~~~
registry.rs:556:17: 556:37 error: `events::StartElement` does not name a structure
registry.rs:556                 events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "enum" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:560:17: 560:35 error: `events::EndElement` does not name a structure
registry.rs:560                 events::EndElement{ref name} if name.local_name.as_slice() == "group" => break,
                                ^~~~~~~~~~~~~~~~~~
registry.rs:575:17: 575:35 error: unresolved enum variant, struct or const `Characters`
registry.rs:575                 events::Characters(_) | events::Comment(_) => (),
                                ^~~~~~~~~~~~~~~~~~
registry.rs:575:41: 575:56 error: unresolved enum variant, struct or const `Comment`
registry.rs:575                 events::Characters(_) | events::Comment(_) => (),
                                                        ^~~~~~~~~~~~~~~
registry.rs:576:17: 576:37 error: `events::StartElement` does not name a structure
registry.rs:576                 events::StartElement{ref name, ..} if name.local_name.as_slice() == "unused" =>
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:577:37: 577:55 error: `events::EndElement` does not name a structure
registry.rs:577                     self.skip_until(events::EndElement{name: name.clone()}),
                                                    ^~~~~~~~~~~~~~~~~~
registry.rs:580:17: 580:37 error: `events::StartElement` does not name a structure
registry.rs:580                 events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "enum" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:593:17: 593:35 error: `events::EndElement` does not name a structure
registry.rs:593                 events::EndElement{ref name} if name.local_name.as_slice() == "enums" => break,
                                ^~~~~~~~~~~~~~~~~~
registry.rs:607:17: 607:37 error: `events::StartElement` does not name a structure
registry.rs:607                 events::StartElement{ref name, ..} if name.local_name.as_slice() == "command" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:621:17: 621:35 error: `events::EndElement` does not name a structure
registry.rs:621                 events::EndElement{ref name} if name.local_name.as_slice() == "commands" => break,
                                ^~~~~~~~~~~~~~~~~~
registry.rs:641:17: 641:37 error: `events::StartElement` does not name a structure
registry.rs:641                 events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "param" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:646:17: 646:37 error: `events::StartElement` does not name a structure
registry.rs:646                 events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "alias" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:651:17: 651:37 error: `events::StartElement` does not name a structure
registry.rs:651                 events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "vecequiv" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:655:17: 655:37 error: `events::StartElement` does not name a structure
registry.rs:655                 events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "glx" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:664:17: 664:35 error: `events::EndElement` does not name a structure
registry.rs:664                 events::EndElement{ref name} if name.local_name.as_slice() == "command" => break,
                                ^~~~~~~~~~~~~~~~~~
registry.rs:685:17: 685:35 error: unresolved enum variant, struct or const `Characters`
registry.rs:685                 events::Characters(ch) => ty.push_str(ch.as_slice()),
                                ^~~~~~~~~~~~~~~~~~
registry.rs:686:17: 686:37 error: `events::StartElement` does not name a structure
registry.rs:686                 events::StartElement{ref name, ..} if name.local_name.as_slice() == "ptype" => (),
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:687:17: 687:35 error: `events::EndElement` does not name a structure
registry.rs:687                 events::EndElement{ref name} if name.local_name.as_slice() == "ptype" => (),
                                ^~~~~~~~~~~~~~~~~~
registry.rs:688:17: 688:37 error: `events::StartElement` does not name a structure
registry.rs:688                 events::StartElement{ref name, ..} if name.local_name.as_slice() == "name" => break,
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:700:17: 700:35 error: unresolved enum variant, struct or const `Characters`
registry.rs:700                 events::Characters(ch) => ty.push_str(ch.as_slice()),
                                ^~~~~~~~~~~~~~~~~~
registry.rs:701:17: 701:35 error: `events::EndElement` does not name a structure
registry.rs:701                 events::EndElement{ref name} if name.local_name.as_slice() == outside_tag => break,
                                ^~~~~~~~~~~~~~~~~~
registry.rs:780:17: 780:37 error: `events::StartElement` does not name a structure
registry.rs:780                 events::StartElement{ref name, ref attributes, ..} if name.local_name.as_slice() == "require" => {
                                ^~~~~~~~~~~~~~~~~~~~
registry.rs:783:17: 783:35 error: `events::EndElement` does not name a structure
registry.rs:783                 events::EndElement{ref name} if name.local_name.as_slice() == "extension" => break,
                                ^~~~~~~~~~~~~~~~~~
error: aborting due to 50 previous errors
Could not compile `gl_generator`.

Can't build on Windows 8

Found this out when building the doom viewer cristicbz/rust-doom#2

$ cargo build --verbose
Fresh sdl2 v0.0.1-alpha.1 (https://github.com/cristicbz/rust-sdl2?ref=sta
tic_to_const#c8c36cb6)
Fresh khronos_api v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
Fresh rust-xml v0.1.0 (https://github.com/netvl/rust-xml#f86f02b3)
Fresh toml v0.1.0 (https://github.com/alexcrichton/toml-rs#8a3ba4c6)
Compiling gl_generator v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
Running rustc lib.rs --crate-name gl_generator --crate-type dylib -g -C me tadata=cda8351b0c2935af -C extra-filename=-cda8351b0c2935af --out-dir E:\Games\r ust-doom\target\deps --dep-info E:\Games\rust-doom\target\.fingerprint\gl_genera tor-cda8351b0c2935af\dep-lib-gl_generator -L E:\Games\rust-doom\target\deps -L E :\Games\rust-doom\target\deps --extern khronos_api=E:\Games\rust-doom\target\dep s/libkhronos_api-76f01477ab0f76eb.rlib --extern xml=E:\Games\rust-doom\target\de ps/libxml-759dae9327f1df3d.rlib
error: linking with gcc failed: exit code: 1
note: gcc '-m64' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw3
2\lib' '-o' 'E:\Games\rust-doom\target\deps\gl_generator-cda8351b0c2935af.dll' '
E:\Games\rust-doom\target\deps\gl_generator-cda8351b0c2935af.o' '-Wl,--whole-arc
hive' '-lmorestack' '-Wl,--no-whole-archive' 'E:\Games\rust-doom\target\deps\gl_
generator-cda8351b0c2935af.metadata.o' '-fno-lto' '-fno-use-linker-plugin' '-sta
tic-libgcc' '-Wl,--enable-long-section-names' '-Wl,--nxcompat' 'E:\Games\rust-do
om\target\deps\libkhronos_api-76f01477ab0f76eb.rlib' 'E:\Games\rust-doom\target
deps\libxml-759dae9327f1df3d.rlib' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib
\x86_64-w64-mingw32\lib' '-lrustc-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bi
n\rustlib\x86_64-w64-mingw32\lib' '-lrustc_llvm-4e7c5e5c' '-L' 'C:\Program Files
(x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lgraphviz-4e7c5e5c' '-L' 'C:\P
rogram Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-ltime-4e7c5e5c' '-
L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lflate-4e7
c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-l
getopts-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw
32\lib' '-lrustc_back-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x8
6_64-w64-mingw32\lib' '-lsyntax-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin
rustlib\x86_64-w64-mingw32\lib' '-larena-4e7c5e5c' '-L' 'C:\Program Files (x86)
Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-ldebug-4e7c5e5c' '-L' 'C:\Program Fil
es (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lrbml-4e7c5e5c' '-L' 'C:\Pro
gram Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lserialize-4e7c5e5c'
'-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lfmt_ma
cros-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32
lib' '-lterm-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-
mingw32\lib' '-llog-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_
64-w64-mingw32\lib' '-lregex-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rus
tlib\x86_64-w64-mingw32\lib' '-lstd-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust
bin\rustlib\x86_64-w64-mingw32\lib' '-lsync-4e7c5e5c' '-L' 'C:\Program Files (x8
6)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lrustrt-4e7c5e5c' '-L' 'E:\Games\r
ust-doom\target\deps' '-L' 'E:\Games\rust-doom\target\deps' '-L' 'C:\Users\yuv.
cargo\git\checkouts\gl-rs-5020f97825182d66\master\src\gl_generator.rust' '-L' '
C:\Users\yuv.cargo\git\checkouts\gl-rs-5020f97825182d66\master\src\gl_generator
' '-Wl,--whole-archive' '-Wl,-Bstatic' '-Wl,--no-whole-archive' '-Wl,-Bdynamic'
'-lshell32' '-lpsapi' '-limagehlp' '-lm' '-lstdc++' '-lkernel32' '-shared' '-lco
mpiler-rt'
note: E:\Games\rust-doom\target\deps\gl_generator-cda8351b0c2935af.o: file not r
ecognized: File format not recognized
collect2.exe: error: ld returned 1 exit status

error: aborting due to previous error
Could not compile gl_generator.

Caused by:
Process didn't exit successfully: rustc lib.rs --crate-name gl_generator --cr ate-type dylib -g -C metadata=cda8351b0c2935af -C extra-filename=-cda8351b0c2935 af --out-dir E:\Games\rust-doom\target\deps --dep-info E:\Games\rust-doom\target \.fingerprint\gl_generator-cda8351b0c2935af\dep-lib-gl_generator -L E:\Games\rus t-doom\target\deps -L E:\Games\rust-doom\target\deps --extern khronos_api=E:\Gam es\rust-doom\target\deps/libkhronos_api-76f01477ab0f76eb.rlib --extern xml=E:\Ga mes\rust-doom\target\deps/libxml-759dae9327f1df3d.rlib -Awarnings (status=101)

type `&str` does not implement any method in scope named `to_string`

Hey, just thought I'd let you know that upon 'make'ing this, rustc picked up a heap of 'to_string()' call errors that seem to be deprecated? A handful of them were in lib.rs of the sax dep (most were unnecessary calls, some should be to_str instead) and i'm just about to go through more of them in src/gen/registry.rs and src/gen/main.rs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.