coin-or / coinbrew

COIN-OR build and installation script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing cgraph.h in Osi when building Cbc 2.10.4

andreaslundell opened this issue · comments

When I try to build the latest release of Cbc (2.10.4) or the master branch with the command
./coinbrew fetch build Cbc:releases/2.10.4 --prefix=/opt/cbc-2.10.4
it fails when building Osi master with the following error:

##################################################
### Fetching Osi master 
##################################################

Cloning into 'Osi'...
remote: Enumerating objects: 220, done.
remote: Counting objects: 100% (220/220), done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 14881 (delta 145), reused 117 (delta 67), pack-reused 14661
Receiving objects: 100% (14881/14881), 5.94 MiB | 1.58 MiB/s, done.
Resolving deltas: 100% (11338/11338), done.

##################################################
### Configuring Osi master 
##################################################

configure: WARNING: No solver available, examples will not work.


##################################################
### Building Osi master 
##################################################

In file included from /home/andreas/Research/COIN/cbc-trunk/coinbrew/Osi/src/Osi/OsiAuxInfo.cpp:12:
/home/andreas/Research/COIN/cbc-trunk/coinbrew/Osi/src/Osi/OsiSolverInterface.hpp:19:10: fatal error: cgraph.h: No such file or directory
 #include "cgraph.h"
          ^~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:661: OsiAuxInfo.lo] Error 1
make[1]: *** [Makefile:521: all] Error 2
make: *** [Makefile:568: all-recursive] Error 1

Build failed, see error output above

Cbc 2.10.4 and master are very different.
The output you send is from building Cbc master (or trunk), is it, not release 2.10.4?

If you have some leftover files from a previous use of coinbrew in the same directory, try to delete these first.

The cgraph.h is part of CoinUtils/master (which is used by Cbc/master), but not of the CoinUtils release that belongs to Cbc 2.10.4.

True, the build of 2.10.4 succeeded when I did everything from scratch, the one with the error was the trunk version. Perhaps one cannot expect to compile the trunk version?

trunk is expected to compile, too. It should install CoinUtils/trunk, which should install cgraph.h, so that it can be found in the build of Osi.
If you run coinbrew with --verbosity=4, then we may see more.

I sent the output by mail, the last part was

Cloning into 'Osi'...
remote: Enumerating objects: 220, done.
remote: Counting objects: 100% (220/220), done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 14881 (delta 145), reused 117 (delta 67), pack-reused 14661
Receiving objects: 100% (14881/14881), 5.94 MiB | 2.35 MiB/s, done.
Resolving deltas: 100% (11338/11338), done.
configure: WARNING: No solver available, examples will not work.
In file included from /home/andreas/Research/COIN/cbc-trunk/coinbrew/Osi/src/Osi/OsiAuxInfo.cpp:12:
/home/andreas/Research/COIN/cbc-trunk/coinbrew/Osi/src/Osi/OsiSolverInterface.hpp:19:10: fatal error: cgraph.h: No such file or directory
 #include "cgraph.h"
          ^~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:661: OsiAuxInfo.lo] Error 1
make[1]: *** [Makefile:521: all] Error 2
make: *** [Makefile:568: all-recursive] Error 1

I can verify that the files cgraph.h and cgraph.cpp are present in the /CoinUtils/src subdirectory...

The problem seems to be that coinbrew does not install the new CoinUtils build before attempting to build Osi and then the Osi build picks up some old CoinUtils installation from /usr.
One workaround should be to run the whole coinbrew with root permissions, since coinbrew would install a project before building the next one if it has write permission to prefix. Or just give user andreas write permissions to $prefix (/opt/cbc-trunk).

Yes, you are correct, it works by giving write permissions to the destination directory. I did not dare to run it with sudo permissions though :) Thanks!

coinbrew only installs each project automatically if the installation directory is writable. You can request installation of each project explicitly by adding an explicit install command. This will then run the installation with sudo but nothing else, which is much safer than running the whole script as sudo.

./coinbrew fetch build install Cbc --prefix=/opt/cbc-master

At the moment, the master branch will not build properly when the prefix is not writable and install is not explicitly requested. There is a fix for this, which has not yet been implemented. @svigerske did we agree to add the *-uninstalled.pc files back? Otherwise, I should just spit out an error in this case to let the user know that it won't work and how to fix it. I guess I could also just always install each project and then the user will be prompted for the sudo password if the prefix is not writable.

I would prefer if coinbrew would just call make install via sudo if prefix isn't writable.

Also skip having to specify "fetch build install" and simplify to

./coinbrew Cbc --prefix=/opt/cbc-master

So you really don't think there will be people who want to do the whole build before installing? I personally would prefer to be able to build first and then install separately. How strong are you on this?

My systems package manager builds and installs each project at a time, instead of building against a dependency in one location and then hoping it will still work when both have been installed. I found that natural.

If one is afraid that the whole coinbrew build breaks and one ends up with only some dependencies installed and not the main project, then one can just run everything with a different --prefix first to check whether the build would run through. Also the uninstall option could be useful to cleanup.

The main goal is to keep things simple. Having multiple ways to build against dependencies (and coinbrew even selecting one automatically in some not-so-transparent way) isn't helping on keeping the whole system maintainable.

I don't really see this as a big maintenance issue. I understand that it's a slippery slope and things tend to creep in little by little over time until the whole thing becomes unmaintainable, but that wasn't really what happened with the old build system. It just wasn't designed to be maintainable from the start. The -uninstalled.pc.in files were never any trouble and are independent of the rest of the build system. I think we can be diligent about not letting too many other things creep in.

With that said, I do agree with you, mostly. If we had as many checks and tests in place as are done for Debian and Fedora packages before they are pushed out, I would be totally on board. I agree that it is the usual way things usually work. It's the way the homebrew recipes on OS X already work for COIN-OR projects, but they at least force the unit tests to pass before doing the installation and they also install each project in its own separate sandbox instead of just throwing them into system directories. It's actually quite nice the way they have that set up.

I guess if we're going to automatically install to a prefix, we should at least run unit tests for each individual project before installation. I will probably start making that the default and think about what else we can/should do.

OK, I've modified coinbrew now so that unit tests are run for all projects by default before installation and installation is done automatically in all cases. This should resolve this issue.