[PATCH] erofs-utils: lib: correct erofsfuse build script

ComixHe heyuming at deepin.org
Fri Dec 13 18:24:53 AEDT 2024


On 12/13/24 14:39, Gao Xiang wrote:
> Hi Comix,
>
> On 2024/12/13 14:32, ComixHe wrote:
>> Some of the symbols required by erofsfuse are provided by liberofs.
>> When option 'enable-static-fuse' is set, all these object file should be
>> exported to liberofsfuse.a
>
> Could you give more hints why `lib_LIBRARIES` doesn't work?
Certainly.

Today, I attempted to build the latest stable version of erofs-utils and
export liberofsfuse.a.

However, when using liberofsfuse.a, the linker there reported several
errors:

(.text+0xff): undefined reference to `g_sbi'
/usr/bin/ld: (.text+0x110): undefined reference to `g_sbi'
/usr/bin/ld: (.text+0x116): undefined reference to `cfg'
/usr/bin/ld: (.text+0x12d): undefined reference to
`erofs_read_inode_from_disk'
/usr/bin/ld: (.text+0x146): undefined reference to `erofs_listxattr'
/usr/bin/ld: (.text+0x1ae): undefined reference to `erofs_listxattr'
/usr/bin/ld: (.text+0x1e5): undefined reference to `erofs_msg'
/usr/bin/ld: (.text+0x1ed): undefined reference to
`erofs_read_inode_from_disk'

I adjusted the build script according to the patch content, then rebuilt
both erofs-utils and my project.

After these fixes, everything worked as expected.
>
> I fail to get the point why `lib_LTLIBRARIES` is needed for
> static libraries...
>
> https://www.gnu.org/software/automake/manual/1.7.2/html_node/A-Library.html
>
>
> Thanks,
> Gao Xiang
>
>>
>> Signed-off-by: ComixHe <heyuming at deepin.org>
>> ---
>>   fuse/Makefile.am | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/fuse/Makefile.am b/fuse/Makefile.am
>> index 1062b73..50186da 100644
>> --- a/fuse/Makefile.am
>> +++ b/fuse/Makefile.am
>> @@ -11,9 +11,9 @@ erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la
>> ${libfuse2_LIBS} ${libfuse3_LI
>>       ${libqpl_LIBS}
>>     if ENABLE_STATIC_FUSE
>> -lib_LIBRARIES = liberofsfuse.a
>> -liberofsfuse_a_SOURCES = main.c
>> -liberofsfuse_a_CFLAGS  = -Wall -I$(top_srcdir)/include
>> -liberofsfuse_a_CFLAGS += -Dmain=erofsfuse_main ${libfuse2_CFLAGS}
>> ${libfuse3_CFLAGS} ${libselinux_CFLAGS}
>> -liberofsfuse_a_LIBADD  = $(top_builddir)/lib/liberofs.la
>> +lib_LTLIBRARIES = liberofsfuse.la
>> +liberofsfuse_la_SOURCES = main.c
>> +liberofsfuse_la_CFLAGS  = -Wall -I$(top_srcdir)/include
>> +liberofsfuse_la_CFLAGS += -Dmain=erofsfuse_main ${libfuse2_CFLAGS}
>> ${libfuse3_CFLAGS} ${libselinux_CFLAGS}
>> +liberofsfuse_la_LIBADD  = $(top_builddir)/lib/liberofs.la
>>   endif
>
>


More information about the Linux-erofs mailing list