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

Compiling with 32bit flags leads to 64bit ruby #623

Closed
apeiros opened this Issue Nov 29, 2011 · 8 comments

Comments

Projects
None yet
5 participants
@apeiros

apeiros commented Nov 29, 2011

Hi

I'm using Kenneth Reitz' GCC installer (https://github.com/kennethreitz/osx-gcc-installer), the newest rvm (1.10.0-pre) and OS X Lion 10.7.2.
I tried to install ruby 1.9.2p290 as 32bit executable, following http://beginrescueend.com/support/troubleshooting/ (section "i386 (32 bit)").
However, the compiled executable is 64bit.

Additional information:

$ uname -mprsv
Darwin 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64 i386

$ rvm_archflags="-arch i386" CFLAGS='-m32' CXXFLAGS='-m32' LDFLAGS='-m32' rvm install ruby-1.9.2
# …snip…
Install of ruby-1.9.2-p290 - #complete 
$ rvm use 1.9.2
$ which ruby
/Users/apeiros/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
$ file /Users/apeiros/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/Users/apeiros/.rvm/rubies/ruby-1.9.2-p290/bin/ruby: Mach-O 64-bit executable x86_64
$ cat ~/.rvm/src/ruby-1.9.2-p290/Makefile | grep '^arch ='
arch = x86_64-darwin11.2.0

If I can supply any other information, please let me know.

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Dec 1, 2011

Member

please get familiar with this first: #562

Member

mpapis commented Dec 1, 2011

please get familiar with this first: #562

@ghost ghost assigned mpapis Dec 1, 2011

@apeiros

This comment has been minimized.

Show comment
Hide comment
@apeiros

apeiros Dec 2, 2011

@mpapis thanks for the reply. I'm not sure what I should apply out of all of what's being discussed in issue 562.
I read it through and tried a couple of variations, none with success (i.e. it either didn't compile at all or yielded a 64bit ruby). I'll exhibit the one matching what you said last in issue 562:

$ cat ~/.rvmrc
export rvm_archflags='-arch i386'
export rvm_architectures='i386'
export rvm_configure_flags=--target=i686-apple-darwin11
# I opened a new shell to ensure those and only those env var settings where loaded

rvm install ruby-1.9.2-p290-nt6 --patch osx-arch-fix

Installing Ruby from source to: /Users/apeiros/.rvm/rubies/ruby-1.9.2-p290-nt6, this may take a while depending on your cpu(s)...

ruby-1.9.2-p290-nt6 - #fetching 
ruby-1.9.2-p290-nt6 - #extracting ruby-1.9.2-p290 to /Users/apeiros/.rvm/src/ruby-1.9.2-p290-nt6
ruby-1.9.2-p290-nt6 - #extracted to /Users/apeiros/.rvm/src/ruby-1.9.2-p290-nt6
Applying patch 'osx-arch-fix' (located at /Users/apeiros/.rvm/patches/ruby/1.9.2/osx-arch-fix.patch)
Fetching yaml-0.1.4.tar.gz to /Users/apeiros/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/apeiros/.rvm/src
Configuring yaml in /Users/apeiros/.rvm/src/yaml-0.1.4.
ERROR: Error running ' ./configure --prefix="/Users/apeiros/.rvm/usr" --target=i686-apple-darwin11           --build=i386-apple-darwin11.2.0           --host=i386-apple-darwin11.2.0 ', please read /Users/apeiros/.rvm/log/ruby-1.9.2-p290-nt6/yaml/configure.log
Compiling yaml in /Users/apeiros/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/apeiros/.rvm/usr
ruby-1.9.2-p290-nt6 - #configuring 
ERROR: Error running ' ./configure --prefix=/Users/apeiros/.rvm/rubies/ruby-1.9.2-p290-nt6 --enable-shared --disable-install-doc --target=i686-apple-darwin11           --build=i386-apple-darwin11.2.0           --host=i386-apple-darwin11.2.0 --with-libyaml-dir=/Users/apeiros/.rvm/usr ', please read /Users/apeiros/.rvm/log/ruby-1.9.2-p290-nt6/configure.log
ERROR: There has been an error while running configure. Halting the installation.

$ cat /Users/apeiros/.rvm/log/ruby-1.9.2-p290-nt6/configure.log
[2011-12-02 11:05:32]  ./configure --prefix=/Users/apeiros/.rvm/rubies/ruby-1.9.2-p290-nt6 --enable-shared --disable-install-doc --target=i686-apple-darwin11           --build=i386-apple-darwin11.2.0           --host=i386-apple-darwin11.2.0 --with-libyaml-dir=/Users/apeiros/.rvm/usr 
configure: WARNING: unrecognized options: --with-libyaml-dir
checking build system type... i386-apple-darwin11.2.0
checking host system type... i386-apple-darwin11.2.0
checking target system type... i686-apple-darwin11
checking for i386-apple-darwin11.2.0-gcc... (cached) /usr/bin/gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/apeiros/.rvm/src/ruby-1.9.2-p290-nt6':
configure: error: C compiler cannot create executables
See `config.log' for more details

# As stated before, I use Kenneth Reitz' GCC installer (GCC-10.7-v2)
$ /usr/bin/gcc-4.2 -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/gcc/gcc-5666.3~278/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

apeiros commented Dec 2, 2011

@mpapis thanks for the reply. I'm not sure what I should apply out of all of what's being discussed in issue 562.
I read it through and tried a couple of variations, none with success (i.e. it either didn't compile at all or yielded a 64bit ruby). I'll exhibit the one matching what you said last in issue 562:

$ cat ~/.rvmrc
export rvm_archflags='-arch i386'
export rvm_architectures='i386'
export rvm_configure_flags=--target=i686-apple-darwin11
# I opened a new shell to ensure those and only those env var settings where loaded

rvm install ruby-1.9.2-p290-nt6 --patch osx-arch-fix

Installing Ruby from source to: /Users/apeiros/.rvm/rubies/ruby-1.9.2-p290-nt6, this may take a while depending on your cpu(s)...

ruby-1.9.2-p290-nt6 - #fetching 
ruby-1.9.2-p290-nt6 - #extracting ruby-1.9.2-p290 to /Users/apeiros/.rvm/src/ruby-1.9.2-p290-nt6
ruby-1.9.2-p290-nt6 - #extracted to /Users/apeiros/.rvm/src/ruby-1.9.2-p290-nt6
Applying patch 'osx-arch-fix' (located at /Users/apeiros/.rvm/patches/ruby/1.9.2/osx-arch-fix.patch)
Fetching yaml-0.1.4.tar.gz to /Users/apeiros/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/apeiros/.rvm/src
Configuring yaml in /Users/apeiros/.rvm/src/yaml-0.1.4.
ERROR: Error running ' ./configure --prefix="/Users/apeiros/.rvm/usr" --target=i686-apple-darwin11           --build=i386-apple-darwin11.2.0           --host=i386-apple-darwin11.2.0 ', please read /Users/apeiros/.rvm/log/ruby-1.9.2-p290-nt6/yaml/configure.log
Compiling yaml in /Users/apeiros/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/apeiros/.rvm/usr
ruby-1.9.2-p290-nt6 - #configuring 
ERROR: Error running ' ./configure --prefix=/Users/apeiros/.rvm/rubies/ruby-1.9.2-p290-nt6 --enable-shared --disable-install-doc --target=i686-apple-darwin11           --build=i386-apple-darwin11.2.0           --host=i386-apple-darwin11.2.0 --with-libyaml-dir=/Users/apeiros/.rvm/usr ', please read /Users/apeiros/.rvm/log/ruby-1.9.2-p290-nt6/configure.log
ERROR: There has been an error while running configure. Halting the installation.

$ cat /Users/apeiros/.rvm/log/ruby-1.9.2-p290-nt6/configure.log
[2011-12-02 11:05:32]  ./configure --prefix=/Users/apeiros/.rvm/rubies/ruby-1.9.2-p290-nt6 --enable-shared --disable-install-doc --target=i686-apple-darwin11           --build=i386-apple-darwin11.2.0           --host=i386-apple-darwin11.2.0 --with-libyaml-dir=/Users/apeiros/.rvm/usr 
configure: WARNING: unrecognized options: --with-libyaml-dir
checking build system type... i386-apple-darwin11.2.0
checking host system type... i386-apple-darwin11.2.0
checking target system type... i686-apple-darwin11
checking for i386-apple-darwin11.2.0-gcc... (cached) /usr/bin/gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/apeiros/.rvm/src/ruby-1.9.2-p290-nt6':
configure: error: C compiler cannot create executables
See `config.log' for more details

# As stated before, I use Kenneth Reitz' GCC installer (GCC-10.7-v2)
$ /usr/bin/gcc-4.2 -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/gcc/gcc-5666.3~278/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Dec 29, 2011

Member

addition of --32 should fix your issue, use:

rvm get head
rvm reinstall ruby-1.9.2-p290-nt6 --32
Member

mpapis commented Dec 29, 2011

addition of --32 should fix your issue, use:

rvm get head
rvm reinstall ruby-1.9.2-p290-nt6 --32

@mpapis mpapis closed this Jan 2, 2012

@raskhadafi

This comment has been minimized.

Show comment
Hide comment
@raskhadafi

raskhadafi Apr 18, 2012

Thanks for the new flags but I didn't found them in the documentation!
I had to search in the issues.

raskhadafi commented Apr 18, 2012

Thanks for the new flags but I didn't found them in the documentation!
I had to search in the issues.

@mpapis

This comment has been minimized.

Show comment
Hide comment
@mpapis

mpapis Apr 18, 2012

Member

@raskhadafi i will be fixing the docs with RVM 2.0

Member

mpapis commented Apr 18, 2012

@raskhadafi i will be fixing the docs with RVM 2.0

@eevee

This comment has been minimized.

Show comment
Hide comment
@eevee

eevee Sep 16, 2015

Almost four years later, I wasted half a day chasing down a similar problem, because the flags are still not documented. I finally found them reading the source code.

eevee commented Sep 16, 2015

Almost four years later, I wasted half a day chasing down a similar problem, because the flags are still not documented. I finally found them reading the source code.

@v6

This comment has been minimized.

Show comment
Hide comment
@v6

v6 Jul 2, 2016

// , Interesting that rubygems seems to use the system architecture for building native extensions.

@eevee, how did you find this bug?

v6 commented Jul 2, 2016

// , Interesting that rubygems seems to use the system architecture for building native extensions.

@eevee, how did you find this bug?

@eevee

This comment has been minimized.

Show comment
Hide comment
@eevee

eevee Jul 2, 2016

I have a 64-bit Linode running a 32-bit kernel.

It was originally all 32-bit, then they gave me a free upgrade to a 64-bit host, and I didn't see any good reason to redo a lot of ad-hoc stuff just to fix the mismatch.

eevee commented Jul 2, 2016

I have a 64-bit Linode running a 32-bit kernel.

It was originally all 32-bit, then they gave me a free upgrade to a 64-bit host, and I didn't see any good reason to redo a lot of ad-hoc stuff just to fix the mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment