Skip to content

Can't build as static OR shared in Haiku (OS) #294

@victroniko

Description

@victroniko

Hello, I'm trying to build the VOLK libraries on Haiku (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, 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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions