Trying to run examples/gtktest on OS X using homebrew libraries: `cargo build` fails
nicerobot opened this issue · 17 comments
$ cargo run --verbose
Compiling rgtk v0.0.1 (file:///rust/rgtk/examples/gtktest)
Running `rustc src/rgtk.rs --crate-name rgtk --crate-type rlib -g --cfg feature="GTK_3_10" -C metadata=0166c31074c24165 -C extra-filename=-0166c31074c24165 --out-dir /rust/rgtk/examples/gtktest/target/deps --dep-info /rust/rgtk/examples/gtktest/target/.fingerprint/rgtk-0166c31074c24165/dep-lib-rgtk -L /rust/rgtk/examples/gtktest/target/deps -L /rust/rgtk/examples/gtktest/target/deps -L /rust/rgtk/examples/gtktest/target/native/rgtk-0166c31074c24165`
src/rgtk.rs:1:1: 1:1 error: can't find crate for `std`
src/rgtk.rs:1 // This file is part of rgtk.
^
error: aborting due to previous error
Could not compile `rgtk`.
Caused by:
Process didn't exit successfully: `rustc src/rgtk.rs --crate-name rgtk --crate-type rlib -g --cfg feature="GTK_3_10" -C metadata=0166c31074c24165 -C extra-filename=-0166c31074c24165 --out-dir /rust/rgtk/examples/gtktest/target/deps --dep-info /rust/rgtk/examples/gtktest/target/.fingerprint/rgtk-0166c31074c24165/dep-lib-rgtk -L /rust/rgtk/examples/gtktest/target/deps -L /rust/rgtk/examples/gtktest/target/deps -L /rust/rgtk/examples/gtktest/target/native/rgtk-0166c31074c24165` (status=101)
I didn't have any problem to compile it once again. We need more details : platform ? OS ? Compiler version ?
EDIT: we actually have an issue on examples. Is that your problem ?
Sorry, i thought maybe the verbose mode would provide the needed details. It's OSX, using Homebrew version of rust 0.12.0.
I uninstalled rust, brew uninstall rust
, and reinstalled it, brew install rust
, and i now get a different error :-/
$ cargo run --verbose
Compiling rgtk v0.0.1 (file:///rust/rgtk/examples/gtktest)
Running sh cargobuild.sh
Running `rustc src/rgtk.rs --crate-name rgtk --crate-type rlib -g --cfg feature="GTK_3_10" -C metadata=0166c31074c24165 -C extra-filename=-0166c31074c24165 --out-dir /rust/rgtk/examples/gtktest/target/deps --dep-info /rust/rgtk/examples/gtktest/target/.fingerprint/rgtk-0166c31074c24165/dep-lib-rgtk -L /rust/rgtk/examples/gtktest/target/deps -L /rust/rgtk/examples/gtktest/target/deps -L /rust/rgtk/examples/gtktest/target/native/rgtk-0166c31074c24165`
src/cairo/enums.rs:65:13: 65:18 error: macro undefined: 'panic!'
src/cairo/enums.rs:65 panic!("Cairo error {}", *self)
^~~~~
src/cairo/patterns.rs:32:53: 32:58 error: macro undefined: 'panic!'
src/cairo/patterns.rs:32 PatternType::PatternTypeRasterSource => panic!("Not implemented")
^~~~~
error: aborting due to 2 previous errors
Could not compile `rgtk`.
Caused by:
Process didn't exit successfully: `rustc src/rgtk.rs --crate-name rgtk --crate-type rlib -g --cfg feature="GTK_3_10" -C metadata=0166c31074c24165 -C extra-filename=-0166c31074c24165 --out-dir /rust/rgtk/examples/gtktest/target/deps --dep-info /rust/rgtk/examples/gtktest/target/.fingerprint/rgtk-0166c31074c24165/dep-lib-rgtk -L /rust/rgtk/examples/gtktest/target/deps -L /rust/rgtk/examples/gtktest/target/deps -L /rust/rgtk/examples/gtktest/target/native/rgtk-0166c31074c24165` (status=101)
I'm thinking this may imply the homebrew rust-maintainer needs to fix something.
I think that's an old version of rust compiler since panic! is kinda recent.
@jeremyletang: you're the osx pro here ! Your advice is requested !
hi,
rgtk
may not work with rust-0.12
, we target the rust master version currently rustc 0.13.0-dev (cf7df1e63 2014-11-19 07:21:42 +0000)
.
You should install rust using the rustup.sh script available on rust-lang.org
curl https://static.rust-lang.org/rustup.sh | sudo sh -
Ok, rustup improves things, i think. Now:
$ cargo build
...
ld: library not found for -lglib-2.0
glib-2.0 is indeed installed:
$ pkg-config --libs glib-2.0
-L/usr/local/Cellar/glib/2.42.1/lib -L/usr/local/opt/gettext/lib -lglib-2.0 -lintl
It seems cargo/rustc doesn't respect LD_LIBRARY_PATH
nor CFLAGS
. I haven't yet discovered the cargo/rustc method of modifying the build.
This command shoul help to find gtk+ during build.
Is that command supposed to change the cargo build
? It didn't change anything for me:
$ export GTK_VERSION=${GTK_VERSION:=$(pkg-config --modversion gtk+-3.0 | awk -F. '{print "GTK_3_"$2}')}
$ echo $GTK_VERSION
GTK_3_14
$ cargo build
...
ld: library not found for -lglib-2.0
Well then, try this :
> ./configure
> make re
Changes nothing. :-/
$ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GTK3... yes
checking for GDK3... yes
checking for GLIB... yes
checking for GOBJECT... yes
checking for CAIRO... yes
configure: creating ./config.status
config.status: creating Makefile
$ make re
rm -rf target/
mkdir -p target/deps/
�[32;01m Created target/deps/ folder �[0m
cc -DGTK_3_14 -g -c gtk_glue/gtk_glue.c -D_REENTRANT -I/opt/X11/include -I/opt/X11/include/cairo -I/opt/X11/include/pixman-1 -I/opt/X11/include -I/opt/X11/include/freetype2 -I/opt/X11/include/libpng15 -I/opt/X11/include -I/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0 -I/usr/local/Cellar/at-spi2-atk/2.14.1/include/at-spi2-atk/2.0 -I/usr/local/Cellar/at-spi2-core/2.14.1/include/at-spi-2.0 -I/usr/local/Cellar/d-bus/1.8.8/include/dbus-1.0 -I/usr/local/Cellar/d-bus/1.8.8/lib/dbus-1.0/include -I/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0 -I/usr/local/Cellar/glib/2.42.1/include/gio-unix-2.0/ -I/usr/local/Cellar/pango/1.36.8/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/0.9.35_1/include/harfbuzz -I/usr/local/Cellar/pango/1.36.8/include/pango-1.0 -I/usr/local/Cellar/atk/2.14.0/include/atk-1.0 -I/usr/local/Cellar/cairo/1.14.0/include/cairo -I/usr/local/Cellar/gdk-pixbuf/2.30.8/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.14/include/libpng16 -I/usr/local/Cellar/glib/2.42.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.42.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -o target/deps/librgtk_glue.o -L/opt/X11/lib -L/usr/local/Cellar/gtk+3/3.14.5/lib -L/usr/local/Cellar/pango/1.36.8/lib -L/usr/local/Cellar/atk/2.14.0/lib -L/usr/local/Cellar/cairo/1.14.0/lib -L/usr/local/Cellar/gdk-pixbuf/2.30.8/lib -L/usr/local/Cellar/glib/2.42.1/lib -L/usr/local/opt/gettext/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -fPIC
clang: warning: -lgtk-3: 'linker' input unused
clang: warning: -lgdk-3: 'linker' input unused
clang: warning: -lpangocairo-1.0: 'linker' input unused
clang: warning: -lpango-1.0: 'linker' input unused
clang: warning: -latk-1.0: 'linker' input unused
clang: warning: -lcairo-gobject: 'linker' input unused
clang: warning: -lcairo: 'linker' input unused
clang: warning: -lgdk_pixbuf-2.0: 'linker' input unused
clang: warning: -lgio-2.0: 'linker' input unused
clang: warning: -lgobject-2.0: 'linker' input unused
clang: warning: -lglib-2.0: 'linker' input unused
clang: warning: -lintl: 'linker' input unused
clang: warning: argument unused during compilation: '-L/opt/X11/lib'
clang: warning: argument unused during compilation: '-L/usr/local/Cellar/gtk+3/3.14.5/lib'
clang: warning: argument unused during compilation: '-L/usr/local/Cellar/pango/1.36.8/lib'
clang: warning: argument unused during compilation: '-L/usr/local/Cellar/atk/2.14.0/lib'
clang: warning: argument unused during compilation: '-L/usr/local/Cellar/cairo/1.14.0/lib'
clang: warning: argument unused during compilation: '-L/usr/local/Cellar/gdk-pixbuf/2.30.8/lib'
clang: warning: argument unused during compilation: '-L/usr/local/Cellar/glib/2.42.1/lib'
clang: warning: argument unused during compilation: '-L/usr/local/opt/gettext/lib'
gtk_glue/gtk_glue.c:75:12: warning: 'gtk_misc_get_type' is deprecated [-Wdeprecated-declarations]
return GTK_MISC(widget);
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkmisc.h:39:67: note: expanded from macro 'GTK_MISC'
#define GTK_MISC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MISC, GtkMisc))
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkmisc.h:38:32: note: expanded from macro 'GTK_TYPE_MISC'
#define GTK_TYPE_MISC (gtk_misc_get_type ())
^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/gobject/gtype.h:479:92: note: expanded from macro 'G_TYPE_CHECK_INSTANCE_CAST'
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/gobject/gtype.h:1933:61: note: expanded from macro '_G_TYPE_CIC'
((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkmisc.h:70:9: note: 'gtk_misc_get_type' has been explicitly marked deprecated here
GType gtk_misc_get_type (void) G_GNUC_CONST;
^
gtk_glue/gtk_glue.c:311:12: warning: 'gtk_alignment_get_type' is deprecated [-Wdeprecated-declarations]
return GTK_ALIGNMENT(widget);
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkalignment.h:39:81: note: expanded from macro 'GTK_ALIGNMENT'
#define GTK_ALIGNMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ALIGNMENT, GtkAlignment))
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkalignment.h:38:46: note: expanded from macro 'GTK_TYPE_ALIGNMENT'
#define GTK_TYPE_ALIGNMENT (gtk_alignment_get_type ())
^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/gobject/gtype.h:479:92: note: expanded from macro 'G_TYPE_CHECK_INSTANCE_CAST'
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/gobject/gtype.h:1933:61: note: expanded from macro '_G_TYPE_CIC'
((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkalignment.h:77:12: note: 'gtk_alignment_get_type' has been explicitly marked deprecated here
GType gtk_alignment_get_type (void) G_GNUC_CONST;
^
gtk_glue/gtk_glue.c:362:12: warning: 'gtk_arrow_get_type' is deprecated [-Wdeprecated-declarations]
return GTK_ARROW(widget);
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkarrow.h:40:77: note: expanded from macro 'GTK_ARROW'
#define GTK_ARROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ARROW, GtkArrow))
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkarrow.h:39:42: note: expanded from macro 'GTK_TYPE_ARROW'
#define GTK_TYPE_ARROW (gtk_arrow_get_type ())
^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/gobject/gtype.h:479:92: note: expanded from macro 'G_TYPE_CHECK_INSTANCE_CAST'
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/gobject/gtype.h:1933:61: note: expanded from macro '_G_TYPE_CIC'
((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
^
/usr/local/Cellar/gtk+3/3.14.5/include/gtk-3.0/gtk/deprecated/gtkarrow.h:71:12: note: 'gtk_arrow_get_type' has been explicitly marked deprecated here
GType gtk_arrow_get_type (void) G_GNUC_CONST;
^
3 warnings generated.
ar -rcs target/deps/librgtk_glue.a target/deps/librgtk_glue.o
cargo build
still fails.
$ cd examples/gtktest
$ cargo build
Compiling rgtk-examples v0.0.1 (file:///rust/rgtk/examples/gtktest)
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-o' '/rust/rgtk/examples/gtktest/target/gtktest' '/rust/rgtk/examples/gtktest/target/gtktest.o' '-Wl,-force_load,/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a' '-Wl,-dead_strip' '-nodefaultlibs' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libnative-4e7c5e5c.rlib' '/rust/rgtk/examples/gtktest/target/deps/librgtk-0166c31074c24165.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libstd-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libsync-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/librustrt-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libcollections-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/liballoc-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/liblibc-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/librand-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libunicode-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libcore-4e7c5e5c.rlib' '-L' '/rust/rgtk/examples/gtktest/target' '-L' '/rust/rgtk/examples/gtktest/target/deps' '-L' '/rust/rgtk/examples/gtktest/target/native/rgtk-0166c31074c24165' '-L' '/rust/rgtk/examples/gtktest/.rust' '-L' '/rust/rgtk/examples/gtktest' '-lglib-2.0' '-lgtk-3.0' '-lgio-2.0' '-lgobject-2.0' '-lgdk-3.0' '-lcairo' '-lSystem' '-lpthread' '-lc' '-lm' '-lcompiler-rt'
note: ld: warning: directory not found for option '-L/rust/rgtk/examples/gtktest/.rust'
ld: library not found for -lglib-2.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: aborting due to previous error
Could not compile `rgtk-examples`.
To learn more, run the command again with --verbose.
For example build fail, it's normal. We'll try to fix it later. It's possible to build it by cheating a little. I wonder if this works :
> make examples
$ make examples
make: Nothing to be done for `examples'.
$ make
make: Nothing to be done for `glue'.
Sorry I don't have the time to dig in to this deeper myself but i'm swamped and just trying to evaluate if this will be useful for a future project for which the clients will mostly be on OS X.
Could you test with the #150 please ?
Still the same :-/
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh
$ rustc --version
rustc 0.13.0-nightly (fac5a0767 2014-11-26 22:37:06 +0000)
$ git pull
$ git ls
be5a75e (HEAD, origin/master, origin/HEAD, master) Merge pull request #151 from GuillaumeGomez/new_widget [Jeremy Letang]
40bfa5b Merge pull request #152 from GuillaumeGomez/master [Jeremy Letang]
19b3a70 New widget : ColorChooserWidget [GuillaumeGomez]
a1a88d8 New widget : ColorChooserWidget [GuillaumeGomez]
64d94ff Update to last rust compiler version [GuillaumeGomez]
7c37144 Add new widget : FileChooserWidget [GuillaumeGomez]
5d8be22 Merge pull request #150 from GuillaumeGomez/master [Jeremy Letang]
...
$ ./configure
... same as : https://github.com/jeremyletang/rgtk/issues/147#issuecomment-63967501
$ cd examples/gtktest
$ cargo build
...
ld: library not found for -lglib-2.0
...
The prior results i documented in previous comments appear to be identical with respect to cargo build
, ./configure
, ...
@jeremyletang is working on it, he has the same issue. I'm kinda disappointed it only fixed the linux build however...
#154 should have fix your problem. If not, I'll reopen this issue.
👍 Thank you!
You're welcome. Thanks for your report !