You are not logged in.

#1 2015-01-14 12:07:44

jmilton00
Member
From: Rome, Italy
Registered: 2015-01-14
Posts: 10

[SOLVED] C++ and OGDF - A beginner's problem

Hello everyone,

First things first, I apologize if this is the wrong section, since my question will be very simple (maybe the Newbie corner was better?).

Here comes the problem: I want to build the OGDF libraries in my C++.

Instructions say "unpack in the directory, where you want to install OGDF". Now, what is the right directory? /usr/include/c++/$version seems the most appropriate, but copying the whole folder there just doesn't seem "right".

Or should I just build wherever I want and then link the folder with the header files to /usr/include/c++/$version?

Thanks in advance.

Last edited by jmilton00 (2015-01-14 18:09:14)

Offline

#2 2015-01-14 12:55:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,331
Website

Re: [SOLVED] C++ and OGDF - A beginner's problem

No, sadly their "installation" instructions do not provide any way to to actually install it.  You download it into the working directory of the project you are going to use it with.  Alternatively you could also just build it somewhere under ~ and link to it there for any project that uses it.

You should not be putting such things in / without a PKGBUILD.  I figured it should be pretty easy to get this to do a proper install with a PKGBUILD, but sadly that is not the case.  Their "build system" is the most f***ed up thing I've ever seen: you have to edit a python file, then run a shell script that runs a python script that sources the pythong config, that then finally makes a Makefile.  Then you have to use make, but this ridiculously constructed Makefile doesn't even have an install directive.  This might be pretty easy to patch, except the python script itself is a rats-nest of errors - I couldn't even get to the Makefile.  Quite frankly, I'd never use a library from someone who used that approach to building it.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2015-01-14 13:54:31

jmilton00
Member
From: Rome, Italy
Registered: 2015-01-14
Posts: 10

Re: [SOLVED] C++ and OGDF - A beginner's problem

Their "build system" is the most f***ed up thing I've ever seen: you have to edit a python file, then run a shell script that runs a python script that sources the pythong config, that then finally makes a Makefile.

Amen. Last update is dated 2012, they didn't even bother to keep it up to date.

Quite frankly, I'd never use a library from someone who used that approach to building it.

Neither would I. Sadly, I need to build a program which strongly relies on these libraries.

I'd write another one myself, if only I had that knowledge about graph theory...

Thank you anyways, I guess the "dirty" solution is the only one approachable. I'll try and write a feedback here, if I get to make it work.

Offline

#4 2015-01-14 14:52:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,331
Website

Re: [SOLVED] C++ and OGDF - A beginner's problem

If you can get it to build, keep track of the steps (what files were patched).  With that information we could put together a PKGBUILD so that a propper package could be made and installed to the root filesystem.  There are really only two obstacles to doing that: 1) getting it to build, then 2) figuring out what the installation commands should be.

Number 2 shouldn't be hard, but it's hard to say that confidently without knowing what all is build (e.g. seeing this mysertious Makefile that results from step 1).  If there are only a couple lib files, and a handful of headers, it'd be pretty simple.

Number 1 never should be hard ... but in this case it looked to me like it needed a bit of work.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2015-01-14 14:55:00

jmilton00
Member
From: Rome, Italy
Registered: 2015-01-14
Posts: 10

Re: [SOLVED] C++ and OGDF - A beginner's problem

Actually, #1 is quite simple (at least it worked for me), the only thing to do is to run the script with python2.
As for #2, I'm not that big of an expert...

Last edited by jmilton00 (2015-01-14 14:55:13)

Offline

#6 2015-01-14 15:02:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,331
Website

Re: [SOLVED] C++ and OGDF - A beginner's problem

Huh, that did work.  I had tried replacing the "env python" hashbang with "env python2" but that didn't work for me.  Explicitly calling the py script with python2 seemed to work ... standby, lets see if this beast will install.

EDIT: actually there is an install directive in there, and it properly supports DESTDIR.  A working PKGBUILD should be able to come out of this.  Sadly, that Makefile has over 200 times as many lines of code as one of my full packages to do complex sound analysis even with a gui.  That's not a Makefile, that's an operating system (actually it has twice as many lines of code as the first linux kernel).

Here's a placeholder PKGBUILD I'm starting to test out - if you know the dependencies, that would be helpful (python2 is obviously one builddep):

# Maintainer: TODO
_gitname="ogdf"
pkgname="${_gitname}-git"
pkgver=0
pkgrel=1
pkgdesc='TODO'
url='https://github.com/ogdf/ogdf'
arch=('i686' 'x86_64')
license=('GPL3')
depends=('')
makedepends=('git' 'python2')
source=("${_gitname}::git://github.com/ogdf/ogdf.git")
sha256sums=('SKIP')

pkgver() {
	cd "${_gitname}";
	echo "$(git rev-list --count HEAD).$(git describe --always )"
}

build() {
	cd "${_gitname}"
	sed -i 's|^\(installPrefix = \).*|\1/usr|' makeMakefile.config
	python2 makeMakefile.py
	make
}

package() {
	cd "${_gitname}"
	make DESTDIR="${pkgdir}" install
}

I do tend to prefer git sources when available - and as an added bonus, they seem to have switched the default from being a static build so that doesn't need to be patched too.

Last edited by Trilby (2015-01-14 15:13:54)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2015-01-14 15:18:46

jmilton00
Member
From: Rome, Italy
Registered: 2015-01-14
Posts: 10

Re: [SOLVED] C++ and OGDF - A beginner's problem

This is the only thing I found... So I hope no other dependencies are required, or they would be really poor developers (not that they showed different so far...)

Offline

#8 2015-01-14 15:37:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,331
Website

Re: [SOLVED] C++ and OGDF - A beginner's problem

I just revised the PKGBUILD above - it builds, checks out fine with namcap, and installs perfectly.  There is even a proper .pc file for use with pkg-config like any other lib.  So despite the oddities of the build process, this seems to be well put together and I'd retract my earlier suspicion of the code itself.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2015-01-14 18:08:56

jmilton00
Member
From: Rome, Italy
Registered: 2015-01-14
Posts: 10

Re: [SOLVED] C++ and OGDF - A beginner's problem

Apparently, it worked.

Thank you so much, my program still isn't working but it's not OGDF's fault (will I ever be able to compute an approximation of the permanent of a matrix? Who knows...).

Problem (at least this one) solved.

Offline

Board footer

Powered by FluxBB