servo: macOS ld considers libscript-*.rlib to be invalid

Cannot build Servo with latest master (2a594821ba) on macOS 10.14.6

(This is my first time to see this kind of compilation error 🤔 I’ve tried to run ./mach clean but it didn’t help 😕)

Check the error message in this gist 👈

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 25 (24 by maintainers)

Commits related to this issue

Most upvoted comments

0650fc3199 compiles. Add this patch triggers the link issue. It needs to be 3 enum fields:

diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs                                 
index d536b52d0b..c2dfcc279b 100644
--- a/components/canvas/webgl_thread.rs
+++ b/components/canvas/webgl_thread.rs
@@ -1873,6 +1873,7 @@ impl WebGLImpl {
                 offset as isize,
                 size as isize,
             ),
+            _ => {}
         }
         // If debug asertions are enabled, then check the error state.                                            
diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs                                 
index 077a2e737b..bb3531969e 100644
--- a/components/canvas_traits/webgl.rs
+++ b/components/canvas_traits/webgl.rs
@@ -474,6 +474,9 @@ pub enum WebGLCommand {
     GetUniformFloat4(WebGLProgramId, i32, WebGLSender<[f32; 4]>),                                                 
     GetUniformFloat9(WebGLProgramId, i32, WebGLSender<[f32; 9]>),                                                 
     GetUniformFloat16(WebGLProgramId, i32, WebGLSender<[f32; 16]>),                                               
+    GetUniformFloat3x2(WebGLProgramId, i32, WebGLSender<[f32; 3 * 2]>),                                           
+    GetUniformFloat3x4(WebGLProgramId, i32, WebGLSender<[f32; 3 * 4]>),                                           
+    GetUniformFloat4x2(WebGLProgramId, i32, WebGLSender<[f32; 4 * 2]>),                                           
     GetUniformBlockIndex(WebGLProgramId, String, WebGLSender<u32>),                                               
     GetUniformIndices(WebGLProgramId, Vec<String>, WebGLSender<Vec<u32>>),                                        
     GetActiveUniforms(WebGLProgramId, Vec<u32>, u32, WebGLSender<Vec<i32>>),                   ```

Size change:

# works
> ls -l ./target/debug/deps/libscript-652a3ed15b7acd06.rlib
4282598440 ./target/debug/deps/libscript-652a3ed15b7acd06.rlib      

# doesn’t work
> ls -l ./target/debug/deps/libscript-652a3ed15b7acd06.rlib
4323269602 ./target/debug/deps/libscript-652a3ed15b7acd06.rlib  

I’ll make a patch today then, thanks.

That patch seems reasonable to me, although I agree with @eddyb that we should probably match clang. I suspect that darwin was added after we implemented all the archive stuff in rustc, and clang probably uses the darwin kind to LLVM as well.

This appears to be mac-specific. I’m on 10.14.6 as well and haven’t observed this problem for reasons that are unclear to me.

Release build works without any errors