Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

32bit support? #250

Open
buster opened this issue Mar 29, 2015 · 13 comments
Open

32bit support? #250

buster opened this issue Mar 29, 2015 · 13 comments

Comments

@buster
Copy link

buster commented Mar 29, 2015

Hi,

i just wanted to compile my program on i386 (Atom based netbook) but the steps show the following errors. I guess this is due to the netbook being 32bit? Or could this be something different?

/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gtk/widgets/recent_info.rs:70:18: 70:87 error: mismatched types:
 expected `i64`,
    found `i32`
(expected i64,
    found i32) [E0308]
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gtk/widgets/recent_info.rs:70         unsafe { ffi::gtk_recent_info_get_added(GTK_RECENT_INFO(self.unwrap_widget())) }
                                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gtk/widgets/recent_info.rs:74:18: 74:90 error: mismatched types:
 expected `i64`,
    found `i32`
(expected i64,
    found i32) [E0308]
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gtk/widgets/recent_info.rs:74         unsafe { ffi::gtk_recent_info_get_modified(GTK_RECENT_INFO(self.unwrap_widget())) }
                                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gtk/widgets/recent_info.rs:78:18: 78:89 error: mismatched types:
 expected `i64`,
    found `i32`
(expected i64,
    found i32) [E0308]
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gtk/widgets/recent_info.rs:78         unsafe { ffi::gtk_recent_info_get_visited(GTK_RECENT_INFO(self.unwrap_widget())) }
                                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gtk/widgets/recent_info.rs:97:21: 97:31 error: mismatched types:
 expected `*mut i32`,
    found `&mut i64`
(expected i32,
    found i64) [E0308]
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gtk/widgets/recent_info.rs:97                     &mut time_));
                                                                                                                     ^~~~~~~~~~
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gdk/widgets/pixbuf.rs:74:18: 74:90 error: mismatched types:
 expected `u64`,
    found `u32`
(expected u64,
    found u32) [E0308]
/home/buster/.cargo/git/checkouts/rgtk-1b1dd31ed25241cd/master/src/gdk/widgets/pixbuf.rs:74         unsafe { ffi::gdk_pixbuf_get_byte_length(self.pointer as *const ffi::C_GdkPixbuf) }
                                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 5 previous errors
Could not compile `rgtk`.

To learn more, run the command again with --verbose.
@GuillaumeGomez
Copy link
Contributor

Oh ! That's perfect ! We need someone to check and add/replace conversion like i32 as c_int on 32 bit computer everywhere there's warning. Could you do that please ?

@gkoz
Copy link
Contributor

gkoz commented Mar 29, 2015

Hmm. Didn't expect this to not have been tested at all. Checking 32-bit stuff on a 64-bit system should be pretty easy, just make a 32-bit chroot. Too bad travis doesn't provide this...

@GuillaumeGomez
Copy link
Contributor

A 32-bit chroot ?

@gkoz
Copy link
Contributor

gkoz commented Mar 29, 2015

Oh.. you might not be running Linux?.. My bad haha.

@buster
Copy link
Author

buster commented Mar 29, 2015

Problem is that compiling rgtk on that netbook takes around 45 minutes or something like that, chroot on a beefier machine seems to be the better option

@gkoz
Copy link
Contributor

gkoz commented Mar 29, 2015

In case anyone finds it useful, a 32-bit chroot is as simple as
[UPDATED]

DIR=ubuntu32
RELEASE=vivid
mkdir $DIR
sudo debootstrap --arch i386 $RELEASE $DIR http://archive.ubuntu.com/ubuntu/
sudo mount -t proc proc $DIR/proc
sudo mount -t devtmpfs dev $DIR/dev
sudo setarch i386 chroot $DIR /bin/bash

This will also allow to test with various GTK versions.

@GuillaumeGomez
Copy link
Contributor

@gkoz: I'm under linux and I didn't know that, thanks for the tip !

@gkoz
Copy link
Contributor

gkoz commented Mar 29, 2015

@GuillaumeGomez
Uh... actually rustc dies on me in this setup... even when I add setarch i386. So maybe not as simple as I thought.

@gkoz
Copy link
Contributor

gkoz commented Mar 29, 2015

That was just laziness though, when running a system in a chroot you need to mount /proc and /dev :)

@GuillaumeGomez
Copy link
Contributor

Hum... I was going to use a linux live usb to test 32-bit (taht's how I was doing before) but I'll give a try to your solution.

@gkoz
Copy link
Contributor

gkoz commented Mar 29, 2015

So the more correct way to start the chroot would be

DIR=ubuntu32
sudo mount -t proc proc $DIR/proc
sudo mount -t devtmpfs dev $DIR/dev
sudo setarch i386 chroot $DIR /bin/bash

And if you're going to use a recent version of Ubuntu, your kernel better not be too old...

@StephanvanSchaik
Copy link

As I want to be able to compile this Rust binding for GTK+ on ARMv7, which is also a 32-bit architecture, I am currently working on a patch that fixes this particular issue.

@StephanvanSchaik
Copy link

Also, to set up a 32-bit chroot, do the following:

Download a rootfs for the distribution you want to use:

Debian

mkdir chroot32
debootstrap --arch=i386 --foreign jessie chroot32 http://http.debian.net/debian
chroot chroot32 /debootstrap/debootstrap --second-stage

Gentoo

mkdir chroot32
wget -O - http://distfiles.gentoo.org/releases/x86/autobuilds/$(wget -O - http://distfiles.gentoo.org/releases/x86/autobuilds/latest-stage-i686.txt 2>/dev/null | tail -n1 | tr ' ' '\n' | head -n1) | tar xvjp -C chroot32
wget -O - http://distfiles.gentoo.org/releases/snapshots/current/portage-latest.tar.bz2 | tar xjp -C chroot32/usr/

Ubuntu

mkdir chroot32
wget -O - http://cdimage.ubuntu.com/ubuntu-core/releases/14.10/release/ubuntu-core-14.10-core-i386.tar.gz | tar xvzp -C chroot32 

Entering the chroot32 environment

mount -t proc none chroot32/proc
for i in {dev,sys,tmp}; do mount -o bind /$i chroot32/$i; done
cp /etc/resolv.conf chroot32/etc/resolv.conf
chroot chroot32 /bin/bash

Note: you can also save this as a shell script.

Leaving the chroot32 environment

Simply type exit. You can save the following shell script to clean it all up:

for i in {dev,proc,sys,tmp}; do umount chroot32/$i; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants