Mkmf problems

I cant seem to find any substantial docs on the net for mkmf..

i'm trying to create a new C routine, but my compiler is mingw
yet mkmf/extconf keeps generating a Makefile for use with
cl.exe (microsoft compiler)...

how do I tell mkmf in extconf to use mingw instead of microsoft
compiler cl.exe ....... ???

the other thing is, how do I tell mkmf to include only certain
..c files rather than *.c? (or the inverse, what not to include?)

I have support files for unix/win32, and one cant be compiled
on the other (and shouldnt)..

but mkmf has just globbed *.c on me.. which is fine except for
1 or 2 files!!

-- Stu --
[FAQ] Write Your Own Operating System
    http://www.mega-tokyo.com/osfaq2

how do I tell mkmf in extconf to use mingw instead of microsoft
compiler cl.exe ....... ???

By default it use the compiler used to compile ruby.

If you really want to change

uln% ls
a.c b.c
uln%

uln% ruby -rmkmf -e 'CONFIG["CC"] = "xxx"; create_makefile("a")'
creating Makefile
uln%

uln% make
xxx -fPIC -g -O2 -I. -I/usr/local/lib/ruby/1.8/x86_64-linux -I/usr/local/lib/ruby/1.8/x86_64-linux -I. -c a.c
make: xxx: Command not found
make: *** [a.o] Error 127
uln%

the other thing is, how do I tell mkmf to include only certain
..c files rather than *.c? (or the inverse, what not to include?)

define $objs

uln% ruby -rmkmf -e '$objs = ["a.o"]; create_makefile("a")'
creating Makefile
uln%

uln% make
gcc -fpic -fPIC -g -O2 -I. -I/usr/local/lib/ruby/1.8/x86_64-linux -I/usr/local/lib/ruby/1.8/x86_64-linux -I. -c a.c
gcc -fpic -shared -L"/usr/local/lib" -o a.so a.o -ldl -lcrypt -lm -lc
uln%

Guy Decoux

doesnt that make it, pretty well broken then?
not everyone compiles their own ruby distribution...

now I just need to figure out how to package my little
dodad up properly...

-- Stu --
[FAQ] Write Your Own Operating System
    http://www.mega-tokyo.com/osfaq2

···

On Sun, 5 Dec 2004 02:50:48 +0900, ts <decoux@moulon.inra.fr> wrote:

how do I tell mkmf in extconf to use mingw instead of microsoft
compiler cl.exe ....... ???

By default it use the compiler used to compile ruby.

doesnt that make it, pretty well broken then?

no, you can have problems if you mix 2 differents compiler.

Guy Decoux

so everyone downloading the 1click installer on windows
needs the exact same setup as those who built the installer
if they want to build anything... be it custom extensions or
just building gem's (ncurses is a nice example of this)...

it just means mkmf is kinda borked because it ASSUMES too much.

-- Stu --
[FAQ] Write Your Own Operating System
    http://www.mega-tokyo.com/osfaq2

···

On Sun, 5 Dec 2004 19:44:06 +0900, ts <decoux@moulon.inra.fr> wrote:

doesnt that make it, pretty well broken then?

no, you can have problems if you mix 2 differents compiler.

so everyone downloading the 1click installer on windows
needs the exact same setup as those who built the installer

I know nothing about Windows, but I think that you can have
incompatibilities if you mix 2 differents compilers.

it just means mkmf is kinda borked because it ASSUMES too much.

This is not really the fault to mkmf

Guy Decoux

Stu <ceaser@rome.net> writes:

so everyone downloading the 1click installer on windows
needs the exact same setup as those who built the installer
if they want to build anything... be it custom extensions or
just building gem's (ncurses is a nice example of this)...

it just means mkmf is kinda borked because it ASSUMES too much.

   1click installer and mingw build extensions should be binary
   compatible. However cygwin build extensions might cause troubles.

   I think it would be good idea that, Mkmf.rb could warn if it finds
   that different compiler is used to build extensions.

- Ville

Hi,

At Sun, 5 Dec 2004 20:52:37 +0900,
Ville Mattila wrote in [ruby-talk:122579]:

   I think it would be good idea that, Mkmf.rb could warn if it finds
   that different compiler is used to build extensions.

mkmf.rb just uses specified compiler, or how can it know what
it should call?

···

--
Nobu Nakada

nobu.nokada@softhome.net writes:

Hi,

At Sun, 5 Dec 2004 20:52:37 +0900,
Ville Mattila wrote in [ruby-talk:122579]:

   I think it would be good idea that, Mkmf.rb could warn if it finds
   that different compiler is used to build extensions.

mkmf.rb just uses specified compiler, or how can it know what
it should call?

What I meant that mkmf could warn, if the current compiler differs with
rbconfig['CC'] compiler.

- Ville

Hi,

At Mon, 6 Dec 2004 00:12:42 +0900,
Ville Mattila wrote in [ruby-talk:122592]:

>> I think it would be good idea that, Mkmf.rb could warn if it finds
>> that different compiler is used to build extensions.
>
> mkmf.rb just uses specified compiler, or how can it know what
> it should call?

What I meant that mkmf could warn, if the current compiler differs with
rbconfig['CC'] compiler.

Config::CONFIG['CC'] in rbconfig.rb is the current compiler.
There is nothing else.

···

--
Nobu Nakada

What I meant that mkmf could warn, if the current compiler differs with
rbconfig['CC'] compiler.

Config::CONFIG['CC'] in rbconfig.rb is the current compiler.
There is nothing else.

   Oops, I just read the Guy's example again. You are right. Sorry
   about the confusion. How about adding RUBY_CC that tells the complier
   that was used to compiler ruby binary?

   - Ville