lundi 25 avril 2016

std::errc ABI portability

I've built this project from source. I have a setup that hits this codepath:

if (err != std::errc::no_such_file_or_directory) {
    Ctx.Diags.diagnose(moduleID.second, diag::sema_opening_import,
                       moduleID.first, err.message());
  }

On my system (Debian Jessie), this condition evaluates to false. Therefore we do not call Ctx.Diags.diagnose.

However, I took the binary I built and gave it to a friend who runs Ubuntu. Under the exact same conditions on his system, the if statement evaluates to true, and err.message() is No such file or directory.

How is that possible? I thought std::errc is supposed to be portable? ENOENT is 2 on both systems, as required by POSIX.

I assume this has something to do with libstd on his system at runtime being different than it is on my system at buildtime, but I don't understand why, or how to build a portable version.

Aucun commentaire:

Enregistrer un commentaire