This one is going to take ingenuity. I've spotted evidence of it in various places so far, but the most recent is in libu2f-host. If you echo foo | u2f-host -osendrecv, you'll get an obscure segfault in objc_msgSend coming from a call to some CF functions from IOKit, which libu2f-host uses to talk to the HID device (it's a library for talking to a yubikey token).
The issue is that the final library is linking both against our own CF library (which maintains some global state of some sort that I haven't looked into yet), and via the impure IOKit, to the systemwide CF. Somehow the global state of the two CFs interferes somehow, and causes the resulting program to crash. If I relink the generated executable (and its library dependencies) to only the systemwide CF, everything works fine.
I can think of three approaches to this problem:
- We make the whole stdenv less pure and link to systemwide CF, its transitive dependencies, and in general, try to do more of that, at least for libraries with global state like that.
- We figure out how the global state works, then see if there are ways we can make this less of a problem
- We try to develop a broader solution to this sort of problem in nix: although this particular instance is due to CF and impurities, the problem is simply one of linking against two incompatible versions of the same library. If in linuxland, I had libfoo that needed libbar-3.5, and my program linked against libfoo as well as libbar-4.1, and libbar cared enough, I'd have similar issues. Ideally, we'd have a nixpkgs-native way to reason about such situations and force sets of packages to rebuild with consistent dependencies, without causing everything else to have to suffer as a result. Is there such a mechanism?
Any thoughts/advice, @shlevy, @gridaphobe, @joelteon, @jwiegley?
This one is going to take ingenuity. I've spotted evidence of it in various places so far, but the most recent is in libu2f-host. If you
echo foo | u2f-host -osendrecv, you'll get an obscure segfault inobjc_msgSendcoming from a call to some CF functions from IOKit, whichlibu2f-hostuses to talk to the HID device (it's a library for talking to a yubikey token).The issue is that the final library is linking both against our own CF library (which maintains some global state of some sort that I haven't looked into yet), and via the impure IOKit, to the systemwide CF. Somehow the global state of the two CFs interferes somehow, and causes the resulting program to crash. If I relink the generated executable (and its library dependencies) to only the systemwide CF, everything works fine.
I can think of three approaches to this problem:
Any thoughts/advice, @shlevy, @gridaphobe, @joelteon, @jwiegley?