[Libreoffice-qa] How to link a .so library

Stéphane Guillou stephane.guillou at libreoffice.org
Mon Jun 19 13:02:05 UTC 2023


Hi Jingze,
This is the Quality Assurance mailing list. For questions and answers, 
please use https://ask.libreoffice.org/
However, given that your question is about programming, you might get 
more answers on the dev mailing list: 
https://lists.freedesktop.org/mailman/listinfo/libreoffice

Thank you!

On 19/06/2023 11:40, Jingze Xu wrote:
> Dear all,
> Hi, I'm new to libreoffice and its forum. I have a question but I am 
> not sure where to ask. If this is the right place, here is the question :)
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> Question:
> I have successfully added a new dialog in Impress according to the 
> steps in this tutorial - Development/Create new dialog in Impress - 
> The Document Foundation Wiki 
> <https://wiki.documentfoundation.org/Development/Create_new_dialog_in_Impress>. 
> Now I wish to call functions in an external library in the dialog 
> source file.
> I have an external library *libxxx* containing some C++ header files 
> and a .so file. I put the header files in include/ folder and .so file 
> outside libreoffice directory. I include the header files of this 
> library in dialog source files located in sd/source/ui/dlg. I rerun 
> the autogen.sh with extra arguments, trying to let the build system 
> know I have a .so library to link.
>
> ./autogen.sh LDFLAGS=-L/path_to_libxxx LIBS=-lxxx
>
> Then I rebuild the sd module using make sd, however, it seems the 
> functions in .so library is not properly linked.
>
> "/usr/bin/ld: 
> /home/jingze_xu/office/libreoffice-7.6.0.0.beta1/workdir/CxxObject/sd/source/ui/dlg/HelloDialog.o: 
> in function `sd::SdHelloDialog::OKHdl(weld::Button&)':
> HelloDialog.cxx:(.text+0x36c): undefined reference to 
> `Add_FileHeader(std::__cxx11::basic_string<char, 
> std::char_traits<char>, std::allocator<char> >, 
> std::__cxx11::basic_string<char, std::char_traits<char>, 
> std::allocator<char> >, unsigned short)'
> collect2: error: ld returned 1 exit status
> make[1]: *** 
> [/home/jingze_xu/office/libreoffice-7.6.0.0.beta1/sd/Library_sdui.mk:10: 
> /home/jingze_xu/office/libreoffice-7.6.0.0.beta1/instdir/program/libsduilo.so] 
> Error 1
> make: *** [Makefile:121: sd] Error 2"
>
> Are there some clues about linking so library in libreoffice codebase?
> Thanks!
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> If this is not the right place to ask questions, I'm sorry about this 
> and please tell me where to ask questions. Thanks!
>
> Best wishes,
> Jingze Xu


-- 
Stéphane Guillou
Quality Assurance Analyst | The Document Foundation

Email:stephane.guillou at libreoffice.org
Mobile (France): +33 7 79 67 18 72
Matrix: @stragu:matrix.org
Fediverse: @stragu at mastodon.indie.host
Web:https://stragu.gitlab.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-qa/attachments/20230619/1143823c/attachment.htm>


More information about the Libreoffice-qa mailing list