Skip to content
This repository has been archived by the owner on Sep 19, 2018. It is now read-only.

OSX Compatibility #4

Open
rgrinberg opened this issue Apr 10, 2014 · 20 comments
Open

OSX Compatibility #4

rgrinberg opened this issue Apr 10, 2014 · 20 comments
Assignees

Comments

@rgrinberg
Copy link

Running jenga on OSX against of the examples gives:

 ("unhandled exception"
   ((lib/monitor.ml.Error_
     ((exn
       (Unix.Unix_error "Invalid argument" select
        "((read (-1)) (write ()) (except ()) (timeout Never))"))
      (backtrace
       ("Raised at file \"lib/core_unix.ml\", line 48, characters 11-42"
        "Called from file \"lib/async_inotify.ml\", line 98, characters 10-77"
        "Called from file \"lib/result.ml\", line 104, characters 10-14"
        "Re-raised at file \"lib/result.ml\", line 111, characters 23-26"
        "Called from file \"lib/deferred.ml\", line 12, characters 64-67"
        "Called from file \"lib/jobs.ml\", line 214, characters 10-13" ""))
      (monitor
       (((name try_with) (here ()) (id 4) (has_seen_error true)
         (someone_is_listening true) (kill_index 0))))))
    (Pid 57794)))

Seems like this is because inotify is absent from OSX.

@samoht
Copy link

samoht commented Jun 10, 2014

Any progress on this ? I've just been bitten by the same issue.

@ghost
Copy link

ghost commented Jun 10, 2014

Not that I know of, I'll ping people involved.

@ghost
Copy link

ghost commented Jun 10, 2014

The plan is to replace inotify by a portable library, but the work hasn't started yet.

@samoht
Copy link

samoht commented Jun 10, 2014

Would be nice to at least not fail on inotify when not running in a polling mode.

Also there are some "scary" warnings which would be nice to not print at the start of the day:

$ jenga
cant read: /proc/cpuinfo
no processor lines seen in: /proc/cpuinfo
[...]

@avsm
Copy link

avsm commented Jun 11, 2014

A fully portable inotify is kind of tricky -- being able to disable the polling functionality entirely and do a one-shot build would be very useful.

@samoht
Copy link

samoht commented Jun 11, 2014

I managed to get past this first error message but I then get a new one:

$ jenga -no-notifiers
cant read: /proc/cpuinfo
no processor lines seen in: /proc/cpuinfo
*** jenga: [60237] root=/Users/thomas/git/jenga/examples/simple-ocaml-build, j=1, f=1
*** jenga: ERROR: jengaroot.ml: unable to digest file
*** jenga: exited with code 254
*** jenga: 0/2 targets are up to date
*** jenga: failed (#1, 0ms, heap(Kb)= 3721/5672, major=2, stat=1, digest=1, ls=0, db-save=0)
*** jenga: todo: 0 (0 / 2) !1 ~1 j=0+0 con=0 act=0, finished
*** jenga: ERROR: (summary) jengaroot.ml: unable to digest file
*** jenga: exited with code 254
*** jenga: build finished; not in polling mode so quitting
*** jenga: Quit; exit_code = 1

@mshinwell
Copy link

Set the environment variable JENGA_USE_OCAML_DIGEST and try again.

We should fix jenga so that it doesn't have a hard-coded dependency on /usr/bin/md5sum (which of course is called "md5" on the Mac).

@mshinwell
Copy link

Also, it might be helpful to run with -verbose.

@samoht
Copy link

samoht commented Jun 11, 2014

seems to work now, thanks!

$ export JENGA_USE_OCAML_DIGEST=1
$ jenga -no-notifiers -verbose
using internal ocaml digest instead of external call to md5sum
cant read: /proc/cpuinfo
no processor lines seen in: /proc/cpuinfo
*** jenga: [60913] root=/Users/thomas/git/jenga/examples/simple-ocaml-build, j=1, f=1
- build . jengaroot.ml
*** jenga: reading jengaroot.ml
*** jenga: finished reading jengaroot.ml (1.032s)
- build hello stdout
+ bash -c 'ocamldep -native hello.ml'
hello.cmo : world.cmi
hello.cmx : world.cmx
- exit hello stdout, 26ms, code 0
- build hello stdout
+ bash -c 'ocamldep -native world.ml'
world.cmo : world.cmi
world.cmx : world.cmi
- exit hello stdout, 7ms, code 0
- build hello stdout
+ bash -c 'ocamldep -native world.mli'
world.cmi :
- exit hello stdout, 8ms, code 0
- build hello world.cmi
+ bash -c 'ocamlopt -c world.mli'
- exit hello world.cmi, 20ms, code 0
- build hello world.cmx
+ bash -c 'ocamlopt -c world.ml'
- exit hello world.cmx, 29ms, code 0
- build hello hello.cmi
+ bash -c 'ocamlopt -c hello.ml'
- exit hello hello.cmi, 32ms, code 0
- build hello hello.exe
+ bash -c 'ocamlopt.opt world.cmx hello.cmx -o hello.exe'
- exit hello hello.exe, 66ms, code 0
*** jenga: 14/14 targets are up to date
*** jenga: done (#1, 207ms, heap(Kb)= 20792/210472, major=2, stat=133, digest=12, ls=10, db-save=0) -- HURRAH
*** jenga: todo: 0 (14 / 14) j=0+0 con=14 act=7, finished
*** jenga: build finished; not in polling mode so quitting
*** jenga: Quit; exit_code = 0

@mshinwell
Copy link

marvellous.

@avsm
Copy link

avsm commented Jun 11, 2014

awesome!

On 11 Jun 2014, at 16:54, Mark Shinwell notifications@github.com wrote:

marvellous.


Reply to this email directly or view it on GitHub.

@Nick-Chapman
Copy link

The "scary" warnings:

$ jenga
cant read: /proc/cpuinfo
no processor lines seen in: /proc/cpuinfo
*** jenga: [60913] root=/Users/thomas/git/jenga/examples/simple-ocaml-build, j=1, f=1

are because jenga attempts to determine the number of CPUs in order to choose a sensible default for the -j and -f flags. It fails, so you get j-1, f=1 (as it shows you).

If you want parallel builds, you will have to set -j on the command line. (#cpus-1) is a reasonable choice - but please experiment. Sadly this wont make the scary message go away.

The proper fix is for jenga to use an architecture independent way of determining the CPU count.

@ghost ghost assigned Nick-Chapman Jun 12, 2014
@mshinwell
Copy link

We're fixing Core to use the sysconf method to determine the number of cores, which will fix the /proc/cpuinfo problems (and make it know how many cores there are on a Mac).

@avsm
Copy link

avsm commented Jun 12, 2014

Need to guard sysconf around Linux|Darwin, as BSDs use sysctl to retrieve this information.

On 12 Jun 2014, at 10:47, Mark Shinwell notifications@github.com wrote:

We're fixing Core to use the sysconf method to determine the number of cores, which will fix the /proc/cpuinfo problems.


Reply to this email directly or view it on GitHub.

@mshinwell
Copy link

Really? I thought sysconf was a POSIX standard function...

@avsm
Copy link

avsm commented Jun 16, 2014

sysconf is, but _SC_NPROCESSORS_ONLN isnt mandated by POSIX yet [1]. I've just checked on modern OpenBSD and it does have it now, so it may be ok to depend on. Still good to guard it behind a #ifdef and default to one if not present.

[1] http://austingroupbugs.net/view.php?id=339

-a

On 16 Jun 2014, at 09:10, Mark Shinwell notifications@github.com wrote:

Really? I thought sysconf was a POSIX standard function...


Reply to this email directly or view it on GitHub.

@bsansouci
Copy link

Hey everyone, I'm trying to use jenga built from master on OS X 10.11 beta and am getting this error when running the command jenga -prog -P example/.runtest

*** jenga: [63054] root=/Users/benjamin/Downloads/jengaroot, sys=Darwin, j=1, f=1 (NO_VERSION_UTIL)
*** jenga: ERROR: cannot take any lock in "/Users/benjamin/Downloads/jengaroot/.jenga" (running on nfs?)
*** jenga: Quit; exit_code = 4

I initially thought it was related to flock which apparently shouldn't be used on OS X (and lockf is preferred). I tried removing the flock from core and building jenga with that local version but got the same error. I'm a little bit at a loss now...
I'll continue commenting here if I can find anything, but I'd love some help if anyone has any idea.

@ghost
Copy link

ghost commented Apr 4, 2016

@bsansouci, I noticed this as well the other day when trying jenga on my laptop. IIRC replacing flocked && lockfed by flocked || lockfed in core gave me a working jenga. Could you try that? I'll get this done properly for the next release

@bsansouci
Copy link

hey @diml thanks for that! I was building core wrong and it wasn't picking up my changes. This worked but I don't think we need to use both flock and lockf seeing how flock is supposed to be strictly better than lockf.
I'm now getting a bunch of preprocessing errors but those are due to my own package not jenga. Thanks a lot for your help :)

@ghost
Copy link

ghost commented Apr 5, 2016

No problem. We should include the proposed fix in a minor release of core, and we'll look for a better one for future releases; we'll need to add more #if variables to disable flock only on OSX

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants