jeremyletang / rgtk

GTK+ bindings and wrappers for Rust (DEPRECATED SEE https://github.com/rust-gnome )
GNU Lesser General Public License v3.0
121 stars 22 forks source link

undefined reference in building examples on windows #76

Closed briankropf closed 9 years ago

briankropf commented 9 years ago

I checked out rgtk and the main library appears to build OK after I changed treepath.rs to use u32 instead of u64 on line 56. but when I try to build the examples, I get an undefined reference to 'cast_GtkTextTagTable'. Any advice on fixing this? I'm new to rust and not sure what exactly it is telling me.

rustc -g -L target/ examples/cairotest.rs -o target/example/cairotest error: linking with gcc failed: exit code: 1 note: gcc '-m64' '-L' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-o' 'target\example\cairotest' 'target\example\cairotest.o' '-Wl,--whole-archive' '-lmorestack' '-Wl,--no-whole-archive' '-fno-lto' '-fno-use-linker-plugin' '-Wl,--gc-sections' '-shared-libgcc' '-Wl,--enable-long-section-names' '-Wl,--nxcompat' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\libdebug-4e7c5e5c.rlib' 'C:\development\libraries\rust\rgtk\target\librgtk.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\liblog-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\libnative-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\libregex-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\libstd-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\librand-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\libsync-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\librustrt-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\libcollections-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\liballoc-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\libunicode-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\liblibc-4e7c5e5c.rlib' 'C:\development\compilers\Rust\bin\rustlib\x86_64-w64-mingw32\lib\libcore-4e7c5e5c.rlib' '-L' 'target' '-L' 'C:\development\libraries\rust\rgtk.rust' '-L' 'C:\development\libraries\rust\rgtk' '-Wl,--whole-archive' '-Wl,-Bstatic' '-Wl,--no-whole-archive' '-Wl,-Bdynamic' '-lglib-2.0' '-lgtk-3' '-lgio-2.0' '-lgobject-2.0' '-lgdk-3' '-lcairo' '-lws2_32' '-lgcc_s' '-lcompiler-rt' note: C:\development\libraries\rust\rgtk\target\librgtk.rlib(rgtk.o):(.text+0x1936): undefined reference to `cast_GtkTextTagTable' collect2.exe: error: ld returned 1 exit status

error: aborting due to previous error Makefile:74: recipe for target 'target/example/cairotest' failed make: *\ [target/example/cairotest] Error 101

GuillaumeGomez commented 9 years ago

I think the problem is just that the one who did implement this widget forgot to add cast functions (in gtk_glue and in ffi).

briankropf commented 9 years ago

Ahh, thanks, that worked! I was able to run both cairotest and gtktest. Here is the patch to get it working on my windows 8 box using x86_64-w64-mingw32.

diff --git a/gtk_glue/gtk_glue.c b/gtk_glue/gtk_glue.c index 27f27f9..dc62083 100644 --- a/gtk_glue/gtk_glue.c +++ b/gtk_glue/gtk_glue.c @@ -123,6 +123,10 @@ GtkTextBuffer* cast_GtkTextBuffer(void* widget) { return GTK_TEXT_BUFFER(widget); }

+GtkTextView* cast_GtkTextTagTable(GtkWidget* widget) {

GuillaumeGomez commented 9 years ago

Can you do a PR so we can merge it please ?