Separating build tree from the source tree

Dear list, I have a GHC source tree in ghc-working. I would like to have a separate build tree in ghc-build, so I did something like this: mkdir ghc-build cd ghc-build lndir ../ghc-working Now, I have two different machines. On openSUSE with git 1.8.0 I get something like this: [killy@xerxes : /dane/uczelnia/projekty/ghc-build] ./configure checking for gfind... no checking for find... /usr/bin/find checking for GHC version date... configure: WARNING: cannot determine snapshot version: no .git or _darcs directory and no VERSION file Despite the warning configure succeeds. On Debian Squeeze with git 1.7.10 the same thing doesn't work: [killy@GLaDOS : /dane/uczelnia/projekty/ghc-build] ./configure checking for gfind... no checking for find... /usr/bin/find checking for GHC version date... fatal: Not a git repository (or any of the parent directories): .git configure: error: failed to detect version date: check that git is in your path Does anyone have a clue why this happens? There are probably some differences on these systems with the most obvious one being git version. On both systems however git doesn't recognize ghc-build as a valid git repository ('git status' failes), but on one of them this is only a warning while on another this is an error. Any advice will be appreciated. Janek

Hi Jan,
On Sat, Dec 15, 2012 at 4:08 PM, Jan Stolarek
Dear list,
I have a GHC source tree in ghc-working. I would like to have a separate build tree in ghc-build, so I did something like this:
mkdir ghc-build cd ghc-build lndir ../ghc-working
Now, I have two different machines. On openSUSE with git 1.8.0 I get something like this:
[killy@xerxes : /dane/uczelnia/projekty/ghc-build] ./configure
IIRC, you should run something like ../ghc/configure instead of ./configure. -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments

Hi Jan, On Sat, Dec 15, 2012 at 04:08:23PM +0100, Jan Stolarek wrote:
[killy@xerxes : /dane/uczelnia/projekty/ghc-build] ./configure checking for gfind... no checking for find... /usr/bin/find checking for GHC version date... configure: WARNING: cannot determine snapshot version: no .git or _darcs directory and no VERSION file
It looks like "test -d .git" fails on openSUSE for some reason. See the FP_SETUP_PROJECT_VERSION macro in aclocal.m4. Thanks Ian

It turns out that running 'perl boot' in symlinked directory (ghc-build) is not enough. I had to run 'perl boot' in the original ghc-working dir and now configure succeedes in ghc-build. Janek

On 18/12/12 10:09, Jan Stolarek wrote:
It turns out that running 'perl boot' in symlinked directory (ghc-build) is not enough. I had to run 'perl boot' in the original ghc-working dir and now configure succeedes in ghc-build.
You shouldn't do that, because now you have build files in your source directory. The problem you ran into is that the configure script tries to use git to detect the date of the latest patch, to use as the version number of GHC (e.g. 7.7.20121218). If you're in a build tree made by lndir, then you don't have a .git directory, so the configure script gives up and uses 7.7 as the version. This will work, but it's not good because if you later install some packages for this GHC build using cabal, they will conflict with packages from other GHC builds in your ~/.cabal directory. (you can use cabal-dev to avoid this, which is what I do sometimes). I've added a note to the wiki about this: http://hackage.haskell.org/trac/ghc/wiki/Building/Using#Sourcetreesandbuildt... The workaround is to link your .git directory from your build tree, like so: $ cd ghc-build $ ln -s $source/.git . where $source is your source tree. I don't know why configure failed on your Debian box, though. Cheers, Simon

Dnia wtorek, 18 grudnia 2012, Simon Marlow napisaĆ:
On 18/12/12 10:09, Jan Stolarek wrote:
It turns out that running 'perl boot' in symlinked directory (ghc-build) is not enough. I had to run 'perl boot' in the original ghc-working dir and now configure succeedes in ghc-build.
You shouldn't do that, because now you have build files in your source directory. I know. That's why I didn't do it at first and only later thought that this might be the right way of doing things. Clearly, it is not.
The workaround is to link your .git directory from your build tree, like so:
$ cd ghc-build $ ln -s $source/.git .
where $source is your source tree. Right now I'm on Suse and this solution works - warning is gone and configure determines version correctly. I'll report on Debian on Thursday.
Janek

The workaround is to link your .git directory from your build tree, like so:
$ cd ghc-build $ ln -s $source/.git .
where $source is your source tree. I managed to get it working on Debian though there were some small issues. Lndir linked .git directory by default, but it was not visible to ./configure. I had to `rm -r .git; ln -s ghc-working/.git .` and things seem to work now. One thing bothers me: how can I undo `perl boot`? `make clean` doesn't seem to remove the configure scripts so I am not sure whether the tree in the ghc-build directory works because of symlinking .git or because I have configure files in the original source directory.
Janek

On Thu, Dec 20, 2012 at 09:47:09AM +0100, Jan Stolarek wrote:
The workaround is to link your .git directory from your build tree, like so:
$ cd ghc-build $ ln -s $source/.git .
where $source is your source tree. I managed to get it working on Debian though there were some small issues. Lndir linked .git directory by default, but it was not visible to ./configure. I had to `rm -r .git; ln -s ghc-working/.git .` and things seem to work now. One thing bothers me: how can I undo `perl boot`? `make clean` doesn't seem to remove the configure scripts so I am not sure whether the tree in the ghc-build directory works because of symlinking .git or because I have configure files in the original source directory.
How about, in the source directory: git clean -dfx or perhaps with -X instead. You can use -n instead of -f to see what it'd do. David
participants (5)
-
David Brown
-
Ian Lynagh
-
Jan Stolarek
-
Mikhail Glushenkov
-
Simon Marlow