Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Conversation

@mz2
Copy link
Contributor

@mz2 mz2 commented May 2, 2025

Resolves a linker error when building with feature cuda, such that nvcc compiled & linked objects get compiled with position-independent code (-fPIC). I noticed that this was not getting done when building whisper-rs into https://github.com/mz2/pipescribe: when enabling the cuda feature, cargo, the following linker error would occur:

...
"-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/mz2/Developer/pipescribe/gui/rust/target/debug/deps/librust_lib_pipescribe.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use --verbose to show all linker arguments
  = note: /usr/bin/ld: /home/mz2/Developer/pipescribe/gui/rust/target/debug/deps/libwhisper_rs_sys-193aab817605690a.rlib(fattn.cu.o): warning: relocation against stderr@@GLIBC_2.2.5' in read-only section .text'
          /usr/bin/ld: /home/mz2/Developer/pipescribe/gui/rust/target/debug/deps/libwhisper_rs_sys-193aab817605690a.rlib(mmq-instance-iq1_s.cu.o): relocation R_X86_64_PC32 against symbol stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
          /usr/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status

I have confirmed this to be fixed with the changes in this PR.

Copy link
Owner

@tazz4843 tazz4843 left a comment

Choose a reason for hiding this comment

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

Sorry this took me so long to get around to, looks good. Thanks :)

@tazz4843 tazz4843 enabled auto-merge May 21, 2025 21:14
@tazz4843 tazz4843 merged commit 35adcfd into tazz4843:master Jun 8, 2025
11 of 13 checks passed
@mz2 mz2 deleted the fpic-fix branch June 10, 2025 07:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants