[parted-devel] Duplicate symbols when statically linking to libparted and libparted-fs-resize

Urs list-parted at ursschulz.de
Wed Jul 23 13:28:15 BST 2025


Hello list,

I am currently trying to statically link fatresize, which depends on 
libparted and libparted-fs-resize. After figuring out a few problems in 
fatresize itself I'm still stuck with the following duplicate symbol errors:

 > armv7l-unknown-linux-musleabihf-gcc  -g -O2 -D_FILE_OFFSET_BITS=no 
-o fatresize fatresize-fatresize.o -lparted-fs-resize 
-L/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib 
-lparted -ldevmapper -lblkid -luuid -ldl
 > 
/nix/store/bjzyn5wcmpvdvx3a94ndyf4q1h2qygxj-armv7l-unknown-linux-musleabihf-binutils-2.43.1/bin/armv7l-unknown-linux-musleabihf-ld: 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted.a(fat.o): 
in function `fat_alloc':
 > (.text+0x0): multiple definition of `fat_alloc'; 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted-fs-resize.a(fat.o):(.text+0x0): 
first defined here
 > 
/nix/store/bjzyn5wcmpvdvx3a94ndyf4q1h2qygxj-armv7l-unknown-linux-musleabihf-binutils-2.43.1/bin/armv7l-unknown-linux-musleabihf-ld: 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted.a(fat.o): 
in function `fat_free':
 > (.text+0x98): multiple definition of `fat_free'; 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted-fs-resize.a(fat.o):(.text+0x138): 
first defined here
 > 
/nix/store/bjzyn5wcmpvdvx3a94ndyf4q1h2qygxj-armv7l-unknown-linux-musleabihf-binutils-2.43.1/bin/armv7l-unknown-linux-musleabihf-ld: 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted.a(hfs.o):(.bss+0x0): 
multiple definition of `hfsp_block_count'; 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted-fs-resize.a(hfs.o):(.bss+0x18): 
first defined here
 > 
/nix/store/bjzyn5wcmpvdvx3a94ndyf4q1h2qygxj-armv7l-unknown-linux-musleabihf-binutils-2.43.1/bin/armv7l-unknown-linux-musleabihf-ld: 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted.a(hfs.o):(.bss+0x4): 
multiple definition of `hfs_block_count'; 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted-fs-resize.a(hfs.o):(.bss+0x1c): 
first defined here
 > 
/nix/store/bjzyn5wcmpvdvx3a94ndyf4q1h2qygxj-armv7l-unknown-linux-musleabihf-binutils-2.43.1/bin/armv7l-unknown-linux-musleabihf-ld: 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted.a(hfs.o):(.bss+0x8): 
multiple definition of `hfsp_block'; 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted-fs-resize.a(hfs.o):(.bss+0x20): 
first defined here
 > 
/nix/store/bjzyn5wcmpvdvx3a94ndyf4q1h2qygxj-armv7l-unknown-linux-musleabihf-binutils-2.43.1/bin/armv7l-unknown-linux-musleabihf-ld: 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted.a(hfs.o):(.bss+0xc): 
multiple definition of `hfs_block'; 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted-fs-resize.a(hfs.o):(.bss+0x24): 
first defined here
 > 
/nix/store/bjzyn5wcmpvdvx3a94ndyf4q1h2qygxj-armv7l-unknown-linux-musleabihf-binutils-2.43.1/bin/armv7l-unknown-linux-musleabihf-ld: 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted.a(probe.o): 
in function `hfsc_can_use_geom':
 > (.text+0x0): multiple definition of `hfsc_can_use_geom'; 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted-fs-resize.a(probe.o):(.text+0x0): 
first defined here
 > 
/nix/store/bjzyn5wcmpvdvx3a94ndyf4q1h2qygxj-armv7l-unknown-linux-musleabihf-binutils-2.43.1/bin/armv7l-unknown-linux-musleabihf-ld: 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted.a(probe.o): 
in function `hfs_and_wrapper_probe':
 > (.text+0xa0): multiple definition of `hfs_and_wrapper_probe'; 
/nix/store/q1ligpwl9i0p6vvfbhm03iz8bsqy4s4m-parted-static-armv7l-unknown-linux-musleabihf-3.6/lib/libparted-fs-resize.a(probe.o):(.text+0xa0): 
first defined here

All the symbols seem to be defined in both libparted.a and 
libparted-fs-resize.a (I checked with nm).

When checking for example the symbol fat_alloc, it seems that it is 
indeed twice in the source code, once in libparted/fs/fat/fat.c and once 
in libparted/fs/r/fat/fat.c.

Any ideas how I could resolve this problem? fatresize really needs to 
link to both of these libraries.

Regards
Urs



More information about the parted-devel mailing list