servo/rust-opengles

Link error for glVertexAttribDivisor on OS X 10.7.5

lalcmellkmal opened this issue · 6 comments

It seems to be from ES 3.0? Anyway, I just commented it out locally for now.

note: Undefined symbols for architecture x86_64:
  "_glVertexAttribDivisor", referenced from:
      _glVertexAttribDivisor__c_stack_shim in librustopengles.o

+1. I am getting the same error on OS X 10.8.2.

rustc  opengles.rc -o librustopengles.dummy
error: linking with `cc` failed with code 1
note: cc arguments: -L/usr/local/lib/rustc/x86_64-apple-darwin/lib -m64 -o libopengles-94839cbfe144198-0.1.dylib librustopengles.o -L/usr/local/lib/rustc/x86_64-apple-darwin/lib -lcore-c3ca5d77d81b46c1-0.6 -L/usr/local/lib/rustc/x86_64-apple-darwin/lib -lstd-4782a756585a81-0.6 -framework OpenGL -dynamiclib -Wl,-install_name,@rpath/libopengles-94839cbfe144198-0.1.dylib -Wl,-no_compact_unwind -lmorestack -lrustrt -Wl,-rpath,@executable_path/../../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib -Wl,-rpath,/usr/local/lib/rustc/x86_64-apple-darwin/lib -Wl,-rpath,/usr/local/Cellar/rust/0.6/lib/rustc/x86_64-apple-darwin/lib
note: Undefined symbols for architecture x86_64:
  "_glVertexAttribDivisor", referenced from:
      _glVertexAttribDivisor__c_stack_shim in librustopengles.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
make: *** [librustopengles.dummy] Error 101

Something like this might be needed: #37

@metajack I tried that out here: ehsanul@3c2e1b1

Clearly I don't know what I'm doing, I still got the same error:

~/rust/rust-opengles lion-fail:) make clean && ./configure && make
rm -f *.o *.a *.so *.dylib *.dll *.dummy *-test
rustc  --cfg mac_10_7 opengles.rc -o librustopengles.dummy
error: linking with `cc` failed with code 1
note: cc arguments: -L/usr/local/lib/rustc/x86_64-apple-darwin/lib -m64 -o libopengles-94839cbfe144198-0.1.dylib librustopengles.o -L/usr/local/lib/rustc/x86_64-apple-darwin/lib -lcore-c3ca5d77d81b46c1-0.6 -L/usr/local/lib/rustc/x86_64-apple-darwin/lib -lstd-4782a756585a81-0.6 -framework OpenGL -dynamiclib -Wl,-install_name,@rpath/libopengles-94839cbfe144198-0.1.dylib -Wl,-no_compact_unwind -lmorestack -lrustrt -Wl,-rpath,@executable_path/../../../../usr/local/lib/rustc/x86_64-apple-darwin/lib -Wl,-rpath,/usr/local/lib/rustc/x86_64-apple-darwin/lib -Wl,-rpath,/usr/local/Cellar/rust/0.6/lib/rustc/x86_64-apple-darwin/lib
note: Undefined symbols for architecture x86_64:
    "_glVertexAttribDivisor", referenced from:
            _glVertexAttribDivisor__c_stack_shim in librustopengles.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
make: *** [librustopengles.dummy] Error 101

I'm on OS X 10.7.5.

Ok, looks like I just had a misunderstanding of how document attributes work in rust. Quoting: "If any match is found the item is compiled; if no match is found the item is parsed but not compiled."

So when I got rid of the #[cfg(not(mac_10_6))], but kept #[cfg(not(mac_10_7))] from my commit, it compiled successfully for me on 10.7.

I couldn't figure out a way to handle both 10.6 and 10.7 with the conditional attribute system. Something like:

#[cfg(not(mac_10_6 || mac_10_7))]

Or

#[cfg(not(mac_10_6) and not(mac_10_7))]

Ok, I just guessed the syntax a couple of times, and you guys support it obviously :). Fixed here: #38

Your pull request has landed. Closing this.