https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120189
Bug ID: 120189 Summary: documented link command does not work Product: gcc Version: 15.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: modula2 Assignee: gaius at gcc dot gnu.org Reporter: bruno at clisp dot org Target Milestone: --- Three observation about https://gcc.gnu.org/onlinedocs/gm2/Building-a-shared-library.html : 1) It is not clear what is the point of adding a program module (c.mod) to a shared library. This concept is not known to C and C++. I created a Modula-2 library without any program module, and that worked fine. 2) Why are two different options (-fmakelist, -fmakeinit) used here to generate the scaffolding? Does the option -fscaffold-main, documented in https://gcc.gnu.org/onlinedocs/gm2/Example-usage.html, not work here? 3) In the third step, a library '-lgm2' does not exist. Trying to compile a hello-world sample with 'gcc' in 'gm2': $ gcc hello.mod -lgm2 hello.mod:1:1: note: In program module ‘Hello’: dynamic linking enabled but no module ctor list has been created, hint use -fuse-list=filename or -fgen-module-list=- 1 | MODULE Hello; | ^~~~~~ /usr/bin/ld: cannot find -lgm2: No such file or directory collect2: error: ld returned 1 exit status The minimal list of -l options that I need for a hello-world program, when linking with gcc instead of gm2 (since that is the default for libtool libraries in Automake) is -lm2pim -lm2log -lm2iso -lstdc++ For a shared library, which of -lm2pim -lm2log -lm2iso are needed, seems to depend on the list of symbols required by the Modula-2 code in that library. Whereas -lstdc++ is apparently only needed for the scaffolding, whose use is questionable (see topic 1 above).