Symbol not found _clock_gettiime

I have two computers, both running MacOS 10.11.6. In both, I have opam set to a 4.04.1 switch. I did opam update and opam upgrade on one, then went to directory for the little project I’m working on, ran oasis setup and make and got a new, working, executable, using new versions of libraries. (OK there were some intermediate steps–I made changes in the code, fixed bugs, and I actually upgraded some of the packages one at at time.)

On the other computer, I did opam update and opam upgraded, oasis setup and make (after git pulling the new code) and got a new, _non_working executable that reports:

dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /Users/mabrams/docs/src/ml/imp/_build/src/wrightfisherPDFs.native (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _clock_gettime
  Referenced from: /Users/mabrams/docs/src/ml/imp/_build/src/wrightfisherPDFs.native (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

Trace/BPT trap: 5

Note the claim that this executable was compiled for Mac OS 10.12 (!?!). (You have to scroll the error messages to the left to see the ends of lines where it says this.)

Any idea at all what might be going on here? Or what I should investigate, or try?

In case it matters: The application is using Batteries, Core, and Owl.

Looks similar to the issue reported here:

Yes, that does look very similar. Thanks @ashish. I’ll investigate. The machine on which I had no problem is an old one, perhaps with old libraries lying around, while the one with the problem has always run 10.11.6. Maybe I’ll upgrade to 10.12, although I’d rather not.

It turns out that the older machine has an older version of xcode.

The problem seems to result from using XCode 8 on Mac OS 10.11. There are numerous reports around the web about it. A solution is to run sudo xcode-select --install, as suggested for example here: . Running this command installs additional software, and may take a few minutes.

The next step is to recompile all of one’s OCaml packages (or maybe only some, but a lot of them, anyway) to avoid a long series of errors. To do this, I ended up using opam switch export somefilename to export the configuration to a file. Then I removed my 4.04.1 switch and created a new 4.04.1 switch, in which I ran opam switch import somefilename to reinstall all of the packages I wanted. I’m sure there’s a simpler way to recompile all of the packages, but I had trouble finding it (probably my fault), and this brute force solution worked.