static library not working on all computers

Hi,

I am creating a static library for my c++ project on linux mac and windows.
(for now I have the static lib for linux only).

My question is: how can I guarantee or at least increase the chances to have the static library working on any linux machine. As an example when I compiled my code into a static library on a new machine and tried to use it on an older one without AVX support it fails.
Do I absolutely have to create a static library for every pc age and flavor or is there a workaround?

The 2 versions of the static lib are in the download section on http://www.sparselizard.org (and any feedback on wether it works on your machine is of great help!)

Thanks a lot for your help!
Last edited on
AVX is a feature of the CPU, not the operating system (just to be clear).

If you require AVX, then you don't really have any options. It will only work if the CPU hardware allows it.

You can detect the features of the CPU at runtime using compiler intrinsics generally. By detecting at runtime, you can at least warn the user running your program that their hardware isn't supported or you can fallback to a path of code that doesn't use AVX.

Google recently made a library that makes fetching x86 CPU features a little bit easier: https://github.com/google/cpu_features
If you don't want to rely on that, you'll probably want to look into the cpuid intrinsic available for your compiler.
Topic archived. No new replies allowed.