Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A GCC linking question (on Windows)

158 views
Skip to first unread message

Helmut Giese

unread,
Oct 7, 2022, 4:11:27 PM10/7/22
to
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

Ted Nolan <tednolan>

unread,
Oct 7, 2022, 5:47:14 PM10/7/22
to
In article <ln01khttu38f7i2o1...@4ax.com>,
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..

Helmut Giese

unread,
Oct 8, 2022, 2:30:21 PM10/8/22
to
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
0 new messages