Or-tools: Inconsistencies in Mac build process causing frequent crashes in CBC

Created on 8 Apr 2016  Â·  12Comments  Â·  Source: google/or-tools

Hi, we've been using GLOP with no issues for a while. We recently tried using CBC, and found it was crashing locally (on Mac OSX) very inconsistently (example core dump). We have not seen it crash on linux.

Through more testing, I got this error message to show up when it crashed: Illegal Instruction: 4. After googling that, it looks like that means my machine was trying to execute an instruction that it didn't understand, based on the compatibility version the binary was compiled for (stack overflow).

After building or-tools from source again, I noticed there were some linker warnings when running make cc, specifically saying it was trying to link >= 10.8 things with => 10.11 things (I'm on 10.11). The way the Mac build is set up currently, it seems to build all the dependencies with the system OS as minimum, but or-tools with >= 10.8.

I did a lot of experimentation with the or-tools Makefiles, and eventually came up with a build that works locally, and it hasn't crashed yet. Essentially, what I did is to pipe the -mmacosx-version-min=10.8 to all of the third party dependencies. Not exactly sure why, but that also required piping in -stdlib=libc++ everywhere as well. For CBC, I also had to --disable-shared to get it to compile.

I'm very much a novice in make and build processes, so I'm sure there's something I'm missing, or there's a better way to achieve this, but this is what I came up with to fix it: https://github.com/google/or-tools/compare/master...galonsky:galonsky/master/fix-mac-build

I'd appreciate it if someone more knowledgeable on the subject could take a look. Unfortunately, I don't have a simple test case that breaks consistently with the old build. For what it's worth, we're running through the jni lib, but we haven't narrowed down what conditions actually make it crash.

Thanks!

Bug Mac

Most helpful comment

Was this ever resolved? It seem remarkably similar to an issue I am encountering now.

All 12 comments

Hi,

I do not believe the macosx_version_min changes anything.
I am also interested in the -stdlib=libc++, but disabling shared worries me.

I will look at your patch.

Thanks

OK, I take that back.
Can you try by just removing the -mmacosx-version-min=10.8 from the makefile.
Maybe it solves the problem.

--Laurent

Yes, I did try that. That effectively builds everything with a minimum of whatever system is building it (10.11 in my case, and it did work fine for me). But since we have multiple versions of OS X running this binary, I'd also like something like >= 10.8 so it works on more dev boxes.

Hi,

I pushed a simpler version of your patch.
Everything compiles on my mac, and I have no warning on the min version.

Can you run:

make clean_third_party
make third_party
make clean
make cc

and rerun your tests?

Thanks

Thanks! I will try it this afternoon.

Built from the latest master, and no errors on the build, but I am still seeing Illegal Instruction: 4 occasionally when running our tests.

For what it's worth, it seems there's still some libraries compiled with the system compatibility version:

cd dependencies/install/lib
find . -type f -name '*.a'  | xargs otool -l | grep -A2 "Archive\|LC_VERSION_MIN_MACOSX" | grep -B5 10.11 | grep "\.a"
./libfl.a(libmain.o):
./libfl_pic.a(libmain.o):
./libltdl.a(libltdl_libltdl_la-preopen.o):
./libpcre.a(libpcre_la-pcre_byte_order.o):
./libpcrecpp.a(libpcrecpp_la-pcrecpp.o):
./libpcreposix.a(libpcreposix_la-pcreposix.o):
./liby.a(main.o):

(the rest are 10.8)

Also, I'm able to get this test to pretty consistently crash on my Mac: https://gist.github.com/galonsky/a81bf13028e8f25cf8d85fc56128ab7b

Strange,

I create issue173.cc and Issue173.java, tested both on my mac, no crashes.

--Laurent

Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00

2016-04-14 0:18 GMT+02:00 Alex Galonsky [email protected]:

Also, I'm able to get this test to pretty consistently crash on my Mac:
https://gist.github.com/galonsky/a81bf13028e8f25cf8d85fc56128ab7b

—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
https://github.com/google/or-tools/issues/173#issuecomment-209671635

Out of curiosity, what version of OS X are you building and running on?

10.11.4
Le 14 avr. 2016 21:54, "Alex Galonsky" [email protected] a écrit :

Out of curiosity, what version of OS X are you building and running on?

—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
https://github.com/google/or-tools/issues/173#issuecomment-210121151

Was this ever resolved? It seem remarkably similar to an issue I am encountering now.

No report in 2 years. I guess the problem was solved.

Was this page helpful?
0 / 5 - 0 ratings