servo/surfman

rust-offscreen-rendering-context does not link to using libraries

sotaroikeda opened this issue · 9 comments

rust-offscreen-rendering-context became to use dynamic gl context. But by its change, gleam does not link to gl libraries, since it does not link to them. rust-offscreen-rendering-context calls gl library functions like glXGetCurrentContext, but rust-offscreen-rendering-context does not link to necessary gl libraries. It causes link error when building webrender. The functions are used by rust-offscreen-rendering-context, then they should be linked by rust-offscreen-rendering-context.

Error was like the following during building webrender.


/home/sotaro/.cargo/registry/src/github.com-1ecc6299db9ec823/offscreen_gl_context-0.7.0/src/platform/with_glx/native_gl_context.rs:123: undefined reference to glXMakeCurrent' /home/sotaro/github/webrender/target/debug/deps/liboffscreen_gl_context-ab0ed1c72c45482f.rlib(offscreen_gl_context-ab0ed1c72c45482f.0.o): In function offscreen_gl_context::platform::with_glx::native_gl_context::{{impl}}::is_current':
/home/sotaro/.cargo/registry/src/github.com-1ecc6299db9ec823/offscreen_gl_context-0.7.0/src/platform/with_glx/native_gl_context.rs:112: undefined reference to glXGetCurrentContext' /home/sotaro/github/webrender/target/debug/deps/liboffscreen_gl_context-ab0ed1c72c45482f.rlib(offscreen_gl_context-ab0ed1c72c45482f.0.o): In function offscreen_gl_context::platform::with_glx::native_gl_context::{{impl}}::unbind':
/home/sotaro/.cargo/registry/src/github.com-1ecc6299db9ec823/offscreen_gl_context-0.7.0/src/platform/with_glx/native_gl_context.rs:136: undefined reference to `glXMakeCurrent'
collect2: error: ld returned 1 exit status

I'm avoiding linking them just because before that we'd be doubly-linking, which would also fail the build.

Gah, that's such an unfortunate situation.

We do not want to add it again to gleam since gecko does not want the link.

It seem possible to add linking to a library when webrender enables webgl. And current webrender always uses webgl. In future, we could add webgl selection by feature.

It seem possible to add linking to a library when webrender enables webgl. And current webrender always uses webgl. In future, we could add webgl selection by feature.

I changed my mind. It seems better add link to offscreen_gl_context now.

I am going to link to library in gleam, since the link was originally done by gleam. And some crates expects it.

Based on comment in servo/gleam#109, I am going to defer linking to offscreen_gl_context

Addressed by #85.