[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Compiling C++ module for Ruby

Albert Chin

10/31/2006 6:03:00 AM

What needs to change in extconf.rb to link against a C++ compiler? If
I set CONFTEST_C="conftest.cxx", then gcc is smart enough to build it
with g++. However, that is not the case for C compilers from Sun, HP,
IBM, etc. If Ruby was built with the vendor C compiler, what changes
need to be made to extconf.rb so C++ tests use the corresponding
vendor C++ compiler?

--
albert chin (china @at@ thewrittenword .dot. com)
5 Answers

???? ??????

10/31/2006 6:15:00 AM

0


On Oct 31, 2006, at 9:05 AM, Albert Chin wrote:

> What needs to change in extconf.rb to link against a C++ compiler? If
> I set CONFTEST_C="conftest.cxx", then gcc is smart enough to build it
> with g++. However, that is not the case for C compilers from Sun, HP,
> IBM, etc. If Ruby was built with the vendor C compiler, what changes
> need to be made to extconf.rb so C++ tests use the corresponding
> vendor C++ compiler?


It is indeed a huge problem. I've found other way: I set CONFIG
["CPP"], then everything
goes ok. But this hack breaks portability of extconf.rb

Paul Brannan

10/31/2006 9:08:00 PM

0

On Tue, Oct 31, 2006 at 03:05:05PM +0900, Albert Chin wrote:
> What needs to change in extconf.rb to link against a C++ compiler? If
> I set CONFTEST_C="conftest.cxx", then gcc is smart enough to build it
> with g++. However, that is not the case for C compilers from Sun, HP,
> IBM, etc. If Ruby was built with the vendor C compiler, what changes
> need to be made to extconf.rb so C++ tests use the corresponding
> vendor C++ compiler?

There is a rule in the generated makefile for building .cxx files using
$(CXX). Ruby 1.9 sets this variable; earlier versions seem to rely on
it getting set by make.

If CONFIG['CXX'] is unset, you could use find_executable to find a
binary with the same name as a common C++ compiler (autoconf seems to
search $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC). Then
open the Makefile for writing and add the line:

CXX=#{your_cxx_binary}

Paul



Albert Chin

11/2/2006 3:13:00 PM

0

Paul Brannan <pbrannan@atdesk.com> wrote:
> On Tue, Oct 31, 2006 at 03:05:05PM +0900, Albert Chin wrote:
>> What needs to change in extconf.rb to link against a C++ compiler? If
>> I set CONFTEST_C="conftest.cxx", then gcc is smart enough to build it
>> with g++. However, that is not the case for C compilers from Sun, HP,
>> IBM, etc. If Ruby was built with the vendor C compiler, what changes
>> need to be made to extconf.rb so C++ tests use the corresponding
>> vendor C++ compiler?
>
> There is a rule in the generated makefile for building .cxx files using
> $(CXX). Ruby 1.9 sets this variable; earlier versions seem to rely on
> it getting set by make.
>
> If CONFIG['CXX'] is unset, you could use find_executable to find a
> binary with the same name as a common C++ compiler (autoconf seems to
> search $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC). Then
> open the Makefile for writing and add the line:
>
> CXX=#{your_cxx_binary}

But that wouldn't help run the C++ compiler during extconf.rb. How
would you run HP's aCC C++ compiler to test for a symbol during
extconf.rb, for example?

--
albert chin (china @at@ thewrittenword .dot. com)

Paul Brannan

11/2/2006 3:59:00 PM

0

On Fri, Nov 03, 2006 at 12:15:13AM +0900, Albert Chin wrote:
> But that wouldn't help run the C++ compiler during extconf.rb. How
> would you run HP's aCC C++ compiler to test for a symbol during
> extconf.rb, for example?

You could redefine try_link (or TRY_LINK) and try_compile, but that will
use the C++ compiler for everything, which may not be what you want.

Paul



J A

11/22/2008 12:03:00 AM

0


"William Black" <william.black@hotmail.co.uk> wrote in message
news:gg672b$aok$1@news.motzarella.org...
>
> "J Antero" <ae@re.com> wrote in message
> news:N_6dnXv1z7wal7vUnZ2dnUVZ_tHinZ2d@earthlink.com...
>>I have a feeling that if the Detroit automakers wind up in Cahpter 7
>>bankruptcy (doors closed, not just reorganization), that there will be a
>>couple pages in Econ 101 textbooks 50 years from now, discussing what a
>>very big mistake it was..
>
> Doubtful.
>

> It's far more likely that there'll be a lot of essays about the inevitable
> demise of US heavy manufacturing and the end of the 'rust belt' era.
>
> Economists don't usually do 'might have been'.

Ridiculous. More piffle.

A lot of economic history focuses on why the 1929 crash was followed by a
depression.

A lot of economic theory focuses on what could have been done to avoid the
depression of the 1930's.

Modern governments have regulations and even whole agencies based on an
analysis of economic history.





>
> --
> William Black
>
> I've seen things you people wouldn't believe.
> Barbeques on fire by the chalets past the castle headland
> I watched the gift shops glitter in the darkness off the Newborough gate
> All these moments will be lost in time, like icecream on the beach
> Time for tea.
>
>