cfedorag-wanansi-c

How to configure ANSI C toolchain on Fedora 36 so G-WAN can compile and run C scripts?


I have unpacked gwan server, put a basic hello world file in a listener and tried to run it, however gwan won't run C scripts and claims that "ANSI C" is not installed:

$ ./gwan
 

allowed sockets: 1024 ('sudo ./gwan' to let G-WAN use more sockets)

loading
             index.c: to use    .c scripts, install ANSI C..



_________________________________________________________________
|                                                               |
| G-WAN Web App. Server v7.12.6   64-bit (Feb  8 2016 16:33:28) |
|_______________________________________________________________|

I have installed "Development Tools" and "Development Libraries" package groups, and gwan detects gcc 12.1.1. In gwan log I see:

[Sat Jul 23 07:21:08 2022 GMT] gcc version 12.1.1 20220507
[Sat Jul 23 07:21:08 2022 GMT] minify:n caches: query_char:? default_lang:ANSI C

I checked if similar problem will be with other scripts, but python and lua scripts run fine.

Just to be sure that development toolchain works I have checked if I can compile simple hello world program using gcc alone and it was successful. I also built and installed weighttp from source files, and it runs correctly.

I also read through gwan faq but didn't find similar issue described there.

I suspect some kind of package or environment variable is missing on my OS. Any suggestions what could be the issue?


Solution

  • The short story: One of the reasons is that GCC, a compiler supporting different target languages (such a C/C++/Objective-C...), no-longer accepts "Ansi C" as a designation of the C programming language (it's now "c").

    The long story: G-WAN 2009, originally published for Windows, embedded its own C compiler to avoid system changes to cause problems - and such measures are now required on Linux because:

    After 2014, distributions of Linux have installed recent versions of GCC, which has changed several things that have progressively broken G-WAN features (caching, compiling, etc.):

    The Linux distributions themselves have had a role by forcing system defaults (linking options, linker versions, PATHs, system policies, kernel configuration options, etc.), and sometimes incompatible versions of libraries and tools (Ubuntu 22.04 provides an addr2line version that is not in sync. with the GCC 11 it distributes so DWARF symbols are not found).

    Because the march of these changes keeps accelerating as time goes, it becomes increasingly difficult for non-funded projects to keep-up with the myriads of random changes that each (well-funded) Linux distribution (Ubuntu, Fedora, Red Hat, SUSE, etc.) is injecting, sometimes during a simple update (not even a new version).

    I have discovered the above only recently because my system was broken by a system update and I had to install a new Ubuntu release (22.04).

    My view, as a asm/C programmer for 46 years, is that the way out of this ever-growing complexity will come with simpler code that is less integrated to any given system. POSIX is a widely shared standard among operating systems and, even if you can't benefit from the newest features of each OS, at least it will make your code run for decades (and on a wider range of platforms).

    I have already written such a (feature-stripped) G-WAN version for long-term users who hire us to help them make G-WAN applications.

    The new G-WAN does not seem to suffer much from having ditched Linux epoll() - on the contrary, its:

    Proof that, in the long term, creativity will still find its way.