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

path-util.c:(.text+0xbc0): multiple definition of `path_is_mount_point'; common/path-utils.o:path-utils.c:(.text+0x290): first defined here #611

Closed
tuananh opened this issue Apr 3, 2023 · 7 comments
Labels
bug build Changes in build system
Milestone

Comments

@tuananh
Copy link

tuananh commented Apr 3, 2023

can someone help me on why im having this error

/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/libudev.a(path-util.o): in function `path_is_mount_point':
path-util.c:(.text+0xbc0): multiple definition of `path_is_mount_point'; common/path-utils.o:path-utils.c:(.text+0x290): first defined here
@kdave kdave added bug build Changes in build system labels Apr 3, 2023
@kdave
Copy link
Owner

kdave commented Apr 3, 2023

Please post what build environment you use (distro, libc, compiler version, linker if not using the default one) and what build command exactly. I don't see anything strange with path-utils.c in particuluar, the function is defined in a .c file, the object file is mentioned only once in the linked file list.

@kdave
Copy link
Owner

kdave commented Apr 3, 2023

Oh I see what's wrong, it's a name clash of libudev and path-utils.c, same function path_is_mount_point.

@kdave
Copy link
Owner

kdave commented Apr 3, 2023

Are you building static btrfs with static libudev? This is not supported so far because static libudev is not common. Also path_is_mount_point is not a static function but still not exported to the library so for a dynamic library it's not visible. When linking directly with libudev.a the symbol is defined as weak same as the btrfs' one and the names clash. A quick fix is to rename it in btrfs-progs but before making it a permanent fix I'd like to see if there's another way.

@tuananh
Copy link
Author

tuananh commented Apr 3, 2023

Are you building static btrfs with static libudev?
yes.

so is it recommended to have it disabled?

@kdave
Copy link
Owner

kdave commented Apr 3, 2023

We can make it work, I'll rename the function so it does not clash.

kdave added a commit that referenced this issue Apr 3, 2023
…l symbol name clash

There's a report that a static build fails when there's a static version
of libudev:

  /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/libudev.a(path-util.o): in function `path_is_mount_point':
  path-util.c:(.text+0xbc0): multiple definition of `path_is_mount_point'; common/path-utils.o:path-utils.c:(.text+0x290): first defined here

There's a helper path_is_mount_point in libudev too but not exported so
dynamic library is fine, unlike static build. The static build of
libudev is not common but we can support that with a simple rename.

Issue: #611
Signed-off-by: David Sterba <[email protected]>
@kdave kdave added this to the v6.2.3 milestone Apr 3, 2023
@kdave
Copy link
Owner

kdave commented Apr 3, 2023

Fix pushed to devel, please test and let me know if there are other problems with static libudev.

@kdave kdave modified the milestones: v6.2.3, v6.3 Apr 13, 2023
@kdave
Copy link
Owner

kdave commented Apr 13, 2023

Thanks, closing.

@kdave kdave closed this as completed Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug build Changes in build system
Projects
None yet
Development

No branches or pull requests

2 participants