Coder Social home page Coder Social logo

build fails on Mac OS Lion about erlexec HOT 19 CLOSED

saleyn avatar saleyn commented on August 15, 2024
build fails on Mac OS Lion

from erlexec.

Comments (19)

hyperthunk avatar hyperthunk commented on August 15, 2024

Looks like sigtimedwait isn't available on the mac (though it is in Darwin!?) - see

  1. hellige/dcpu@737ed47
  2. http://lists.apple.com/archives/unix-porting/2004/Mar/msg00072.html

There may be other BSD variants that this fails on - I'll look into those too.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

I don't have MacOS X to test this on. I just committed a fix that I believe should take care of compilation issues on lines 349 and 561. Regarding the first error - I need more time to examine this issue, and given that I don't have MacOS, I would appreciate if you could test & submit a workaround.

from erlexec.

hyperthunk avatar hyperthunk commented on August 15, 2024

Yes I will do, as I'd be pleased to contribute, though I can't promise when as I'm a bit tied up with the day job at the moment.

from erlexec.

hyperthunk avatar hyperthunk commented on August 15, 2024

Well, doing this properly on bsd based systems is going to be interesting. Once I've got a plan, I'll probably run my idea(s) past you before I dive in.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

Look forward to it. Thanks.

from erlexec.

davidw avatar davidw commented on August 15, 2024

Any updates on this guys?

from erlexec.

hyperthunk avatar hyperthunk commented on August 15, 2024

Sadly not for my part. I'm completely swamped with RabbitMQ, SysTest and Cloud Haskell work so I've not had any chance to look at this. It is on my TODO list - erlexec is something I'd like to use in SysTest - but right now it's below the priority of many other things that have also remained unattended in the last year.

from erlexec.

davidw avatar davidw commented on August 15, 2024

Looks like setresuid is something we could live without, so that one would be fine to just dump in order to at least have something that compiles. sigtimedwait looks a little bit trickier. On Windows it is also simply #ifdef'ed away in the erlexec code.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

Yes, the biggest hurdle is to do portable sigtimedwait on Mac OS. Since I don't have access to Mac, this has never been an issue, but if Tim or anyone could contribute this fix, it would be awesome.

from erlexec.

hyperthunk avatar hyperthunk commented on August 15, 2024

Hi @saleyn - I'd be happy to if I knew what the right answer is. It seems that you're using a hack on windows/cygwin already, and on unices where you do make the call, you set the both timeout's fields to 0, so on the windows platform you basically don't do any signal handling.

To get this to work for those platforms that don't support sigtimedwait is a lot of work. On Darwin and BSD, I guess we could do this using kqueue and EVFILT_SIGNAL, but kqueue is a bit flaky on Darwin. Nonetheless, I will try and get around to submitting a patch. It would help if there were more tests I could use to verify that it works though - how are you supposed to use the bash script in ./test/test1.sh for example?

from erlexec.

davidw avatar davidw commented on August 15, 2024

We ifdef'd things out, and things seem to work ok for the time being. Since the target platform is not Mac OS, that's good enough to at least get our Mac guy up and running, if someone else encounters this problem.

from erlexec.

davidw avatar davidw commented on August 15, 2024

https://github.com/davidw/erlexec/tree/make_mac_compile_hack - here's our hacky hack. Don't know if things actually run, but the important thing was to get our Mac guy able to do other stuff.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

It seems that in your version there are multiple things being implemented besides that hack. Can you separate the "hack" into an independent pull request that I'll merge? Also though unrelated what's the purpose of the "manage" command?

from erlexec.

davidw avatar davidw commented on August 15, 2024

I don't really care too much if the make_mac_compile_hack branch gets included. I don't consider it production code, just a hack so that things compile and our Mac guy can get on with his job. I added the link here in case anyone is in a similar situation. Indeed... perhaps it's best not to merge it - you wouldn't want someone thinking that things worked ok when they don't.

from erlexec.

jschrewe avatar jschrewe commented on August 15, 2024

So I tried to build erlexec on Mac Os X (uh, Snow Leopard, not sure about the exact version) and it looks like exec.cpp uses the glibc only function sigisemptyset. Which is missing on quite a lot of systems (although quite a few seem to be rather irrelevant to the grand scheme of things): http://www.gnu.org/software/gnulib/manual/html_node/sigisemptyset.html

I'm not really sure what the function is supposed to check exactly (as in how to write a replacement), but that seems to be the major missing thing for me.

Let me know if you need anything more. My C++ is a bit rusty though and I've never done any programming on Mac OS in C/C++ but aside from that I'm happy to provide additional information if you need it.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

I just pushed a fix. Please check as I don't have a Mac OS handy, and cannot test it. If it builds successfully, run "make all test" just to make sure all the tests pass.

from erlexec.

jschrewe avatar jschrewe commented on August 15, 2024

Builds (almost) cleanly. There is one warning but I don't think it's Mac OS related:

Compiling c_src/exec.cpp
c_src/exec.cpp: In function ‘void check_pending()’:
c_src/exec.cpp:479: warning: unused variable ‘timeout’

One test seems to fail. Here is an excerpt from the make all test:

* Process 12718 (ret=12718, status=0, sig=20, oktojump=1, exited_count=0 [exited])
Checking 1 running children (exited count=1)
Checking 1 exited children (wakeup=5.000)
Read 6 bytes from pid 12718's stderr (fd=6): ok
Closing pid 12718's stderr
Selecting maxfd=3 (sleep={5s,0us})
Select got 1 events (maxfd=3)
Parsed cmd 'echo TEST2 1>&2' options
  (stdin=null, stdout=erlang, stderr=stdout)
  Redirecting [stdin -> null]
  Redirecting [stdout -> pipe:{r=6,w=7}]
  Redirecting [stderr -> stdout]
Starting child: 'echo TEST2 1>&2'
  child  = (stdin=null(fd:5), stdout=fd:7, stderr=stdout)
  parent = (stdin=none, stdout=fd:6, stderr=none)
  Args[0]: /bin/bash
  Args[1]: -c
  Args[2]: echo TEST2 1>&2
Spawned child pid 12719
  Parent closing pid 12719 pipe writing end (fd=7)
  Setup reading end of pid 12719 stdout redirection (fd=6 [non-block])
Pid 12719 adding stdout checking (fd=6)
Selecting maxfd=6 (sleep={5s,0us})
Select got 1 events (maxfd=6)
Child process 12719 exited
* Process 12719 (ret=12719, status=0, sig=20, oktojump=0, exited_count=0 [exited])
Read 6 bytes from pid 12719's stdout (fd=6): ok
Checking 1 running children (exited count=1)
Checking 1 exited children (wakeup=5.000)
Read 0 bytes from pid 12719's stdout (fd=6): No such process
Eof reading pid 12719's stdout, closing fd=6: No such process
Selecting maxfd=3 (sleep={5s,0us})
Select got 1 events (maxfd=3)
Parsed cmd 'echo $XXX' options
  (stdin=null, stdout=erlang, stderr=null)
  Redirecting [stdin -> null]
  Redirecting [stdout -> pipe:{r=6,w=7}]
  Redirecting [stderr -> null]
Starting child: 'echo $XXX'
  child  = (stdin=null(fd:5), stdout=fd:7, stderr=null(fd:5))
  parent = (stdin=none, stdout=fd:6, stderr=none)
  Args[0]: /bin/bash
  Args[1]: -c
  Args[2]: echo $XXX
Spawned child pid 12720
  Parent closing pid 12720 pipe writing end (fd=7)
  Setup reading end of pid 12720 stdout redirection (fd=6 [non-block])
Pid 12720 adding stdout checking (fd=6)
Selecting maxfd=6 (sleep={5s,0us})
Select got 1 events (maxfd=6)
Read 2 bytes from pid 12720's stdout (fd=6): ok
Child process 12720 exited
* Process 12720 (ret=12720, status=0, sig=20, oktojump=0, exited_count=0 [exited])
Checking 1 running children (exited count=1)
Checking 1 exited children (wakeup=5.000)
Read 0 bytes from pid 12720's stdout (fd=6): No such process
Eof reading pid 12720's stdout, closing fd=6: No such process
Selecting maxfd=3 (sleep={5s,0us})
Select got 1 events (maxfd=3)
Parsed cmd 'trap '' SIGTERM; sleep 30' options
  (stdin=null, stdout=null, stderr=null)
  Redirecting [stdin -> null]
  Redirecting [stdout -> null]
  Redirecting [stderr -> null]
Starting child: 'trap '' SIGTERM; sleep 30'
  child  = (stdin=null(fd:5), stdout=null(fd:5), stderr=null(fd:5))
  parent = (stdin=none, stdout=none, stderr=none)
  Args[0]: /bin/bash
  Args[1]: -c
  Args[2]: trap '' SIGTERM; sleep 30
Spawned child pid 12721
Selecting maxfd=3 (sleep={5s,0us})
Select got 1 events (maxfd=3)
Calling kill(pid=12721, sig=15)
Sent SIGTERM to pid 12721 (timeout=1s)
Selecting maxfd=3 (sleep={5s,0us})
Got signal: 15 (oktojump=0)
Select got 0 events (maxfd=3)
Checking 1 running children (exited count=0)
Calling kill(pid=12721, sig=9)
Checking 0 exited children (wakeup=0.000)
Selecting maxfd=3 (sleep={5s,0us})
Child process 12721 exited
* Process 12721 (ret=12721, status=9, sig=20, oktojump=1, exited_count=0 [signaled])
Checking 1 running children (exited count=1)
Checking 1 exited children (wakeup=5.000)
Selecting maxfd=3 (sleep={5s,0us})
exec:926: exec_test_...Select got 1 events (maxfd=3)
Setting alarm to 12 seconds
Calling kill(pid=0, sig=15)
Got signal: 15 (oktojump=0)
Exiting (13)
*failed*
in function exec:'-test_kill_timeout/0-fun-0-'/0 (src/exec.erl, line 1019)
**error:{assertMatch_failed,[{module,exec},
                     {line,1019},
                     {expression,"timeout"},
                     {pattern,"{ 'DOWN' , _ , process , P , normal }"},
                     {value,timeout}]}


=======================================================
  Failed: 1.  Skipped: 0.  Passed: 9.
ERROR: One or more eunit tests failed.
make: *** [test] Error 1

I'm happy to post the whole thing if you need it. Not sure if you need it though, I'm still learning Erlang.

And thanks for the quick fix.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

Ok, that timing error can be ignored for now, and has nothing to do with the fix.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

I also fixed the warning in the last commit

from erlexec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.