Commit 576efff
cmake: build the backend static libs position-independent
Consumers that link libbrotensor_cpu.a into a shared object (a Python
extension, a plugin .so) hit a link failure on Linux: the CPU thread pool's
thread-local t_active emits a local-exec TLS relocation (R_X86_64_TPOFF32)
that ld rejects inside a shared object -- "recompile with -fPIC". Setting
CMAKE_POSITION_INDEPENDENT_CODE ON makes every backend archive PIC so it can
land in either an executable or a shared object. Scoped to this directory's
targets; it does not leak into a parent that add_subdirectory()s brotensor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 98b1a3c commit 576efff
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
| |||
0 commit comments