<div dir="ltr"><div>Thank you very much. After rebuilding with newer version of ecl and with :init-name supplied compilation was a success.</div><div><br></div><div>However, when i try to run the resulting executable, i get this error:</div><div><br></div><div>Condition of type: SIMPLE-ERROR<br>Package ((UIOP/STREAM . #<UIOP/STREAM package>)) referenced in compiled file<br>  NIL<br>but has not been created<br><br>Available restarts:<br><br>1. (IGNORE) Ignore the error, and try the operation again</div><div><br></div><div>What should be done in this situation and how can i avoid it? Searching internet with this message did not yield any meaningful results (except for one Stackoverflow post that tells about having the same mistake).<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">вт, 1 дек. 2020 г. в 22:15, Marius Gerbershagen <<a href="mailto:marius.gerbershagen@gmail.com">marius.gerbershagen@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The generated library does indeed contain all systems that your library <br>
contains on. The undefined references are init functions, which need to <br>
be called via ecl_init_module after cl_boot to initialize the compiled <br>
libraries (see <br>
<a href="https://common-lisp.net/project/ecl/static/manual/System-building.html#Build-it-as-shared-library-and-use-in-C" rel="noreferrer" target="_blank">https://common-lisp.net/project/ecl/static/manual/System-building.html#Build-it-as-shared-library-and-use-in-C</a> <br>
for more details).<br>
<br>
Since you didn't specify an explicit init name yourself, init functions <br>
are automatically generated for each system contained in the final <br>
library. When compiling a monolithic library, it is preferable to <br>
specify an explicit init name yourself, for example as<br>
<br>
(asdf:make-build :embedded-console :type :static-library :move-here <br>
#P"/my/output/dir" :monolithic t :init-name "init_lib_embedded_console")<br>
<br>
and then invoke it using<br>
<br>
extern void init_lib_embedded_console(cl_object);<br>
/* ... */<br>
cl_boot(argc, argv);<br>
ecl_init_module(NULL, init_lib_embedded_console);<br>
<br>
Am 29.11.20 um 13:17 schrieb Иван Трусков:<br>
> Hello. I am trying to make a library that makes use of 'STR' package and <br>
> link it into my C program.<br>
> I presumed that using :monolithic t flag would result in the static <br>
> library that contained all systems my library depends on. However it <br>
> seems that is not the case.<br>
> <br>
> Here is my .asd file:<br>
> <br>
> (defsystem "embedded-console"<br>
>    :description "embedded console - ECL functions for smart snake game"<br>
>    :author "Ivan Truskov <<a href="mailto:trus19@gmail.com" target="_blank">trus19@gmail.com</a> <mailto:<a href="mailto:trus19@gmail.com" target="_blank">trus19@gmail.com</a>>>"<br>
>    :components ((:file "embedded-console"))<br>
>    :depends-on ("str"))<br>
> <br>
> I am compiling the library with command:<br>
> <br>
> ecl -norc -eval '(require :ecl-quicklisp)'<br>
>                      -eval '(push \"/my/src/dir/\" asdf:*central-registry*)'<br>
>                      -eval '(asdf:make-build :embedded-console :type <br>
> :static-library :move-here \#P\"/my/output/dir}\" :monolithic t )'<br>
>                      -eval '(quit)'<br>
> <br>
> However, when i try to link with resulting library, this is what i get:<br>
> <br>
> ... undefined reference to `init_lib_CL_PPCRE'<br>
> ... undefined reference to `init_lib_BASE'<br>
> ... undefined reference to `init_lib_CL_UNICODE'<br>
> ... undefined reference to `init_lib_CL_PPCRE_UNICODE'<br>
> ... undefined reference to `init_lib_CL_CHANGE_CASE'<br>
> ... undefined reference to `init_lib_STR'<br>
> ... undefined reference to `init_lib_EMBEDDED_CONSOLE'<br>
> <br>
> And indeed, when i run nm over the built file <br>
> embedded-console--all-systems.a, this is output:<br>
> <br>
> eclinitVtJU9J.o:<br>
> 0000000000000000 b Cblock.10857<br>
>                   U cl_boot<br>
>                   U cl_symbols<br>
>                   U _ecl_frs_push<br>
>                   U ecl_init_module<br>
>                   U ecl_make_codeblock<br>
>                   U ecl_process_env<br>
>                   U _GLOBAL_OFFSET_TABLE_<br>
>                   U init_lib_BASE<br>
>                   U init_lib_CL_CHANGE_CASE<br>
>                   U init_lib_CL_PPCRE<br>
>                   U init_lib_CL_PPCRE_UNICODE<br>
>                   U init_lib_CL_UNICODE<br>
>                   U init_lib_EMBEDDED_CONSOLE<br>
> 0000000000000000 T init_lib_EMBEDDED_CONSOLE__ALL_SYSTEMS<br>
>                   U init_lib_STR<br>
> 0000000000000110 T main_lib_EMBEDDED_CONSOLE__ALL_SYSTEMS<br>
>                   U _setjmp<br>
> nm: cl-ppcre.a: File format not recognized<br>
> nm: base.a: File format not recognized<br>
> nm: cl-unicode.a: File format not recognized<br>
> nm: cl-ppcre-unicode.a: File format not recognized<br>
> nm: cl-change-case.a: File format not recognized<br>
> nm: str.a: File format not recognized<br>
> nm: embedded-console.a: File format not recognized<br>
> <br>
> What am i doing wrong? What should i change to get static library <br>
> containing all systems i am intending to use (and maybe only them, if <br>
> possible)?<br>
<br>
</blockquote></div>