• A GCC linking question (on Windows)

    From Helmut Giese@21:1/5 to All on Fri Oct 7 22:11:23 2022
    Hello out there,
    some time ago I had a similar question and got help here. It solved
    part of the issue but not everything. Now I am somewhat more
    determined to work this out (now it hurts more). Consider the
    following screen dump from an MinGW64 window/terminal:
    ---
    hgiese@ratiosoft MINGW64 ~/c2tcl
    $ ls
    libtcl86.a parse.o restrgram.o sub-process.txt
    libtclstub86.a restrgram.c std-lex.c tclstub86.lib
    parse.c restrgram.h std-lex.o

    hgiese@ratiosoft MINGW64 ~/c2tcl
    $ gcc -shared parse.o restrgram.o std-lex.o -o./parse.dll -L . -l libtclstub86.a C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
    cannot find -llibtclstub86.a: No such file or directory
    collect2.exe: error: ld returned 1 exit status

    hgiese@ratiosoft MINGW64 ~/c2tcl
    $ gcc -shared parse.o restrgram.o std-lex.o -o./parse.dll -L . -l
    tclstub86.lib C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
    cannot find -ltclstub86.lib: No such file or directory
    collect2.exe: error: ld returned 1 exit status
    ---
    As you can see in the first dump it contains three .o, two .a and one
    .lib file. Still GCC complains that it cannot find either the .a or
    the .lib file - in spite of the '-L .' option.
    What is going on here?
    An help will be greatly appreciated.
    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ted Nolan @21:1/5 to hgiese@ratiosoft.com on Fri Oct 7 21:47:09 2022
    In article <ln01khttu38f7i2o18lvdqonu3hpuebtu0@4ax.com>,
    Helmut Giese <hgiese@ratiosoft.com> wrote:
    Hello out there,
    some time ago I had a similar question and got help here. It solved
    part of the issue but not everything. Now I am somewhat more
    determined to work this out (now it hurts more). Consider the
    following screen dump from an MinGW64 window/terminal:
    ---
    hgiese@ratiosoft MINGW64 ~/c2tcl
    $ ls
    libtcl86.a parse.o restrgram.o sub-process.txt
    libtclstub86.a restrgram.c std-lex.c tclstub86.lib
    parse.c restrgram.h std-lex.o

    hgiese@ratiosoft MINGW64 ~/c2tcl
    $ gcc -shared parse.o restrgram.o std-lex.o -o./parse.dll -L . -l >libtclstub86.a >C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
    cannot find -llibtclstub86.a: No such file or directory
    collect2.exe: error: ld returned 1 exit status

    hgiese@ratiosoft MINGW64 ~/c2tcl
    $ gcc -shared parse.o restrgram.o std-lex.o -o./parse.dll -L . -l >tclstub86.lib >C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
    cannot find -ltclstub86.lib: No such file or directory
    collect2.exe: error: ld returned 1 exit status
    ---
    As you can see in the first dump it contains three .o, two .a and one
    .lib file. Still GCC complains that it cannot find either the .a or
    the .lib file - in spite of the '-L .' option.
    What is going on here?
    An help will be greatly appreciated.
    Helmut

    To use libtclstub86.a, try

    gcc -shared parse.o restrgram.o std-lex.o -o./parse.dll -L . -ltclstub86

    that is: Don't include either the 'lib' or the '.a'

    To use tclstub86.lib, my best guess would be just to give the
    name of the file bare as in

    gcc -shared parse.o restrgram.o std-lex.o -o./parse.dll -L. tclstub86.lib

    (The -L may not even be needed here).

    That assumes that the mingw ld.exe understands native Windows libraries,
    which I don't really remember one way or the other as it's been quite
    a while since I've mingw-ed.
    --
    columbiaclosings.com
    What's not in Columbia anymore..

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Giese@21:1/5 to All on Sat Oct 8 20:30:16 2022
    Hello Ted,
    To use libtclstub86.a, try

    gcc -shared parse.o restrgram.o std-lex.o -o./parse.dll -L . -ltclstub86

    that is: Don't include either the 'lib' or the '.a'

    To use tclstub86.lib, my best guess would be just to give the
    name of the file bare as in
    spot on: '-ltclstub86' did the trick. Now I only have to find out why
    my DLL isn't doing what it should - but this is another story.
    Many thanks, you saved my day.
    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)