An Updated Tutorial Article and Question about LDFLAGS

Jingze Xu qdxujingze18 at 126.com
Wed Jun 28 03:56:24 UTC 2023


Dear all, 


Hi! I have added a new dialog in Impress according to this article Development/Create new dialog in Impress - The Document Foundation Wiki. However, this article was written in 2013 and too old for the current version. I attached a updated article that suits for version 7.6.0. I hope it can help update the official article. 


After I added the new dialog, I have been trying to use external shared libraries in the dialog source file, according to this build libtiff · LibreOffice/core at a2ffd71 (github.com). The external library I added simply contains a header file which has a helloWorld function and a .so file. I encoutered a problem. 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I found that after doing all steps in the link above, I still need to add [path to my .so library directory] to system environment variable $LD_LIBRARY_PATH to make it work. I tried to add ldflags in RepositoryExternal.mk but it didn't work. (The part that has been commented out). How
to make it work without setting system environment variable? I think 
$(call gb_LinkTarget_add_libs,$(1),\
    -L$(call gb_UnpackedTarball_get_dir,liba)/lib -la \
) already specifies the path to the library?


Here is the relevant code in RepositoryExternal.mk.
ifneq ($(SYSTEM_LIBA),)


definegb_LinkTarget__use_liba
$(call gb_LinkTarget_set_include,$(1),\
    $$(INCLUDE) \
    $(LIBA_CFLAGS) \
)


# $(call gb_LinkTarget_add_ldflags,$(1),\
#     $(LIBA_LDFLAGS) \
# )


$(call gb_LinkTarget_add_libs,$(1),\
    $(LIBA_LIBS) \
)


endef


gb_ExternalProject__use_liba :=


else# !SYSTEM_LIBA


definegb_LinkTarget__use_liba
$(call gb_LinkTarget_set_include,$(1),\
    $(LIBA_CFLAGS) \
    $$(INCLUDE) \
)


$(call gb_LinkTarget_set_include,$(1),\
    -I$(call gb_UnpackedTarball_get_dir,liba)/src \
    $$(INCLUDE) \
)
ifeq ($(OS),WNT)
$(call gb_LinkTarget_add_libs,$(1),\
    $(call gb_UnpackedTarball_get_dir,liba)/lib/liba$(gb_StaticLibrary_PLAINEXT) \
)
else
# $(call gb_LinkTarget_add_ldflags,$(1),\
#     -L$(call gb_UnpackedTarball_get_dir,liba)/lib \
# )
$(call gb_LinkTarget_add_libs,$(1),\
    -L$(call gb_UnpackedTarball_get_dir,liba)/lib -la \
)
endif
$(call gb_LinkTarget_use_external_project,$(1),liba,full)


endef


definegb_ExternalProject__use_liba
$(call gb_ExternalProject_use_external_project,$(1),liba)


endef


endif# !SYSTEM_LIBA
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Could anyone give me some clues about this problem? Thanks! 




Best wishes,
Jingze Xu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20230628/75281fa4/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adding a new dialog in Impress.docx
Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Size: 1065837 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20230628/75281fa4/attachment-0001.docx>


More information about the LibreOffice mailing list