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

Discussion in 'Ruby' started by Lucas L., Sep 26, 2008.

  1. Lucas L.

    Lucas L. Guest

    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!
    --
    Posted via http://www.ruby-forum.com/.
    Lucas L., Sep 26, 2008
    #1
    1. Advertising

  2. Lucas L.

    Tim Hunter Guest

    Lucas L. wrote:
    > 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.

    --
    RMagick: http://rmagick.rubyforge.org/
    Tim Hunter, Sep 26, 2008
    #2
    1. Advertising

  3. Lucas L.

    Lucas L. Guest

    Tim Hunter wrote:
    > 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 */

    --------------------

    That doesn't really tell me anything except it couldn't find
    STAFRegister. Not quite sure what those programs are.
    --
    Posted via http://www.ruby-forum.com/.
    Lucas L., Sep 26, 2008
    #3
  4. Lucas L.

    Tim Hunter Guest

    Tim Hunter wrote:
    >
    > 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."

    --
    RMagick: http://rmagick.rubyforge.org/
    Tim Hunter, Sep 26, 2008
    #4
  5. Lucas L.

    Lucas L. Guest

    Tim Hunter wrote:
    > Tim Hunter wrote:
    >>
    >> 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."


    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??
    --
    Posted via http://www.ruby-forum.com/.
    Lucas L., Sep 26, 2008
    #5
  6. Lucas L.

    Tim Hunter Guest

    Lucas L. wrote:
    > Tim Hunter wrote:
    >> Tim Hunter wrote:
    >>> 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."

    >
    > 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.

    --
    RMagick: http://rmagick.rubyforge.org/
    Tim Hunter, Sep 26, 2008
    #6
  7. 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.

    --
    Nobu Nakada
    Nobuyoshi Nakada, Sep 26, 2008
    #7
  8. Lucas L.

    Lucas L. Guest

    Nobuyoshi Nakada wrote:
    > --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).
    --
    Posted via http://www.ruby-forum.com/.
    Lucas L., Sep 29, 2008
    #8
  9. Lucas L.

    Lucas L. Guest

    Lucas L. wrote:
    > Nobuyoshi Nakada wrote:
    >> --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).

    (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.
    --
    Posted via http://www.ruby-forum.com/.
    Lucas L., Sep 29, 2008
    #9
  10. Hi,

    At Mon, 29 Sep 2008 09:50:27 +0900,
    Lucas L. wrote in [ruby-talk:316284]:
    > > 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).


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

    --
    Nobu Nakada
    Nobuyoshi Nakada, Sep 29, 2008
    #10
  11. Lucas L.

    Lucas L. Guest

    Nobuyoshi Nakada wrote:
    > Hi,
    >
    > At Mon, 29 Sep 2008 09:50:27 +0900,
    > Lucas L. wrote in [ruby-talk:316284]:
    >> > 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).

    >
    > 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!
    --
    Posted via http://www.ruby-forum.com/.
    Lucas L., Oct 3, 2008
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    3,439
    Slartibartfast
    Oct 7, 2003
  2. Replies:
    0
    Views:
    270
  3. hy2

    possible bug in mkmf lib

    hy2, Oct 23, 2004, in forum: Ruby
    Replies:
    5
    Views:
    129
  4. Replies:
    0
    Views:
    129
  5. Ittay Dror
    Replies:
    1
    Views:
    107
    Nobuyoshi Nakada
    Dec 7, 2008
Loading...

Share This Page