mkmf problems

S

Stu

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
 
T

ts

S> how do I tell mkmf in extconf to use mingw instead of microsoft
S> 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%

S> the other thing is, how do I tell mkmf to include only certain
S> ..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
 
S

Stu

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

By default it use the compiler used to compile ruby.

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
 
T

ts

S> doesnt that make it, pretty well broken then?

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


Guy Decoux
 
S

Stu

S> 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
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
 
T

ts

S> so everyone downloading the 1click installer on windows
S> 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.

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

This is not really the fault to mkmf


Guy Decoux
 
V

Ville Mattila

Stu said:
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
 
N

nobu.nokada

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?
 
V

Ville Mattila

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
 
N

nobu.nokada

Hi,

At Mon, 6 Dec 2004 00:12:42 +0900,
Ville Mattila wrote in [ruby-talk:122592]:
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.
 
V

Ville Mattila

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,786
Messages
2,569,626
Members
45,328
Latest member
66Teonna9

Latest Threads

Top