• OT: Problem with GCC

    From Helmut Giese@21:1/5 to All on Tue Sep 27 21:54:51 2022
    Hello out there,
    not being a regular user of GCC it has always been somewhat of a
    mystery to me. However, I thought that I knew the trivial basics, like
    how to compile a single file - but apparently not. Consider the screen
    dump below:
    ---
    d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>c:\msys64\mingw64\bin\gcc
    --version
    gcc (Rev10, Built by MSYS2 project) 11.2.0
    Copyright (C) 2021 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There
    is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
    PURPOSE.


    d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>c:\msys64\mingw64\bin\gcc -c
    restrgram.c

    d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>c:\msys64\mingw64\bin\gcc -c non-existing.c

    d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>
    ---
    The first call seems to acknowledge that this is, in fact, GCC. The
    second should have produced lots of error messages because of
    #include(s) not found, etc. And the third should complain that
    'non-existing.c' in fact didn't exist - but nothing.
    I think I recall that I have been using GCC in the past without
    problem - though possibly not this particular incantation.

    Anyway, if somebody could shed some light on this (for me) mystery it
    would be greatly appreciated.
    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ted Nolan @21:1/5 to [email protected] on Tue Sep 27 21:26:55 2022
    In article <[email protected]>,
    Helmut Giese <[email protected]> wrote:
    Hello out there,
    not being a regular user of GCC it has always been somewhat of a
    mystery to me. However, I thought that I knew the trivial basics, like
    how to compile a single file - but apparently not. Consider the screen
    dump below:
    ---
    d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>c:\msys64\mingw64\bin\gcc
    --version
    gcc (Rev10, Built by MSYS2 project) 11.2.0
    Copyright (C) 2021 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There
    is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
    PURPOSE.


    d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>c:\msys64\mingw64\bin\gcc -c >restrgram.c

    d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>c:\msys64\mingw64\bin\gcc -c >non-existing.c

    d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>
    ---
    The first call seems to acknowledge that this is, in fact, GCC. The
    second should have produced lots of error messages because of
    #include(s) not found, etc. And the third should complain that >'non-existing.c' in fact didn't exist - but nothing.
    I think I recall that I have been using GCC in the past without
    problem - though possibly not this particular incantation.

    Anyway, if somebody could shed some light on this (for me) mystery it
    would be greatly appreciated.
    Helmut

    Well, I haven't run gcc on windows in a couple of years, and did
    it then from inside cygwin or, um, msys, but you could try "gcc -v"
    to make it be a bit more verbose about what it's doing perhaps.
    --
    columbiaclosings.com
    What's not in Columbia anymore..

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Wed Sep 28 12:02:02 2022
    * Helmut Giese <[email protected]>
    | d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>c:\msys64\mingw64\bin\gcc -c
    | non-existing.c

    Looks like you're running this inside a DOS command shell?
    Might be an issue with the standard channels (stdin/stdout/stderr), or
    some additional environment variables required.

    Try running it from a Mingw terminal window and see whether this makes a difference.

    HTH
    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arjen Markus@21:1/5 to Ralf Fassel on Wed Sep 28 03:54:21 2022
    On Wednesday, September 28, 2022 at 12:02:07 PM UTC+2, Ralf Fassel wrote:
    * Helmut Giese
    | d:\proj\_ToolsSE\C2Tcl\lex-yacc\tcl2c>c:\msys64\mingw64\bin\gcc -c
    | non-existing.c
    Looks like you're running this inside a DOS command shell?
    Might be an issue with the standard channels (stdin/stdout/stderr), or
    some additional environment variables required.

    Try running it from a Mingw terminal window and see whether this makes a difference.

    HTH
    R'
    I think the program simply dies because some component cannot find the necessary DLLs. Running from a MinGW terminal ought to set up the path correctly. I cannot confim it, of course, because on my system gcc, even the one from MinGW, seems to be able to
    run fine. But a program simply dying is often the result of missing DLLs.

    Regards,

    Arjen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Giese@21:1/5 to All on Wed Sep 28 17:29:27 2022
    Hello,
    @Ted: I did try '-v' and this resulted in an enormous amount of output
    - but still no error message and no .o file generated.
    @Ralf: Apparently running from an MSYS terminal does make a
    difference.
    @Arjen: Yes, this might explain it.

    Meanwhile, after copying the source files into an'MSYS' directory I
    now have three .o files there.However, I ave been unable to link with
    Tcl's stub library. Consider the screen dump below:

    hgiese@ratiosoft MINGW64 ~/Parser
    $ dir
    libtcl86.a parse.c restrgram.c restrgram.o std-lex.o
    libtclstub86.a parse.o restrgram.h std-lex.c tclstub86.lib

    hgiese@ratiosoft MINGW64 ~/Parser
    $ 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

    In this directory I have
    - 3 source files
    - the corresponding .o files
    - the stub lib I want to link with
    - even the .a files following a suggestion found via Google
    to no avail: It cannot find tclstub86.lib
    Why?
    If you have any suggestion this would be great.

    In any case: thanks so far.
    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ted Nolan @21:1/5 to [email protected] on Wed Sep 28 15:55:46 2022
    In article <[email protected]>,
    Helmut Giese <[email protected]> wrote:
    Hello,
    @Ted: I did try '-v' and this resulted in an enormous amount of output
    - but still no error message and no .o file generated.
    @Ralf: Apparently running from an MSYS terminal does make a
    difference.
    @Arjen: Yes, this might explain it.

    Meanwhile, after copying the source files into an'MSYS' directory I
    now have three .o files there.However, I ave been unable to link with
    Tcl's stub library. Consider the screen dump below:

    hgiese@ratiosoft MINGW64 ~/Parser
    $ dir
    libtcl86.a parse.c restrgram.c restrgram.o std-lex.o
    libtclstub86.a parse.o restrgram.h std-lex.c tclstub86.lib

    hgiese@ratiosoft MINGW64 ~/Parser
    $ 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

    In this directory I have
    - 3 source files
    - the corresponding .o files
    - the stub lib I want to link with
    - even the .a files following a suggestion found via Google
    to no avail: It cannot find tclstub86.lib
    Why?
    If you have any suggestion this would be great.

    In any case: thanks so far.
    Helmut

    The usual use of "-lwhatever" searches for "libwhatever.a", so I'm not surprised -l tclstub86.lib confuses it. Maybe "-l libtclstub86" to use
    the libtclstub86.a file?
    --
    columbiaclosings.com
    What's not in Columbia anymore..

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Wed Sep 28 18:44:58 2022
    * Helmut Giese <[email protected]>
    | hgiese@ratiosoft MINGW64 ~/Parser
    | $ 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

    You either give the .lib as file _or_ as option:

    gcc ... tclstub86.lib

    gcc ... -ltclstub86

    But as Ted explained, in the latter case gcc (or rather the linker) is
    probably looking for a libtclstub86.a (at least it would on Linux/Unix,
    don't know for windows).

    HTH
    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Giese@21:1/5 to [email protected] on Wed Sep 28 20:38:45 2022
    [email protected] (Ted Nolan <tednolan>) schrieb:
    The usual use of "-lwhatever" searches for "libwhatever.a", so I'm not >surprised -l tclstub86.lib confuses it. Maybe "-l libtclstub86" to use
    the libtclstub86.a file?
    Many, many thanks - you made my day.
    While 'gcc -shared parse.o restrgram.o std-lex.o -o./parse.dll -L .
    -l libtclstub86' did not work, it lead to a hint by GCC saying
    '.../ld.exe: note to link with .\libtclstub86.a use -l:libtclstub86.a'
    - and this worked. I have now my DLL - ok, it doesn't work but that's
    a different story.
    The usual use of "-lwhatever" searches for "libwhatever.a"
    That's what one could call 'convention', which is well known to the
    'natives' but completely out of the world for an outsider (like me). I
    read '-l' refers to a library file - and the library was for me
    tclstub86.lib (note the extension?).
    Well, I'd bettter be prepared for more surprises like this.

    But for now I have to thank all of you because without your help I
    would never have arrived at this solution, no way.
    Many, many thanks
    Helmut

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arjen Markus@21:1/5 to Helmut Giese on Wed Sep 28 23:46:20 2022
    On Wednesday, September 28, 2022 at 8:38:48 PM UTC+2, Helmut Giese wrote:
    ...
    That's what one could call 'convention', which is well known to the
    'natives' but completely out of the world for an outsider (like me). I
    read '-l' refers to a library file - and the library was for me
    tclstub86.lib (note the extension?).
    Well, I'd bettter be prepared for more surprises like this.

    But for now I have to thank all of you because without your help I
    would never have arrived at this solution, no way.
    Many, many thanks
    Helmut

    Consistency is so overrated and boring! Why settle for one way of working, when you can have a multitude?

    Regards,

    Arjen

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