Monolithic build of static library
Daniel Kochmański
daniel at turtleware.eu
Tue Dec 1 21:14:00 UTC 2020
Do you have the source code of uiop available in the central registry? Quicklisp won't
download it, because asdf considers it being preloaded. Also, if so, do you have uiop
listed as a dependency?
Alternatively you may add asdf as a dependency to your system.
Regards,
Daniel
--
Daniel Kochmański ;; aka jackdaniel | Przemyśl, Poland
TurtleWare - Daniel Kochmański | www.turtleware.eu
"Be the change that you wish to see in the world." - Mahatma Gandhi
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, 1 December 2020 22:01, Иван Трусков <trus19 at gmail.com> wrote:
> Thank you very much. After rebuilding with newer version of ecl and with :init-name supplied compilation was a success.
>
> However, when i try to run the resulting executable, i get this error:
>
> Condition of type: SIMPLE-ERROR
> Package ((UIOP/STREAM . #<UIOP/STREAM package>)) referenced in compiled file
> NIL
> but has not been created
>
> Available restarts:
>
> 1. (IGNORE) Ignore the error, and try the operation again
>
> 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).
>
> вт, 1 дек. 2020 г. в 22:15, Marius Gerbershagen <marius.gerbershagen at gmail.com>:
>
>> The generated library does indeed contain all systems that your library
>> contains on. The undefined references are init functions, which need to
>> be called via ecl_init_module after cl_boot to initialize the compiled
>> libraries (see
>> https://common-lisp.net/project/ecl/static/manual/System-building.html#Build-it-as-shared-library-and-use-in-C
>> for more details).
>>
>> Since you didn't specify an explicit init name yourself, init functions
>> are automatically generated for each system contained in the final
>> library. When compiling a monolithic library, it is preferable to
>> specify an explicit init name yourself, for example as
>>
>> (asdf:make-build :embedded-console :type :static-library :move-here
>> #P"/my/output/dir" :monolithic t :init-name "init_lib_embedded_console")
>>
>> and then invoke it using
>>
>> extern void init_lib_embedded_console(cl_object);
>> /* ... */
>> cl_boot(argc, argv);
>> ecl_init_module(NULL, init_lib_embedded_console);
>>
>> Am 29.11.20 um 13:17 schrieb Иван Трусков:
>>> Hello. I am trying to make a library that makes use of 'STR' package and
>>> link it into my C program.
>>> I presumed that using :monolithic t flag would result in the static
>>> library that contained all systems my library depends on. However it
>>> seems that is not the case.
>>>
>>> Here is my .asd file:
>>>
>>> (defsystem "embedded-console"
>>> :description "embedded console - ECL functions for smart snake game"
>>> :author "Ivan Truskov <trus19 at gmail.com <mailto:trus19 at gmail.com>>"
>>> :components ((:file "embedded-console"))
>>> :depends-on ("str"))
>>>
>>> I am compiling the library with command:
>>>
>>> ecl -norc -eval '(require :ecl-quicklisp)'
>>> -eval '(push \"/my/src/dir/\" asdf:*central-registry*)'
>>> -eval '(asdf:make-build :embedded-console :type
>>> :static-library :move-here \#P\"/my/output/dir}\" :monolithic t )'
>>> -eval '(quit)'
>>>
>>> However, when i try to link with resulting library, this is what i get:
>>>
>>> ... undefined reference to `init_lib_CL_PPCRE'
>>> ... undefined reference to `init_lib_BASE'
>>> ... undefined reference to `init_lib_CL_UNICODE'
>>> ... undefined reference to `init_lib_CL_PPCRE_UNICODE'
>>> ... undefined reference to `init_lib_CL_CHANGE_CASE'
>>> ... undefined reference to `init_lib_STR'
>>> ... undefined reference to `init_lib_EMBEDDED_CONSOLE'
>>>
>>> And indeed, when i run nm over the built file
>>> embedded-console--all-systems.a, this is output:
>>>
>>> eclinitVtJU9J.o:
>>> 0000000000000000 b Cblock.10857
>>> U cl_boot
>>> U cl_symbols
>>> U _ecl_frs_push
>>> U ecl_init_module
>>> U ecl_make_codeblock
>>> U ecl_process_env
>>> U _GLOBAL_OFFSET_TABLE_
>>> U init_lib_BASE
>>> U init_lib_CL_CHANGE_CASE
>>> U init_lib_CL_PPCRE
>>> U init_lib_CL_PPCRE_UNICODE
>>> U init_lib_CL_UNICODE
>>> U init_lib_EMBEDDED_CONSOLE
>>> 0000000000000000 T init_lib_EMBEDDED_CONSOLE__ALL_SYSTEMS
>>> U init_lib_STR
>>> 0000000000000110 T main_lib_EMBEDDED_CONSOLE__ALL_SYSTEMS
>>> U _setjmp
>>> nm: cl-ppcre.a: File format not recognized
>>> nm: base.a: File format not recognized
>>> nm: cl-unicode.a: File format not recognized
>>> nm: cl-ppcre-unicode.a: File format not recognized
>>> nm: cl-change-case.a: File format not recognized
>>> nm: str.a: File format not recognized
>>> nm: embedded-console.a: File format not recognized
>>>
>>> What am i doing wrong? What should i change to get static library
>>> containing all systems i am intending to use (and maybe only them, if
>>> possible)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20201201/5615db78/attachment-0001.htm>
More information about the ecl-devel
mailing list