• Re: Building Code Again (was: How About Disallowing Assignments In Expr

    From Michael S@21:1/5 to bart on Wed Feb 14 14:14:10 2024
    On Wed, 14 Feb 2024 11:30:14 +0000
    bart <bc@freeuk.com> wrote:

    All such choices have a flaw: you need to bundle a binary program to
    act as scripting language, whether it is an interpreter for C or
    anything else.

    This is what we're trying to avoid, otherwise we'd just build the app ourselves and supply the binary.

    If that scripting language is provided as source code, then the
    problem we're trying to solve with building the app, then applies
    also to the scripting language.

    There is only one thing that can be assumed, or that can be
    stipulated, which is that a C compiler is present.


    It depends.
    I mean, surely if one wants to build software written in C then he has
    to have C compiler capable of producing executables for his intended
    target. But it does not mean that he necessarily has C compiler that
    can build executables for his build host.
    The scenario where build host's native compiler either does not present
    or does present, but your potential user has no idea about how to use
    it, is not hypothetical in a slightest. There are legions of MCU C
    programmers that develop complex applications within vendor-supplied
    GUIs under Windows, but when you ask them to compile a simplest
    "native" app on the same machine, they have no idea where to start.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to bart on Wed Feb 14 13:40:57 2024
    On 14/02/2024 12:30, bart wrote:
    On 14/02/2024 10:11, David Brown wrote:
    I would prefer most of all to see its flaws and non-conformities
    fixed. It should not be particularly hard to do.

    No. Maybe you could do it next weekend.


    The flaws I know about in Pico C are an invalid <stbool.h>, and
    promoting all integer calculations to "long int" rather than "int".
    (That one I read about in a registered issue.)

    The first can be fixed by removing <stdbool.h> from the interpreter.
    That should be very easily done.

    The second can be fixed by using the same size for "int" and "long".
    For modern use, there is no real advantage in having "int" smaller than
    64 bits. Even if someone wanted to use Pico C as a C interpreter built
    into a small embedded system, using 64-bit int would not make any
    noticeable difference. Alternatively, on platforms where it mattered,
    Pico C could use 32-bit for both "int" and "long".

    A more elaborate fix that supported correct C integer promotions would,
    I expect, be more demanding. The same goes for implementing a proper
    _Bool. But step one should be to fix the flaws, and that should be a
    small matter. Enhancements and improvements can come later.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Michael S on Wed Feb 14 14:17:07 2024
    On 14/02/2024 12:14, Michael S wrote:
    On Wed, 14 Feb 2024 11:30:14 +0000
    bart <bc@freeuk.com> wrote:

    All such choices have a flaw: you need to bundle a binary program to
    act as scripting language, whether it is an interpreter for C or
    anything else.

    This is what we're trying to avoid, otherwise we'd just build the app
    ourselves and supply the binary.

    If that scripting language is provided as source code, then the
    problem we're trying to solve with building the app, then applies
    also to the scripting language.

    There is only one thing that can be assumed, or that can be
    stipulated, which is that a C compiler is present.


    It depends.
    I mean, surely if one wants to build software written in C then he has
    to have C compiler capable of producing executables for his intended
    target. But it does not mean that he necessarily has C compiler that
    can build executables for his build host.
    The scenario where build host's native compiler either does not present
    or does present, but your potential user has no idea about how to use
    it, is not hypothetical in a slightest. There are legions of MCU C programmers that develop complex applications within vendor-supplied
    GUIs under Windows, but when you ask them to compile a simplest
    "native" app on the same machine, they have no idea where to start.



    I don't think cross-compiling is a typical scenario. I'm considering
    only two parties: the developer with source code who wants someone else
    to build it remotely on their machine.

    It starts to get complicated as you say if there was a middleman
    creating multiple binaries to be distributed to end-users.

    It was 2014 (10 years ago), that I first posted a link here to a
    substantial 18Kloc project of mine (a language interpreter, not in C),
    that was made available as a single C source file.

    The idea was for something to be as a simple to build as hello.c, and
    actually that was the case on Windows:

    gcc prog.c

    (On Linux it needed also -lm and -ldl, and in practice needed also -o prog.)

    However, people got wound up with the quality of the generated C code
    (that wasn't the point). And many weren't at all impressed with having
    to type 'gcc prog.c -o prog.exe -O3' when they were used to typing:

    make

    I began to suspect that some people (not in this group) didn't actually
    know how to build hello.c from a command line.

    An analogy would be where I'd reduced the job of installing a kitchen to hammering in one nail, but somebody didn't know how to use a hammer.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to bart on Wed Feb 14 16:03:11 2024
    bart <bc@freeuk.com> writes:
    On 14/02/2024 12:14, Michael S wrote:
    On Wed, 14 Feb 2024 11:30:14 +0000
    bart <bc@freeuk.com> wrote:

    All such choices have a flaw: you need to bundle a binary program to
    act as scripting language, whether it is an interpreter for C or
    anything else.

    This is what we're trying to avoid, otherwise we'd just build the app
    ourselves and supply the binary.

    If that scripting language is provided as source code, then the
    problem we're trying to solve with building the app, then applies
    also to the scripting language.

    There is only one thing that can be assumed, or that can be
    stipulated, which is that a C compiler is present.


    It depends.
    I mean, surely if one wants to build software written in C then he has
    to have C compiler capable of producing executables for his intended
    target. But it does not mean that he necessarily has C compiler that
    can build executables for his build host.
    The scenario where build host's native compiler either does not present
    or does present, but your potential user has no idea about how to use
    it, is not hypothetical in a slightest. There are legions of MCU C
    programmers that develop complex applications within vendor-supplied
    GUIs under Windows, but when you ask them to compile a simplest
    "native" app on the same machine, they have no idea where to start.



    I don't think cross-compiling is a typical scenario.

    What data do you base that conclusion on? At my CPOE,
    it's about 75% cross-compiling and 25% host compiles.

    And none of our projects are trivial enough to use your suggested
    build systems.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Scott Lurndal on Wed Feb 14 17:04:44 2024
    On 14/02/2024 16:03, Scott Lurndal wrote:
    bart <bc@freeuk.com> writes:
    On 14/02/2024 12:14, Michael S wrote:
    On Wed, 14 Feb 2024 11:30:14 +0000
    bart <bc@freeuk.com> wrote:

    All such choices have a flaw: you need to bundle a binary program to
    act as scripting language, whether it is an interpreter for C or
    anything else.

    This is what we're trying to avoid, otherwise we'd just build the app
    ourselves and supply the binary.

    If that scripting language is provided as source code, then the
    problem we're trying to solve with building the app, then applies
    also to the scripting language.

    There is only one thing that can be assumed, or that can be
    stipulated, which is that a C compiler is present.


    It depends.
    I mean, surely if one wants to build software written in C then he has
    to have C compiler capable of producing executables for his intended
    target. But it does not mean that he necessarily has C compiler that
    can build executables for his build host.
    The scenario where build host's native compiler either does not present
    or does present, but your potential user has no idea about how to use
    it, is not hypothetical in a slightest. There are legions of MCU C
    programmers that develop complex applications within vendor-supplied
    GUIs under Windows, but when you ask them to compile a simplest
    "native" app on the same machine, they have no idea where to start.



    I don't think cross-compiling is a typical scenario.

    What data do you base that conclusion on? At my CPOE,
    it's about 75% cross-compiling and 25% host compiles.

    And none of our projects are trivial enough to use your suggested
    build systems.


    And none of /my/ projects are non-trivial enough to warrant the use of
    yours.

    You yourself brought up netppm in another post. A set of Windows
    binaries consists of 300 EXE files with an average size of 30KB each
    (roughly 3KLoC).

    Surely each of those should count as trivial? And yet the build system
    is made much more elaborate than it should be.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to bart on Wed Feb 14 17:58:10 2024
    bart <bc@freeuk.com> writes:
    On 14/02/2024 16:03, Scott Lurndal wrote:

    I don't think cross-compiling is a typical scenario.

    What data do you base that conclusion on? At my CPOE,
    it's about 75% cross-compiling and 25% host compiles.

    And none of our projects are trivial enough to use your suggested
    build systems.


    And none of /my/ projects are non-trivial enough to warrant the use of
    yours.

    We all know about your hobby projects.


    You yourself brought up netppm in another post. A set of Windows
    binaries consists of 300 EXE files with an average size of 30KB each
    (roughly 3KLoC).

    On my linux system, it's a single shared object. 243kbytes in size.

    $ rpm -ql netpbm
    /usr/lib64/libnetpbm.so.11
    /usr/lib64/libnetpbm.so.11.61
    /usr/share/doc/netpbm
    /usr/share/doc/netpbm/COPYRIGHT.PATENT
    /usr/share/doc/netpbm/GPL_LICENSE.txt
    /usr/share/doc/netpbm/HISTORY
    /usr/share/doc/netpbm/README
    /usr/share/doc/netpbm/copyright_summary
    $ ls -lh /usr/lib64/libnetpbm.so.11.61
    -rwxr-xr-x. 1 root root 234K Dec 12 2013 /usr/lib64/libnetpbm.so.11.61

    That can be linked directly into an application, if the header files
    are also installed:

    $ rpm -ql netpbm-devel
    /usr/include/netpbm
    /usr/include/netpbm/bitio.h
    /usr/include/netpbm/colorname.h
    /usr/include/netpbm/mallocvar.h
    /usr/include/netpbm/pam.h
    /usr/include/netpbm/pamdraw.h
    /usr/include/netpbm/pammap.h
    /usr/include/netpbm/pbm.h
    /usr/include/netpbm/pbmfont.h
    /usr/include/netpbm/pgm.h
    /usr/include/netpbm/pm.h
    /usr/include/netpbm/pm_config.h
    /usr/include/netpbm/pm_gamma.h
    /usr/include/netpbm/pm_system.h
    /usr/include/netpbm/pnm.h
    /usr/include/netpbm/ppm.h
    /usr/include/netpbm/ppmcmap.h
    /usr/include/netpbm/ppmdfont.h
    /usr/include/netpbm/ppmdraw.h
    /usr/include/netpbm/ppmfloyd.h
    /usr/include/netpbm/shhopt.h
    /usr/lib64/libnetpbm.so
    /usr/share/man/man3/libmaketmpfile.3.gz /usr/share/man/man3/libmaketmpfilefd.3.gz
    /usr/share/man/man3/libnetpbm.3.gz
    /usr/share/man/man3/libnetpbm_draw.3.gz /usr/share/man/man3/libnetpbm_image.3.gz
    /usr/share/man/man3/libnetpbm_ug.3.gz
    /usr/share/man/man3/libpbm.3.gz
    /usr/share/man/man3/libpgm.3.gz
    /usr/share/man/man3/libpm.3.gz
    /usr/share/man/man3/libpnm.3.gz
    /usr/share/man/man3/libppm.3.gz
    /usr/share/man/man3/libsystem.3.gz
    /usr/share/man/man3/libtmpfile.3.gz
    /usr/share/man/man3/libtmpfilefd.3.gz

    And, if needed, the user can load the programs, which are typically
    12kbytes.

    $ ls -lh /usr/bin/spctoppm
    -rwxr-xr-x. 1 root root 12K Dec 12 2013 /usr/bin/spctoppm
    $ file /usr/bin/spctoppm
    /usr/bin/spctoppm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=ee61519004e5bb41705f1b8da4471edf052aefa2, stripped
    $ ldd /usr/bin/spctoppm
    linux-vdso.so.1 => (0x00007ffd6838f000)
    libnetpbm.so.11 => /lib64/libnetpbm.so.11 (0x00007ffaca1fd000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003a4f600000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003a4ea00000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003a4e600000)


    Surely each of those should count as trivial?

    Indeed.

    And yet the build system is made much more elaborate than it should be.

    No, it is as elaborate as it needs to be. It supports dozens of host compilation environments.

    As it is today, there are binary installation packages included in every
    linux distribution, so from the user standapoint, it's a matter of
    a simple 'rpm', 'yum', 'apt' or whatever package manager the distribution supports (all of which also have package manager GUIs for the
    ex-windows crowd).

    That it is more complicated on Windows isn't commentary on the netpbm
    package, it is commentary on the unsuitability of windows.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Scott Lurndal on Wed Feb 14 19:35:50 2024
    On 14/02/2024 17:58, Scott Lurndal wrote:
    bart <bc@freeuk.com> writes:
    On 14/02/2024 16:03, Scott Lurndal wrote:

    I don't think cross-compiling is a typical scenario.

    What data do you base that conclusion on? At my CPOE,
    it's about 75% cross-compiling and 25% host compiles.

    And none of our projects are trivial enough to use your suggested
    build systems.


    And none of /my/ projects are non-trivial enough to warrant the use of
    yours.

    We all know about your hobby projects.

    The primary subject of this newsgroup is an ancient programming language
    that can be implemented in 180KB.

    My main projects revolve around a similar programming language that can
    be implemented in a few hundred KB.

    By your standards, BOTH are trivial.


    And yet the build system is made much more elaborate than it should be.

    No, it is as elaborate as it needs to be.

    No, it is a lot MORE elaborate than it needs to be.

    /I/ can't see why a C program that translates one file to another, which
    should be entirely portable, needs anything other than whatever C
    compiler is avaiable on ANY platform.

    Here's a program that translates JPEG files to PPM files; it's called
    nano.c:

    c:\cx>mcc nano
    Compiling nano.c to nano.exe

    It should be /that/ simple.

    That it is more complicated on Windows isn't commentary on the netpbm package, it is commentary on the unsuitability of windows.

    It's commentary on the fact that the build process is designed to use
    lots of extraneous dependencies, ones that themselves expect to run
    under a Unix-like environment.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to bart on Wed Feb 14 20:07:59 2024
    On 14/02/2024 19:35, bart wrote:
    On 14/02/2024 17:58, Scott Lurndal wrote:
    bart <bc@freeuk.com> writes:
    On 14/02/2024 16:03, Scott Lurndal wrote:

    I don't think cross-compiling is a typical scenario.

    What data do you base that conclusion on?     At my CPOE,
    it's about 75% cross-compiling and 25% host compiles.

    And none of our projects are trivial enough to use your suggested
    build systems.


    And none of /my/ projects are non-trivial enough to warrant the use of
    yours.

    We all know about your hobby projects.

    The primary subject of this newsgroup is an ancient programming language
    that can be implemented in 180KB.

    My main projects revolve around a similar programming language that can
    be implemented in a few hundred KB.

    By your standards, BOTH are trivial.


    And yet the build system  is made much more elaborate than it should be. >>
    No, it is as elaborate as it needs to be.

    No, it is a lot MORE elaborate than it needs to be.

    /I/ can't see why a C program that translates one file to another, which should be entirely portable, needs anything other than whatever C
    compiler is avaiable on ANY platform.

    Here's a program that translates JPEG files to PPM files; it's called
    nano.c:

      c:\cx>mcc nano
      Compiling nano.c to nano.exe

    It should be /that/ simple.

    That it is more complicated on Windows isn't commentary on the netpbm
    package, it is commentary on the unsuitability of windows.

    It's commentary on the fact that the build process is designed to use
    lots of extraneous dependencies, ones that themselves expect to run
    under a Unix-like environment.



    Do you really expect a non-trivial program to consist on only one source
    file? How would that work with many people all working on the some
    file? Merges would be a nightmare.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Richard Harnden on Wed Feb 14 21:01:39 2024
    On 14/02/2024 20:07, Richard Harnden wrote:
    On 14/02/2024 19:35, bart wrote:
    On 14/02/2024 17:58, Scott Lurndal wrote:
    bart <bc@freeuk.com> writes:
    On 14/02/2024 16:03, Scott Lurndal wrote:

    I don't think cross-compiling is a typical scenario.

    What data do you base that conclusion on?     At my CPOE,
    it's about 75% cross-compiling and 25% host compiles.

    And none of our projects are trivial enough to use your suggested
    build systems.


    And none of /my/ projects are non-trivial enough to warrant the use of >>>> yours.

    We all know about your hobby projects.

    The primary subject of this newsgroup is an ancient programming
    language that can be implemented in 180KB.

    My main projects revolve around a similar programming language that
    can be implemented in a few hundred KB.

    By your standards, BOTH are trivial.


    And yet the build system  is made much more elaborate than it should
    be.

    No, it is as elaborate as it needs to be.

    No, it is a lot MORE elaborate than it needs to be.

    /I/ can't see why a C program that translates one file to another,
    which should be entirely portable, needs anything other than whatever
    C compiler is avaiable on ANY platform.

    Here's a program that translates JPEG files to PPM files; it's called
    nano.c:

       c:\cx>mcc nano
       Compiling nano.c to nano.exe

    It should be /that/ simple.

    That it is more complicated on Windows isn't commentary on the netpbm
    package, it is commentary on the unsuitability of windows.

    It's commentary on the fact that the build process is designed to use
    lots of extraneous dependencies, ones that themselves expect to run
    under a Unix-like environment.



    Do you really expect a non-trivial program to consist on only one source file?  How would that work with many people all working on the some
    file?  Merges would be a nightmare.


    I don't understand your comment or how it fits in with what I'm saying.

    NETPPM apparently consists of 100s of small, individual programs. Even
    SL agreed they were trivial. Many seem to be implemented as a single C
    file to perform the task.

    So why can't I compile even one such file?

    I haven't looked at NETPPM before but I'm not that impressed. The
    organisation is messy. The docs are all over the place. The project
    looks ancient.

    On the one hand, there are 300 small programs, on the other, there is a
    200KB shared library, but it doesn't look like you can just eliminate
    those programs (one is 650KB, it can't possibly just be a wrapper around
    one of the functions in that library).

    Whatever the merits of the C code, it seems to be drowning in a sea of configuration and build processes.

    I'm not going to use it myself anyway. I've worked with innumerable
    image formats (many of them my own) forever, without any such help.

    What /would/ impress me more is a portable, non-partisan C library that
    is able to stand by itself with zero dependencies.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to bart on Wed Feb 14 21:47:43 2024
    bart <bc@freeuk.com> writes:
    On 14/02/2024 20:07, Richard Harnden wrote:

    Do you really expect a non-trivial program to consist on only one source
    file?  How would that work with many people all working on the some
    file?  Merges would be a nightmare.


    I don't understand your comment or how it fits in with what I'm saying.

    NETPPM apparently consists of 100s of small, individual programs. Even
    SL agreed they were trivial. Many seem to be implemented as a single C
    file to perform the task.

    So why can't I compile even one such file?

    That is entirely _your_ problem.


    I haven't looked at NETPPM before but I'm not that impressed. The >organisation is messy. The docs are all over the place. The project
    looks ancient.

    As has been mentioned, it's as old as the world wide web. Yet,
    here it more than 30 years later, widely used and widely available.


    On the one hand, there are 300 small programs, on the other, there is a
    200KB shared library, but it doesn't look like you can just eliminate
    those programs (one is 650KB, it can't possibly just be a wrapper around
    one of the functions in that library).

    The source is freely available. Why don't you look at it instead
    of complaining about it?

    I've never read so many complaints from one person.


    What /would/ impress me more is a portable, non-partisan C library that
    is able to stand by itself with zero dependencies.

    Feel free to develop one yourself if you think it is so easy. Make sure
    it builds and functions correctly on all the mainstream operating systems, including android, IOS, Linux, Windows and the legacy Unix distributions.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Wed Feb 14 21:48:53 2024
    On Wed, 14 Feb 2024 11:30:14 +0000, bart wrote:

    All such choices have a flaw: you need to bundle a binary program to act
    as scripting language ...

    There are quite a few scripting languages that are in such common use, it becomes reasonable that the target system will have these either already installed, or easily installable. Assuming it is a reasonable type of
    target system, with integrated package management.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Wed Feb 14 21:51:07 2024
    On Wed, 14 Feb 2024 14:17:07 +0000, bart wrote:

    ... many weren't at all impressed with having
    to type 'gcc prog.c -o prog.exe -O3' when they were used to typing:

    make

    I began to suspect that some people (not in this group) didn't actually
    know how to build hello.c from a command line.

    An analogy would be where I'd reduced the job of installing a kitchen to hammering in one nail, but somebody didn't know how to use a hammer.

    How about another analogy, where people who are accustomed to cars with automatic transmissions where you just move the lever to “D” to move off, and you tell them they have to press the clutch before they can select a
    gear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Scott Lurndal on Thu Feb 15 01:07:33 2024
    On 14/02/2024 21:47, Scott Lurndal wrote:
    bart <bc@freeuk.com> writes:
    On 14/02/2024 20:07, Richard Harnden wrote:

    Do you really expect a non-trivial program to consist on only one source >>> file?  How would that work with many people all working on the some
    file?  Merges would be a nightmare.


    I don't understand your comment or how it fits in with what I'm saying.

    NETPPM apparently consists of 100s of small, individual programs. Even
    SL agreed they were trivial. Many seem to be implemented as a single C
    file to perform the task.

    So why can't I compile even one such file?

    That is entirely _your_ problem.


    Bollocks it is.

    Somebody could add even extra layers of pointless complexity to the
    build process, but who would notice?

    There appears to be nobody in Unix who questions such things; everyone
    takes takes at face value. So long as it eventually produces a result,
    no matter how long it takes or how torturous the process, nobody cares.

    Well, have you considered that that may have alread happened?

    The source is freely available. Why don't you look at it instead
    of complaining about it?

    I've spent an hour looking at the 270,000 lines of source code. I was
    going to extract bits of to put together one mini app, but I eventually
    lost the will to live.

    Here, why write one line when half a dozen will do? Why not chain a
    dozen function calls needlessly just to make it harder to hunt down the underlying function? Urghh...

    It's not how I'd write it.

    I've never read so many complaints from one person.

    Here's a challenge: give me a reason not to complain.

    What /would/ impress me more is a portable, non-partisan C library that
    is able to stand by itself with zero dependencies.

    Feel free to develop one yourself if you think it is so easy. Make sure
    it builds and functions correctly on all the mainstream operating systems, including android, IOS, Linux, Windows and the legacy Unix distributions.

    What exactly is it about reading one file and writing another that you
    think makes that so challenging? Are you not aware that dealing with
    different platforms is the compiler's job?

    In any case, I've written so much image-handling stuff that I could do
    it in my sleep.

    With my current library, inverting an image looks like this when
    accessed from scripting code:

    a := bmload("test.pgm")
    bmsave("itest.pgm", bmneg(a))

    I do need help with complex compressed formats like JPG and PNG which
    need external support. But those are in hand using C solutions that ARE
    more amenable to use. I can pass those through my C compiler to create s suitable DLL.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to bart on Thu Feb 15 03:08:37 2024
    On 2024-02-15, bart <bc@freeuk.com> wrote:
    There appears to be nobody in Unix who questions such things; everyone
    takes takes at face value. So long as it eventually produces a result,
    no matter how long it takes or how torturous the process, nobody cares.

    This is false. There are many critics "in Unix", of Makefiles, GNU
    Autotools, the C language including its preprocessing, the shell
    language, various utilities, POSIX API's, and almost imaginable element
    of the whole cornucopia. Many are well-informed, experienced and have well-reasoned opinions.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Thu Feb 15 08:56:20 2024
    On Thu, 15 Feb 2024 01:07:33 +0000, bart wrote:

    Bollocks it is.

    You keep insisting so. It would be simple enough to prove your point, by stripping out this “needless” complexity and proving you can build the
    code much more simply.

    Otherwise, you just fall into the “methinks he doth protest too much” school of Windows sufferers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Lawrence D'Oliveiro on Thu Feb 15 10:32:00 2024
    On 15/02/2024 08:56, Lawrence D'Oliveiro wrote:
    On Thu, 15 Feb 2024 01:07:33 +0000, bart wrote:

    Bollocks it is.

    You keep insisting so. It would be simple enough to prove your point, by stripping out this “needless” complexity and proving you can build the code much more simply.

    Otherwise, you just fall into the “methinks he doth protest too much” school of Windows sufferers.

    This is exactly what I started doing, with a view to extracting some
    parts of it since I didn't need a 270Kloc library.

    Below is as far as I got in about an hour. This reads a PGM file from
    stdin, and writes a PGM file to stdout. This only does the headers. I
    need to decide what processing to do on the image data read from stdin
    before it's passed to stdout; I had in mind simply inverting the data.

    However, I just didn't like how it was done. The following is distilled
    quite a bit; if I wrote it, it would be a lot more compact. But
    generally reading and writing files like PGM is so trivial, that it
    would be easier to write it myself from scratch.

    I also like to read an entire file into a buffer, and write out an
    entire file, while this code prefers to do that serially. I gave an
    example of how that works now for me:

    a := bmload("test.pgm")
    bmsave("itest.pgm", bmneg(a))

    The point is, the C file below, even when completed, needs no special configuration process, no scripts, no makefiles, you just use a C compiler:

    c:\c>mcc inv
    Compiling inv.c to inv.exe

    c:\c>inv <test.pgm
    P5
    600 800
    255

    But perhaps /you/ can explain why such a INVERT tool would needs such an elaborate process:

    c:\net>mcc pnminvert.c
    Compiling pnminvert.c to pnminvert.exe
    netpbm/pm_config.h 18
    Can't find include file in:netpbm/pm.h Line: 17

    Even if I use WSL to get a pm_config.h file, it goes wrong on something
    else.

    ------------------------------------------
    #include <stdio.h>
    #include <stdlib.h>
    #include <limits.h>

    #define PGM_MAGIC1 'P'
    #define PGM_MAGIC2 '2'
    #define RPGM_MAGIC2 '5'
    #define PGM_FORMAT (PGM_MAGIC1 * 256 + PGM_MAGIC2)
    #define RPGM_FORMAT (PGM_MAGIC1 * 256 + RPGM_MAGIC2)
    #define PGM_TYPE PGM_FORMAT

    void pm_error(char* mess) {
    puts(mess);
    exit(1);
    }

    void pm_error2(char* mess, int ich) {
    printf(mess, ich);
    exit(1);
    }

    char pm_getc(FILE * const fileP) {
    int ich;
    char ch;

    ich = getc(fileP);
    if (ich == EOF)
    pm_error("EOF / read error reading a byte");
    ch = (char) ich;

    if (ch == '#') {
    do {
    ich = getc(fileP);
    if (ich == EOF)
    pm_error("EOF / read error reading a byte");
    ch = (char) ich;
    } while (ch != '\n' && ch != '\r');
    }
    return ch;
    }

    int pm_readmagicnumber(FILE * const ifP) {

    int ich1, ich2;

    ich1 = getc(ifP);

    if (ich1 == EOF)
    pm_error("Error reading first byte of what is expected to be "
    "a Netpbm magic number. "
    "Most often, this means your input file is empty");

    ich2 = getc(ifP);

    if (ich2 == EOF)
    pm_error2("Error reading second byte of what is expected to be "
    "a Netpbm magic number (the first byte was successfully "
    "read as 0x%02x)", ich1);

    return ich1 * 256 + ich2;
    }


    unsigned int pm_getuint(FILE * const ifP) {
    char ch;
    unsigned int i;

    do {
    ch = pm_getc(ifP);
    } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');

    if (ch < '0' || ch > '9')
    pm_error("junk in file where an unsigned integer should be");

    i = 0;
    do {
    unsigned int const digitVal = ch - '0';

    if (i > INT_MAX/10)
    pm_error("ASCII decimal integer in file is "
    "too large to be processed. ");

    i *= 10;

    if (i > INT_MAX - digitVal)
    pm_error("ASCII decimal integer in file is "
    "too large to be processed. ");

    i += digitVal;

    ch = pm_getc(ifP);
    } while (ch >= '0' && ch <= '9');

    return i;
    }

    void pgm_readpgminitrest(FILE * const fileP,
    int * const colsP,
    int * const rowsP,
    int * const maxvalP) {

    int maxval;

    /* Read size. */
    *colsP = (int)pm_getuint(fileP);
    *rowsP = (int)pm_getuint(fileP);

    /* Read maxval. */
    maxval = pm_getuint(fileP);
    *maxvalP = maxval;
    }

    void pgm_readpgminit(FILE * const fileP,
    int * const colsP,
    int * const rowsP,
    int * const maxvalP,
    int * const formatP) {

    int realFormat;

    /* Check magic number. */
    realFormat = pm_readmagicnumber(fileP);

    switch (realFormat) {
    case PGM_TYPE:
    *formatP = realFormat;
    pgm_readpgminitrest(fileP, colsP, rowsP, maxvalP);
    break;

    default:
    pm_error2("bad magic number 0x%x - not a PPM, PGM, PBM, or PAM
    file",
    realFormat);
    }
    }

    void pgm_writepgminit(FILE * const fileP,
    int const cols,
    int const rows,
    int const maxval,
    int const binary) {

    fprintf(fileP, "%c%c\n%d %d\n%d\n",
    PGM_MAGIC1,
    binary? PGM_MAGIC2 : RPGM_MAGIC2,
    cols, rows, maxval );
    }


    int main(void) {
    FILE* f = stdin;
    FILE* g = stdout;
    int rows, cols, format, maxval;

    pgm_readpgminit(f, &cols, &rows, &maxval, &format);
    pgm_writepgminit(g, cols, rows, maxval, 0);
    //
    // if (PNM_FORMAT_TYPE(format) == PBM_TYPE)
    // /* Take fast path */
    // invertPbm(ifP, stdout, cols, rows, format);
    // else
    // /* PPM , PGM (logic also works for PBM) */
    // invertPnm(ifP, stdout, cols, rows, maxval, format);
    //
    // pm_close(ifP);
    // pm_close(stdout);
    fclose(f);
    fclose(g);
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Kaz Kylheku on Thu Feb 15 11:44:58 2024
    On 15/02/2024 03:08, Kaz Kylheku wrote:
    On 2024-02-15, bart <bc@freeuk.com> wrote:
    There appears to be nobody in Unix who questions such things; everyone
    takes takes at face value. So long as it eventually produces a result,
    no matter how long it takes or how torturous the process, nobody cares.

    This is false. There are many critics "in Unix", of Makefiles, GNU
    Autotools, the C language including its preprocessing, the shell
    language, various utilities, POSIX API's, and almost imaginable element
    of the whole cornucopia. Many are well-informed, experienced and have well-reasoned opinions.


    And yet I still can't trivially compile pnminvert.c into pnminvert.exe
    using just a C compiler.

    I need X, Y and Z to do so under WSL, and it still doesn't work. The
    following is after going through an interactive configure process
    (apparently I need half a dozen existing image DLLs already installed
    (isn't this supposed to replace them?), plus Libxml2, plus flex, plus my
    mingw installation apparently doesn't support all needed features.

    Even the message from the config process says, Do not be surprised if
    make fails.

    (This stuff always reminds me of the Tootsie-Frootsie sketch from the
    Marx Bros' A Day at the Races. You start with a simple requirement then
    end up with a massive pile of junk that in the end is unusable.)


    -----------------------
    ....
    make[2]: Leaving directory '/mnt/c/xxx/netpbm-10.86.40/lib/util'
    cc -shared -Wl,--image-base=0x10000000 -Wl,--enable-auto-import -Wl,--export-all-symbols \
    -Wl,-soname,libnetpbm10.dll \
    -Wl,--output-def,libnetpbm10.def \
    -Wl,--out-implib,libnetpbm.dll.a -o libnetpbm10.dll \
    libpm.o pmfileio.o fileio.o colorname.o libpamd.o libpbm1.o libpbm2.o libpbm3.o libpbmfont0.o libpbmfont1.o libpbmfont2.o
    pbmfontdata0.o pbmfontdata1.o pbmfontdata2.o libpgm1.o libpgm2.o
    libppm1.o libppm2.o libppmcmap.o libppmcolor.o libppmfuzzy.o libppmd.o ppmdfont.o standardppmdfont.o path.o libppmfloyd.o libpnm1.o libpnm2.o libpnm3.o libpam.o libpamread.o libpamwrite.o libpamn.o libpammap.o libpamcolor.o libsystem.o util/bitio.o util/filename.o util/io.o util/mallocvar.o util/matrix.o util/nsleep.o util/nstring.o
    util/runlength.o util/shhopt.o util/token.o util/vasprintf.o
    /usr/bin/ld: unrecognized option '--image-base=0x10000000'
    /usr/bin/ld: use the --help option for usage information
    collect2: error: ld returned 1 exit status
    make[1]: *** [/mnt/c/xxx/netpbm-10.86.40//lib/Makefile:143:
    libnetpbm10.dll] Error 1
    make[1]: Leaving directory '/mnt/c/xxx/netpbm-10.86.40/lib'
    make: *** [/mnt/c/xxx/netpbm-10.86.40/common.mk:573: lib/all] Error 2

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to bart on Thu Feb 15 15:10:02 2024
    bart <bc@freeuk.com> writes:
    On 14/02/2024 21:47, Scott Lurndal wrote:

    I've never read so many complaints from one person.

    Here's a challenge: give me a reason not to complain.

    Life is short and there are far better ways to spend
    one's time.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Scott Lurndal on Thu Feb 15 15:36:03 2024
    On 15/02/2024 15:10, Scott Lurndal wrote:
    bart <bc@freeuk.com> writes:
    On 14/02/2024 21:47, Scott Lurndal wrote:

    I've never read so many complaints from one person.

    Here's a challenge: give me a reason not to complain.

    Life is short and there are far better ways to spend
    one's time.

    You've expressed my thoughts exactly. Why should I waste /my/ grappling
    with someone else's mess of a build process?

    They invent loads of UNNECESSARY extra hoops to jump through, and expect everyone else, even those using different systems that don't even have
    those hoops, to do the same.

    You suggested netpbm to avoid reinventing wheels. Sure, if you can
    actually access the wheels and get them to turn!

    I take it however that you would never waste your time overhauling any
    process, any product, to make it smaller, tidier, nippier and generally
    more aesthetic?

    There is no satisfaction in producing something to be proud of,
    something elegant, instead of taking a big mess of a distribution,
    cramming it into box and scrawling 'makefile' on the side?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to bart on Thu Feb 15 16:40:19 2024
    On 2024-02-15, bart <bc@freeuk.com> wrote:
    On 15/02/2024 03:08, Kaz Kylheku wrote:
    On 2024-02-15, bart <bc@freeuk.com> wrote:
    There appears to be nobody in Unix who questions such things; everyone
    takes takes at face value. So long as it eventually produces a result,
    no matter how long it takes or how torturous the process, nobody cares.

    This is false. There are many critics "in Unix", of Makefiles, GNU
    Autotools, the C language including its preprocessing, the shell
    language, various utilities, POSIX API's, and almost imaginable element
    of the whole cornucopia. Many are well-informed, experienced and have
    well-reasoned opinions.


    And yet I still can't trivially compile pnminvert.c into pnminvert.exe
    using just a C compiler.

    Unsurprisingly, the existence of critics in the C and Unix world
    doesn't magically fix an obscure netpbm build problem.

    make[2]: Leaving directory '/mnt/c/xxx/netpbm-10.86.40/lib/util'
    cc -shared -Wl,--image-base=0x10000000 -Wl,--enable-auto-import

    Looks like the linker doesn't understand the --image-base option.

    That option exists somewhere for some good reason.

    I can't imagine why something like netpbm would need exotic linker
    options, but there is probably some reason it was introduced.

    I have this in the man page for ld:

    --image-base value
    Use value as the base address of your program or dll. This
    is the lowest memory location that will be used when your
    program or dll is loaded. To reduce the need to relocate
    and improve performance of your dlls, each should have a
    unique base address and not overlap any other dlls. The
    default is 0x400000 for executables, and 0x10000000 for
    dlls. [This option is specific to the i386 PE targeted
    port of the linker]

    It looks like stray cruft to me, and the value they are using is
    the documented default one anyway.

    It would be more productive to take this up with the netpbm project
    than the comp.lang.c newsgroup.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Kaz Kylheku on Thu Feb 15 18:02:41 2024
    On 15/02/2024 16:40, Kaz Kylheku wrote:
    On 2024-02-15, bart <bc@freeuk.com> wrote:
    On 15/02/2024 03:08, Kaz Kylheku wrote:
    On 2024-02-15, bart <bc@freeuk.com> wrote:
    There appears to be nobody in Unix who questions such things; everyone >>>> takes takes at face value. So long as it eventually produces a result, >>>> no matter how long it takes or how torturous the process, nobody cares. >>>
    This is false. There are many critics "in Unix", of Makefiles, GNU
    Autotools, the C language including its preprocessing, the shell
    language, various utilities, POSIX API's, and almost imaginable element
    of the whole cornucopia. Many are well-informed, experienced and have
    well-reasoned opinions.


    And yet I still can't trivially compile pnminvert.c into pnminvert.exe
    using just a C compiler.

    Unsurprisingly, the existence of critics in the C and Unix world
    doesn't magically fix an obscure netpbm build problem.

    make[2]: Leaving directory '/mnt/c/xxx/netpbm-10.86.40/lib/util'
    cc -shared -Wl,--image-base=0x10000000 -Wl,--enable-auto-import

    Looks like the linker doesn't understand the --image-base option.

    That option exists somewhere for some good reason.

    I can't imagine why something like netpbm would need exotic linker
    options, but there is probably some reason it was introduced.

    Quite. I can't imagine why it would need lots of other less exotic
    things too. It's hard to think of a set of tasks that would be more
    portable.

    It's just more opportunities for failure and more limited portability.

    It would be more productive to take this up with the netpbm project
    than the comp.lang.c newsgroup.

    This is not specific to that product, it's just something that came up,
    which I decided to investigate. But it seems to be quite typical.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to David Brown on Thu Feb 15 21:29:17 2024
    On 15/02/2024 21:16, David Brown wrote:
    On 15/02/2024 16:36, bart wrote:
    On 15/02/2024 15:10, Scott Lurndal wrote:
    bart <bc@freeuk.com> writes:
    On 14/02/2024 21:47, Scott Lurndal wrote:

    I've never read so many complaints from one person.

    Here's a challenge: give me a reason not to complain.

    Life is short and there are far better ways to spend
    one's time.

    You've expressed my thoughts exactly. Why should I waste /my/
    grappling with someone else's mess of a build process?

    A lot of us wonder about that too.  Even stranger, you don't waste your
    time trying to understand the issues you are having, or fixing them, you waste all of our times griping about them here - to people who didn't
    make the build systems in question, who aren't in a position to fix
    them, don't have the same problems themselves, and are not at all
    interested in the software in question.  And when we /do/ try to help,
    you don't listen - you just whine more.

    I recommend you think hard about what you are doing with all that, and perhaps consider spending your time some other way.  Like talking about
    C, or asking questions about the many things you don't understand about
    C.  Even whining about the things you don't like about C would be better than whining about things you don't like about build processes!



    I was under the impression that applications and libraries that were
    written in C, were written in C.

    Apparently I was wrong. It seems almost unheard of to be able to create
    a runnable version of a C program by simply compiling the source code.

    Because there's some unwritten rule that they must use at least half the features of Linux-Unix in order to achieve that.

    How about that, a famously portable language that can only be built if
    you have half of Linux to hand.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to bart on Thu Feb 15 22:16:08 2024
    On 15/02/2024 16:36, bart wrote:
    On 15/02/2024 15:10, Scott Lurndal wrote:
    bart <bc@freeuk.com> writes:
    On 14/02/2024 21:47, Scott Lurndal wrote:

    I've never read so many complaints from one person.

    Here's a challenge: give me a reason not to complain.

    Life is short and there are far better ways to spend
    one's time.

    You've expressed my thoughts exactly. Why should I waste /my/ grappling
    with someone else's mess of a build process?

    A lot of us wonder about that too. Even stranger, you don't waste your
    time trying to understand the issues you are having, or fixing them, you
    waste all of our times griping about them here - to people who didn't
    make the build systems in question, who aren't in a position to fix
    them, don't have the same problems themselves, and are not at all
    interested in the software in question. And when we /do/ try to help,
    you don't listen - you just whine more.

    I recommend you think hard about what you are doing with all that, and
    perhaps consider spending your time some other way. Like talking about
    C, or asking questions about the many things you don't understand about
    C. Even whining about the things you don't like about C would be better
    than whining about things you don't like about build processes!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to bart on Fri Feb 16 00:29:57 2024
    On 2024-02-15, bart <bc@freeuk.com> wrote:
    On 15/02/2024 16:40, Kaz Kylheku wrote:
    It would be more productive to take this up with the netpbm project
    than the comp.lang.c newsgroup.

    This is not specific to that product, it's just something that came up,
    which I decided to investigate. But it seems to be quite typical.

    I've never seen the above specific problem with the --image-base
    passed to the linker.

    There are many environments out there; and the people who make the
    software only work with a few (sometimes only one). If you only build
    your program on Linux, it might not work on WSL, MacOS, Cygwin or
    Solaris or what have you.

    It's not uncommon for people who build free software programs
    ("downstream people") into packages and distros to apply patches for one
    reason or another.

    One problem is that the downstream people don't always communicate
    with the developers ("upstream people"). It's less effort to just patch something in your world, and not inform upstream that you had to do
    this.

    Sometimes people have a negative experience reporting something
    upstream, which results them in having spent extra effort, yet still
    having to continue apply their rejected patch. That discourages them
    from trying again the next time they have to patch something in the
    same program or another.

    I've caught distros patching some of my programs for this and that, by
    peeking into their repos and bug reporting systems. I would secretly
    fixd the problem, making sure to do in a way such that their patch would
    not apply any more. Then watch them pick up a new release and remove the
    patch. No e-mails or anything exchanged at all.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to bart on Fri Feb 16 00:19:52 2024
    On 2024-02-15, bart <bc@freeuk.com> wrote:
    How about that, a famously portable language that can only be built if
    you have half of Linux to hand.

    "I have long stated that 90% of the C programs I have on file will not
    compile. Your estimate confirms my observation."

    -- Scott Nudds, Feb 3, 1997

    https://groups.google.com/g/comp.lang.c/c/J-FqEXoSVj8/m/xBhpjpCYB3cJ

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Fri Feb 16 04:45:25 2024
    On Thu, 15 Feb 2024 11:44:58 +0000, bart wrote:

    I need X, Y and Z to do so under WSL, and it still doesn't work.

    You have to give Microsoft a chance. WSL2 came out less than 5 years ago,
    so you can understand it still has a few bugs in it. You can’t expect WSL
    to be the sole focus of its attention, giving it is also trying to port
    Windows to ARM, and acquire game-development companies, and also building
    some kind of AI functionality into Windows.

    Wait for the next version, and see if that’s any better.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Fri Feb 16 04:42:58 2024
    On Thu, 15 Feb 2024 21:29:17 +0000, bart wrote:

    Apparently I was wrong. It seems almost unheard of to be able to create
    a runnable version of a C program by simply compiling the source code.

    For some reason, you seem to be particularly obsessed with C programs that
    you perceive to have this characteristic.

    Here’s some simple advice: avoid those C programs, and stick to ones
    written for Microsoft Windows. Problem solved.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Lawrence D'Oliveiro on Fri Feb 16 05:53:11 2024
    On 2024-02-16, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Thu, 15 Feb 2024 21:29:17 +0000, bart wrote:

    Apparently I was wrong. It seems almost unheard of to be able to create
    a runnable version of a C program by simply compiling the source code.

    For some reason, you seem to be particularly obsessed with C programs that you perceive to have this characteristic.

    Here’s some simple advice: avoid those C programs, and stick to ones written for Microsoft Windows. Problem solved.

    .. and have fun opening their Visual Studio 2005 project file in Visual
    Studio 2022. :)

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Malcolm McLean on Fri Feb 16 22:48:36 2024
    On Fri, 16 Feb 2024 09:54:36 +0000, Malcolm McLean wrote:

    Because I do algorithms development, quite often I have to download code written by someone else for an academic readership...

    And of course whilst I can sometimes choose my platform, generally I
    either can't ...

    What happens when an irresistible force meets an immovable object?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Fri Feb 16 23:05:46 2024
    On Thu, 15 Feb 2024 10:32:00 +0000, bart wrote:

    But perhaps /you/ can explain why such a INVERT tool would needs such an elaborate process:

    c:\net>mcc pnminvert.c Compiling pnminvert.c to pnminvert.exe
    netpbm/pm_config.h 18 Can't find include file in:netpbm/pm.h Line: 17

    pm_config.h is generated from a combination of pm_config.in.h,
    config.mk and possibly inttypes_netpbm.h. And that config.mk is
    generated from the Perl configure script. Just think of the amount of
    broken code out there, that it has to deal with this sort of thing:

    sub printBadPngConfigCflagsWarning($) {
    my ($pngCFlags) = @_;

    warnUser("'libpng-config' in this environment (a program in your PATH) " .
    "gives instructions that don't work for compiling for " .
    "(not linking with) the PNG library. " .
    "Our test compile failed. " .
    "This indicates Libpng is installed incorrectly " .
    "on this system. If so, your Netpbm build, " .
    "which uses 'libpng-config', will fail. " .
    "But it might also just be our test that is broken.");
    }

    sub pngLinkWorksWithLzLmMsg() {

    return
    "When we added \"-lz -lm\" to the linker flags, the link worked. " .
    "That means the fix for this may be to modify 'libpng-config' " .
    "so that 'libpng-config --ldflags' includes \"-lz -lm\" " .
    "in its output. But the right fix may actually " .
    "be to build libpng differently so that it specifies its dependency " .
    "on those libraries, or to put those libraries in a different " .
    "place, or to create missing symbolic links.";
    }

    sub printBadPngConfigLdflagsWarning($$) {
    my ($pngLdFlags, $lzLmSuccess) = @_;

    warnUser(
    "'libpng-config' in this environment (a program in your PATH) " .
    "gives instructions that don't work for linking " .
    "with the PNG library. Our test link failed. " .
    "This indicates Libpng is installed incorrectly on this system. " .
    "If so, your Netpbm build, which uses 'libpng-config', will fail. " .
    "But it might also just be our test that is broken. " .
    ($lzLmSuccess ? pngLinkWorksWithLzLmMsg : "")
    );
    }

    And look, it does supporting building on Windows as well, so maybe
    you’re just doing it wrong:

    if ($platform eq "WINDOWS") {
    my ($djgpp, $cygwin);

    if ($OSNAME eq "dos") {
    $djgpp = askAboutDjgpp();
    if ($djgpp) {
    $cygwin = $FALSE;
    } else {
    $cygwin = askAboutCygwin();
    }
    } else {
    $cygwin = askAboutCygwin();
    if ($cygwin) {
    $djgpp = $FALSE;
    } else {
    $djgpp = askAboutDjgpp();
    }
    }

    if ($cygwin) {
    $subplatform = "cygwin";
    } elsif ($djgpp) {
    $subplatform = "djgpp";
    } else {
    $subplatform = "other";
    }
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Lawrence D'Oliveiro on Fri Feb 16 23:41:15 2024
    On 16/02/2024 23:05, Lawrence D'Oliveiro wrote:
    On Thu, 15 Feb 2024 10:32:00 +0000, bart wrote:

    But perhaps /you/ can explain why such a INVERT tool would needs such an
    elaborate process:

    c:\net>mcc pnminvert.c Compiling pnminvert.c to pnminvert.exe
    netpbm/pm_config.h 18 Can't find include file in:netpbm/pm.h Line: 17

    pm_config.h is generated from a combination of pm_config.in.h,
    config.mk and possibly inttypes_netpbm.h. And that config.mk is
    generated from the Perl configure script. Just think of the amount of
    broken code out there, that it has to deal with this sort of thing:

    sub printBadPngConfigCflagsWarning($) {
    my ($pngCFlags) = @_;

    warnUser("'libpng-config' in this environment (a program in your PATH) " .
    "gives instructions that don't work for compiling for " .
    "(not linking with) the PNG library. " .
    "Our test compile failed. " .
    "This indicates Libpng is installed incorrectly " .
    "on this system. If so, your Netpbm build, " .
    "which uses 'libpng-config', will fail. " .
    "But it might also just be our test that is broken.");
    }

    sub pngLinkWorksWithLzLmMsg() {

    return
    "When we added \"-lz -lm\" to the linker flags, the link worked. " .
    "That means the fix for this may be to modify 'libpng-config' " .
    "so that 'libpng-config --ldflags' includes \"-lz -lm\" " .
    "in its output. But the right fix may actually " .
    "be to build libpng differently so that it specifies its dependency " .
    "on those libraries, or to put those libraries in a different " .
    "place, or to create missing symbolic links.";
    }

    sub printBadPngConfigLdflagsWarning($$) {
    my ($pngLdFlags, $lzLmSuccess) = @_;

    warnUser(
    "'libpng-config' in this environment (a program in your PATH) " .
    "gives instructions that don't work for linking " .
    "with the PNG library. Our test link failed. " .
    "This indicates Libpng is installed incorrectly on this system. " .
    "If so, your Netpbm build, which uses 'libpng-config', will fail. " .
    "But it might also just be our test that is broken. " .
    ($lzLmSuccess ? pngLinkWorksWithLzLmMsg : "")
    );
    }




    And look, it does supporting building on Windows as well, so maybe
    you’re just doing it wrong:

    That went wrong too. The third choice was 'mingw' not 'other'; but it
    then says:

    "MinGW does not implement enough of the standard on which Netpbm relies
    to build out-of-the-box,"

    MingW is pretty much gcc; so what esoteric features of the standard does
    it need?!

    netpbm is lots of small self-contained programs. The one I played with
    was pnminvert.c, to negate an image. What does that do? Well, it reads a
    file like this:

    P2
    6 8
    255
    121 130 109 88 150 153
    133 141 116 110 162 163
    145 152 131 66 169 174
    159 168 124 60 194 186
    173 183 143 55 208 204
    169 167 142 89 149 143
    65 151 176 156 218 212
    28 31 41 102 115 135

    And writes out a file like this:

    P2
    6 8
    255
    134 125 146 167 105 102
    122 114 139 145 93 92
    110 103 124 189 86 81
    96 87 131 195 61 69
    82 72 112 200 47 51
    86 88 113 166 106 112
    190 104 79 99 37 43
    227 224 214 153 140 120

    Notice that all the numbers after the three lines of the header, have
    been subtracted from 255.

    You can imagine that such a program can be written fairly simply (there
    are 7 different file formats along these lines).

    So why on earth do we need all that Perl nonsense to be able to compile
    this one C file?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Sun Feb 18 02:26:59 2024
    On Fri, 16 Feb 2024 23:41:15 +0000, bart wrote:

    You can imagine that such a program can be written fairly simply (there
    are 7 different file formats along these lines).

    No need to imagine--the source code is right there in front of you:

    ldo@theon:netpbm-free-11.05.02> wc -l editor/pnminvert.c
    120 editor/pnminvert.c

    Notice that all the numbers after the three lines of the header,
    have been subtracted from 255.

    Notice also that the code does not assume that pixel components have to be
    in [0 .. 255].

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