Can't build as static OR shared in Haiku (OS)
- Dominant language
- C++
- Stars
- 2.6k
- Forks
- 309
- Avg merge
- 6d 58m
- Merged PRs (30d)
- 2
Description
Hello, I'm trying to build the [VOLK](https://github.com/gnuradio/volk) libraries on [Haiku](https://www.haiku-os.org/) (operating system). VOLK uses `cpu_features` as a submodule, I want/need to do a shared build but it doesn't work.
To isolate the problem I'm trying to build `cpu_features` alone. It seems no matter how I force it, explicitly using -DBUILD_SHARED_LIBS=ON and -DBUILD_PIC=ON args or even directly fumbling with those in CMakeLists.txt (ugly!) result is the same:
> ...
> ld: CMakeFiles/list_cpu_features.dir/src/utils/list_cpu_features.c.o: relocation R_X86_64_PC32 against symbol 'gBumpAllocator' can not be used when making a shared object; recompile with -fPIC
> ld: final link failed: bad value
> collect2: error: ld returned 1 exit status
> CMakeFiles/list_cpu_features.dir/build.make:97: recipe for target 'list_cpu_features' failed
The reason to try a shared build is because the static one also doesn't build:
> ...
> ld: CMakeFiles/list_cpu_features.dir/src/utils/list_cpu_features.c.o: in function 'CreateTree':
> list_cpu_features.c:(.text+0x51d): undefined reference to 'GetX86Info'
> ld: list_cpu_features.c:(.text+0x529): undefined reference to 'GetX86CacheInfo'
> ld: list_cpu_features.c:(.text+0x531): undefined reference to 'FillX86BrandString'
> ld: list_cpu_features.c:(.text+0x617): undefined reference to 'GetX86Microarchitecture'
> ld: list_cpu_features.c:(.text+0x61e): undefined reference to 'GetX86MicroarchitectureName'
> ld: list_cpu_features.c:(.text+0x668): undefined reference to 'GetX86FeaturesEnumValue'
> ld: list_cpu_features.c:(.text+0x677): undefined reference to 'GetX86FeaturesEnumName'
> collect2: error: ld returned 1 exit status
> CMakeFiles/list_cpu_features.dir/build.make:97: recipe for target 'list_cpu_features' failed
In both cases, _list_cpu_features_ is the culprit. I'm stuck about how to properly approach this. Do I "disable" said command as recommended [here](https://github.com/google/cpu_features/issues/210#issuecomment-999356881), and build shared anyway? Or is there something to possibly do in `cpu_features` side that'll enable a correct static build?
FYI, version of things in Haiku are as follows: cmake 3.24.2-1, gcc 11.2.0, binutils 2.31.1-2
Any help will be appreciated :)
Contributor guide
Assessment
This issue has not been assessed yet.