Illegal hardware instruction

Hi,

I’d like to compile universally runnable binaries for Linux x86_64. Target
distributions are Debian stable (10) and Ubuntu LTS 18.04 and 20.04. I’ve had trouble with my binaries before, but I had found a VM (it’s a Ubuntu 18.04.4 LTS system using OCaml 4.10.0 installed via OPAM) which produced usable binaries for all target systems. This worked perfectly for many months, but suddenly some target systems don’t accept newly created executables anymore: “illegal hardware instruction”. Maybe the hoster switched on some additional CPU features, I don’t know.

I don’t use any fancy compiler flags, e.g.:
ocamlbuild -ocamlopt "ocamlopt -w A-4-42 -g -bin-annot" -use-ocamlfind ...

My question is: how do I compile executables which use only basic “hardware
instructions”? How do Linux packagers solve this problem?

Thank you!

Just a shot in the dark, but does your program link to any C libraries? And are those libraries built with portable instruction sets?

Yes, I use the postgresql-ocaml bindings. There is libpq5 from the postgresql.org repository on my build system, maybe that’s the source of the problem. I’ll check this out.
Thank you!