berkshelf/solve

Switch to gecode

danielsdeleo opened this issue ยท 14 comments

To my understanding, the reason gecode isn't used is to better support windows. I have been able to compile gecode relatively easily using the mingw toolchain that comes with the DevKit embedded inside a chef-client omnibus package. Gecode versions 3.7.3 and latest both seem to compile fine. In addition, I was able to resolve linker errors when building the dep_selector gem and successfully compile the ruby extension (see: markan/dep-selector#5 ).

Therefore, it should be possible to use the same code in berks as is used by the chef-server (version 11.1 of the server switches back to the dep_selector solver), which should result in better deployment stability and a performance improvement when solving.

The obvious downside is that C extensions in ruby can be a PITA. At Chef (the company) we're willing to provide omnibus builds with gecode precompiled, which will ease the pain for anyone using that installation method. We can also investigate creating a gecode-library gem, which could be built as a binary gem for some platforms (linux might be very difficult, with the range of libc versions in use, but Windows and possibly Mac OS X should be more straightforward).

@danielsdeleo yup, just as soon as that is merged in we should re-wrap dep-selector in here. The code for that already exists in the history of the project.

We'll definitely want omnibus builds with gecode pre-compiled to hide that grossness from the end user.

The early versions of Berkshelf, which used dep_selector, got many complaints due to the size of Gecode and the time it takes to compile, so I think a precompiled gem (as mentioned) is a must when we reintroduce dep_selector.

๐Ÿ‘

@bluepojo yep, if you disable docs and examples, and use -j with make, gecode compiles in 5 or 6 minutes, but that's still a fair bit of time. Do you have any experience with precompiled gems on Linux? My fear is that rubygems' platform options are not sophisticated enough to let us easily distinguish between, say, RHEL5 and Ubuntu latest.

@danielsdeleo @bluepojo I'm ๐Ÿ‘ on precompiling the thing

We should test with the graphs in berkshelf/berkshelf#949

luis lavena has done a great amount of work with rake-compiler -- you might want to talk to him about it.

@danielsdeleo plz make sure I can use the precompiled gecode from a Windows Omnibus Chef DK install when installing the vagrant-berkshelf plugin...

@ringods I think the vagrant-berkshelf plugin will eventually not install all of berks into vagrant. For now, use the ruby devkit: http://rubyinstaller.org/downloads/

I doubt we'll be able to easily make vagrant use libraries from outside its sandbox.

I don't think my toolchain is too kinky, but am having problems on windows doing a gem install berkshelf lately , which tries to install dep-selector-libgecorde -v '1.0.0'

It complains that tar.exe is needed.

In another environment with Git\bin in the path, which comes with tar.exe (conflicting MSYS environment), the tar.exe crashes and leaves a stackdump.

Yes, the late change to gecode kinda messed me up. I'm trying to find a consistent way through it.

The tar that comes with git has a bunch of bugs. You can get a working tar from the chef MSI package or http://gnuwin32.sourceforge.net/packages/gtar.htm

Had a crazy time making this work still, but was ultimately successful. But it was super hacky.

I tried fixing up the extconf.rb to get dep-selector-libgecode-.1.0.0 to work with a windows system install of gecode, but gave up after couple hrs and went back to trying to build from source, needing tar.exe that didn't crash.

Even that old gnuwin32 tar.exe (and two needed libs-http://gnuwin32.sourceforge.net/downlinks/tar-dep-zip.php) caused trouble. If I dropped them in c:\DevKit\bin , the ./configure would bomb out early. If i dropped them into Git's/bin, it overwrote a needed dll, but i was able to build dep-selector-libgecode finally.

After this was successful, bundle install on my app failed to be able to grab berkshelf from git. Because apparently i broke git, so i had to rever to a backup copy of git/bin without clobbered .dll file.

Whew. dang. Getting so tired of forcing windows compatibility on the tool chain. Maybe with another 4-10 hours we can figure a way to install gecode gem on a vanilla ruby+devkit windows environment.

@gmanfunky what if we would ask the authors of dep-selector-libgecode to release a gem with precompiled native extensions? Have a look at libv8 or nokogiri, they have done this too.

@gmanfunky those maintainers are all the same people ๐Ÿ˜„