Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Fix linking with LLD #1021

Merged
merged 1 commit into from
May 19, 2024

Conversation

vadorovsky
Copy link
Contributor

LLD is strict about specifying link dependencies and it complains about libuuid not being provided in LDFLAGS when linking tool binaries.

See https://bugs.gentoo.org/910487

Fixes: #1020

@StorageGhoul
Copy link

Can one of the admins verify this patch?

@vadorovsky
Copy link
Contributor Author

For the context, uuid_generate is undefined in libparted-fs-resize.so:

❯ nm -D /usr/lib/libparted-fs-resize.so
                 w __cxa_finalize
                 w __deregister_frame_info
                 w __register_frame_info
                 U __stack_chk_fail
                 U exit
                 U fat16_type
                 U fat32_type
                 U memcpy
                 U memset
                 U ped_alignment_any
                 U ped_alignment_init
                 U ped_assert
                 U ped_constraint_new
                 U ped_device_close
                 U ped_device_open
                 U ped_exception_catch
                 U ped_exception_fetch_all
                 U ped_exception_leave_all
                 U ped_exception_throw
0000000000008100 T ped_file_system_close@@LIBPARTED_FS_RESIZE_0.0.0
00000000000083e0 T ped_file_system_get_resize_constraint@@LIBPARTED_FS_RESIZE_0.0.0
0000000000007f80 T ped_file_system_open@@LIBPARTED_FS_RESIZE_0.0.0
                 U ped_file_system_probe
                 U ped_file_system_probe_specific
00000000000081d0 T ped_file_system_resize@@LIBPARTED_FS_RESIZE_0.0.0
                 U ped_geometry_destroy
                 U ped_geometry_duplicate
                 U ped_geometry_init
                 U ped_geometry_map
                 U ped_geometry_new
                 U ped_geometry_read
                 U ped_geometry_read_alloc
                 U ped_geometry_set
                 U ped_geometry_set_end
                 U ped_geometry_sync
                 U ped_geometry_sync_fast
                 U ped_geometry_test_equal
                 U ped_geometry_test_inside
                 U ped_geometry_test_overlap
                 U ped_geometry_test_sector_inside
                 U ped_geometry_write
                 U ped_malloc
                 U ped_timer_destroy_nested
                 U ped_timer_new_nested
                 U ped_timer_reset
                 U ped_timer_set_state_name
                 U ped_timer_update
                 U ped_unit_format
                 U ptt_geom_clear_sectors
                 U rpl_free
                 U strcmp
                 U strcpy
                 U strdup
                 U strlen
                 U strncmp
                 U uuid_generate

It's defined with a version in libuuid:

❯ nm -D /usr/lib/libuuid.so
                 w __cxa_finalize
                 w __deregister_frame_info
                 U __errno_location
                 w __register_frame_info
                 U __stack_chk_fail
                 U __tls_get_addr
00000000000033d0 T __uuid_generate_random@@UUIDD_PRIVATE
0000000000002e60 T __uuid_generate_time@@UUIDD_PRIVATE
0000000000003130 T __uuid_generate_time_cont@@UUIDD_PRIVATE
                 U close
                 U connect
                 U fclose
                 U fdopen
                 U fflush
                 U flock
                 U fprintf
                 U fscanf
                 U getpid
                 U getppid
                 U getrandom
                 U gettimeofday
                 U getuid
                 U ioctl
                 U isxdigit
                 U jrand48
                 U memcpy
                 U memset
                 U nanosleep
                 U open
                 U random
                 U read
                 U rewind
                 U socket
                 U srandom
                 U strcmp
                 U strlen
                 U strncpy
                 U strtoul
                 U syscall
                 U time
                 U umask
0000000000002d30 T uuid_clear@@UUID_1.0
0000000000002d40 T uuid_compare@@UUID_1.0
0000000000002df0 T uuid_copy@@UUID_1.0
0000000000003520 T uuid_generate@@UUID_1.0
00000000000035b0 T uuid_generate_md5@@UUID_2.31
00000000000034a0 T uuid_generate_random@@UUID_1.0
0000000000003690 T uuid_generate_sha1@@UUID_2.31
0000000000003140 T uuid_generate_time@@UUID_1.0
00000000000033c0 T uuid_generate_time_safe@@UUID_2.20
0000000000004800 T uuid_get_template@@UUID_2.31
0000000000003dd0 T uuid_is_null@@UUID_1.0
0000000000003e60 T uuid_parse@@UUID_1.0
0000000000003ea0 T uuid_parse_range@@UUID_2.36
00000000000046b0 T uuid_time@@UUID_1.0
0000000000004760 T uuid_type@@UUID_1.0
00000000000044f0 T uuid_unparse@@UUID_1.0
0000000000004170 T uuid_unparse_lower@@UUID_1.0
0000000000004330 T uuid_unparse_upper@@UUID_1.0
00000000000047a0 T uuid_variant@@UUID_1.0
                 U write

@vojtechtrefny
Copy link
Member

Jenkins, ok to test.

Copy link
Member

@vojtechtrefny vojtechtrefny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a simple fix, I have nothing against merging this, but shouldn't this be fixed in libparted instead?

Copy link
Member

@tbzatek tbzatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with the vfat_resize fix, thanks for reporting this!

LLD is strict about specifying link dependencies and it complains about
libuuid not being provided in LDFLAGS when linking tool binaries.

See https://bugs.gentoo.org/910487

Fixes: storaged-project#1020
@vojtechtrefny vojtechtrefny merged commit 897a0a6 into storaged-project:master May 19, 2024
33 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tools: Link failure when using LLD
4 participants