http://qs1969.pair.com?node_id=939680


in reply to Re^3: h2xs on Windows
in thread h2xs on Windows

LIBS => "-L. -lopensc",

Yes, did that. MakeMaker complains that it has to expand the path and that it doesn't find opensc. But the dll is actually there:

C:\src\chipcard_neu\opensc\Maplat-CCReader>perl Makefile.PL Set up gcc environment - 3.4.5 (mingw-vista special r3) Warning: '-L.' changed to '-LC:/src/chipcard_neu/opensc/Maplat-CCReade +r/.' Note (probably harmless): No library found for -lopensc MakeMaker (v6.56) Warning (non-fatal): Target 'dynamic' depends on targets in skipped se +ction 'dyn amic_lib' Warning (non-fatal): Target 'static' depends on targets in skipped sec +tion 'stat ic_lib' Writing Makefile for Maplat::CCReader::ccreadlib Writing Makefile for Maplat::CCReader C:\src\chipcard_neu\opensc\Maplat-CCReader>dir *.dll Volume in Laufwerk C: hat keine Bezeichnung. Volumeseriennummer: 8CF0-773E Verzeichnis von C:\src\chipcard_neu\opensc\Maplat-CCReader 15.07.2011 13:49 1.468.416 opensc.dll 1 Datei(en) 1.468.416 Bytes 0 Verzeichnis(se), 1.699.016.704 Bytes frei

Then i run dmake -v for a while and then it breaks when making the CCReader.dll on this command:

C:\Perl\site\bin\g++.exe -o blib\arch\auto\Maplat\CCReader\CCReader.dl +l -Wl,--ba se-file -Wl,dll.base -mdll -L"C:\Perl\lib\CORE" CCReader.o -Wl,--image +-base,0x22 270000 ccreadlib/libccreadlib.a C:\Perl\lib\CORE\perl512.lib C:\Perl\s +ite\lib\au to\MinGW\lib\libkernel32.a C:\Perl\site\lib\auto\MinGW\lib\libuser32.a + C:\Perl\s ite\lib\auto\MinGW\lib\libgdi32.a C:\Perl\site\lib\auto\MinGW\lib\libw +inspool.a C:\Perl\site\lib\auto\MinGW\lib\libcomdlg32.a C:\Perl\site\lib\auto\Mi +nGW\lib\li badvapi32.a C:\Perl\site\lib\auto\MinGW\lib\libshell32.a C:\Perl\site\ +lib\auto\M inGW\lib\libole32.a C:\Perl\site\lib\auto\MinGW\lib\liboleaut32.a C:\P +erl\site\l ib\auto\MinGW\lib\libnetapi32.a C:\Perl\site\lib\auto\MinGW\lib\libuui +d.a C:\Per l\site\lib\auto\MinGW\lib\libws2_32.a C:\Perl\site\lib\auto\MinGW\lib\ +libmpr.a C :\Perl\site\lib\auto\MinGW\lib\libwinmm.a C:\Perl\site\lib\auto\MinGW\ +lib\libver sion.a C:\Perl\site\lib\auto\MinGW\lib\libodbc32.a C:\Perl\site\lib\au +to\MinGW\l ib\libodbccp32.a C:\Perl\site\lib\auto\MinGW\lib\libcomctl32.a C:\Perl +\site\lib\ auto\MinGW\lib\libmsvcrt.a dll.exp

It fails with a lot of "undefined reference" messages, all for functions in opensc.dll:
ccreadlib/libccreadlib.a(ccreadlib.o):ccreadlib.c:(.text+0x2c): undefi +ned refere nce to `sc_card_ctl' ccreadlib/libccreadlib.a(ccreadlib.o):ccreadlib.c:(.text+0x144): undef +ined refer ence to `sc_release_context' ccreadlib/libccreadlib.a(ccreadlib.o):ccreadlib.c:(.text+0x157): undef +ined refer ence to `sc_unlock' ccreadlib/libccreadlib.a(ccreadlib.o):ccreadlib.c:(.text+0x164): undef +ined refer ence to `sc_disconnect_card' ...

If i run this command manually and add -L. -lopensc, it works. Then i can continue the run of dmake to completion. The tests that use the DLL-functions run fine and everything.

Don't use '#ff0000':
use Acme::AutoColor; my $redcolor = RED();
All colors subject to change without notice.

Replies are listed 'Best First'.
Re^5: h2xs on Windows
by Anonymous Monk on Nov 23, 2011 at 15:12 UTC
    Try prefixing LIBS with ":nosearch", don't ask me to explain this idiocy

      Try prefixing LIBS with ":nosearch"

      YES!!!! (insert image of me jumping up and down in joy to a comic sound)

      That did it! Thanks! You just saved my day!

      don't ask me to explain this idiocy

      Oh, come on. Since this problem will probably affect other people too, it could be helpfull.

      Don't use '#ff0000':
      use Acme::AutoColor; my $redcolor = RED();
      All colors subject to change without notice.

        don't ask me to explain this idiocy

        Oh, come on. Since this problem will probably affect other people too, it could be helpfull.

        Um, I can't explain, why the maintainers of ExtUtils::Liblist, "improved" their module, by necessitating :nosearch to get the old default behaviour

        I can't even remember why/when it changed, just that old way of people did things, you might get a dozen

        Note (probably harmless): No library found for -ltcl86 Note (probably harmless): No library found for -lmoldname Note (probably harmless): No library found for -lkernel32

        messages, but each and every -ltcl86 still got forwarded to the compiler/linker, and if the compiler/linker couldn't find -ltcl86 and it was really needed, then it would throw an error, and you'd know which one of the harmless warnings weren't harmless after all

        For example, mingw gcc, when you tell it -ltcl86, knows to check for a whole bunch of variations tcl86.lib, tcl86.a, tcl86.la, tcl86.o, libtcl86.lib, libtcl86.a, libtcl86.la, libtcl86.o... because it knows how to handle all these (both .a and .lib)

        But, MakeMaker/Liblist, after decades of letting the compiler/linker handle it as usual, finally tries to do its intended job (i guess), but it only consults

        $ perl -V:lib_ext lib_ext='.a';

        Which doesn't quite work for windows/mingw/gcc combination

        note: I'm aware some of the details above aren't 100% accurate, but the general gist is, liblist removes libs the compiler knows how to handle, :nosearch restores the old default