mkmf can't find lib then gives target pattern contains no %

L

Lucas L.

Hello,
I am trying to build a STAF extension for ruby (not made by me). It
comes with a very simple extconf.rb file:

require 'mkmf'

dir_config('staf')
have_library('STAF', 'STAFRegister')
create_makefile("STAFHandle")

However, no matter how I specify the directory (I've tried
-with-staf-dir=c:\STAF, -with-staf-lib=c:\STAF\lib, etc) it gives:

checking for STAFRegister() in STAF.lib... no
creating Makefile

I tried to make anyway, but unsuprisingly, it fails. It gives
"Makefile:126: *** target pattern contains no `%'. Stop." The offending
line:
{$(topdir)}.cc{}.obj:
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)

I'm running ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32],
whatever version of mkmf that comes with the windows one-click installer
and GNU make 3.79.1.

Thanks!
 
T

Tim Hunter

Lucas said:
Hello,
I am trying to build a STAF extension for ruby (not made by me). It
comes with a very simple extconf.rb file:

require 'mkmf'

dir_config('staf')
have_library('STAF', 'STAFRegister')
create_makefile("STAFHandle")

However, no matter how I specify the directory (I've tried
-with-staf-dir=c:\STAF, -with-staf-lib=c:\STAF\lib, etc) it gives:

checking for STAFRegister() in STAF.lib... no
creating Makefile

Check the mkmf.log file. It should give you some indication as to why it
couldn't checking for STAFRegister in STAF.lib failed.
 
L

Lucas L.

Tim said:
Check the mkmf.log file. It should give you some indication as to why it
checking for STAFRegister in STAF.lib failed.

Whoops, I knew I'd forget something.
I did try, but I couldn't make any sense of it. Here it is:

have_library: checking for STAFRegister() in STAF.lib...
-------------------- no

"cl -nologo -Feconftest -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I.
-Ic:/ruby/lib/ruby/1.8/i386-mswin32 -MD -Zi -O2b2xg- -G6 conftest.c
msvcrt-ruby18-static.lib STAF.lib oldnames.lib user32.lib advapi32.lib
ws2_32.lib -link -libpath:"." -libpath:"c:/ruby/lib"
-stack:0x2000000"
checked program was:
/* begin */
1: #define WIN32_LEAN_AND_MEAN
2: #include <winsock2.h>
3: #include <windows.h>
4:
5: /*top*/
6: int main() { return 0; }
7: int t() { void ((*volatile p)()); p = (void ((*)()))STAFRegister;
return 0; }
/* end */

"cl -nologo -Feconftest -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I.
-Ic:/ruby/lib/ruby/1.8/i386-mswin32 -MD -Zi -O2b2xg- -G6 conftest.c
msvcrt-ruby18-static.lib STAF.lib oldnames.lib user32.lib advapi32.lib
ws2_32.lib -link -libpath:"." -libpath:"c:/ruby/lib"
-stack:0x2000000"
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { STAFRegister(); return 0; }
/* end */
 
T

Tim Hunter

Tim said:
Check the mkmf.log file. It should give you some indication as to why it
couldn't checking for STAFRegister in STAF.lib failed.

Er, I mean "as to why checking for STAFRegister in STAF.lib failed."
 
L

Lucas L.

Tim said:
Er, I mean "as to why checking for STAFRegister in STAF.lib failed."

I posted it above, but I don't get it. I have no idea why there seems to
be two C files there. Are they what mkmf compiled to check for
STAFRegister??
 
T

Tim Hunter

Lucas said:
I posted it above, but I don't get it. I have no idea why there seems to
be two C files there. Are they what mkmf compiled to check for
STAFRegister??

Yes. This is how mkmf "checks" for things, by compiling and/or linking
very small programs and checking the return code from the compiler or
linker. You have to have some familiarity with the compiler and linker
to be able to understand what's going on and to interpret the results.

Regrettably I don't know anything about the Windows compiler and linker.
Your best bet is to contact whoever is responsible for this extension.
 
N

Nobuyoshi Nakada

Hi,

At Fri, 26 Sep 2008 09:36:27 +0900,
Lucas L. wrote in [ruby-talk:316037]:
However, no matter how I specify the directory (I've tried
-with-staf-dir=c:\STAF, -with-staf-lib=c:\STAF\lib, etc) it gives:
--with-staf-dir=...

{$(topdir)}.cc{}.obj:
$(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)

This is a makefile for nmake.
I'm running ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32],
whatever version of mkmf that comes with the windows one-click installer
and GNU make 3.79.1.

The one-click installer is compiled with VC6. You have to
compile ruby with gcc and GNU make by yourself. Once you could
compile the extension, the resulted binary is compatible with
the one-click installer.
 
L

Lucas L.

Nobuyoshi said:
--with-staf-dir=...
Whoops. I actually meant --, not -. Still doesn't work.
This is a makefile for nmake.

The one-click installer is compiled with VC6. You have to
compile ruby with gcc and GNU make by yourself. Once you could
compile the extension, the resulted binary is compatible with
the one-click installer.

Surely I can just use nmake? (I have VC2005).
 
L

Lucas L.

Lucas said:
Whoops. I actually meant --, not -. Still doesn't work.


Surely I can just use nmake? (I have VC2005).
(No edit on mailing list, sorry for double post)
Actually, both problems may be caused by VC2005. I haven't used it for a
while and cl throws all these errors, which would make mkmf fail too.
I'll try re-installing it.
 
N

Nobuyoshi Nakada

Hi,

At Mon, 29 Sep 2008 09:50:27 +0900,
Lucas L. wrote in [ruby-talk:316284]:
Surely I can just use nmake? (I have VC2005).

Since VC2005 is binary incompatible with VC6, so it's absolutely
impossible.
 
L

Lucas L.

Nobuyoshi said:
Hi,

At Mon, 29 Sep 2008 09:50:27 +0900,
Lucas L. wrote in [ruby-talk:316284]:
Surely I can just use nmake? (I have VC2005).

Since VC2005 is binary incompatible with VC6, so it's absolutely
impossible.

Not according to a blog post I read the other day. It said you can fake
it by changing the manifest and commenting out the line that checks or
something.
Anyway, not wanting to play with Ruby, I managed to get VC6 and it
compiled, but I got segfaults when using the class. Not much I can do
about that...

Thanks anyway!
 

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

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,701
Latest member
XavierQ83

Latest Threads

Top