Jan Stolarek | 15 Dec 16:08 2012
Picon

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 <at> 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 <at> 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 
(Continue reading)

Mikhail Glushenkov | 15 Dec 20:58 2012
Picon

Re: Separating build tree from the source tree

Hi Jan,

On Sat, Dec 15, 2012 at 4:08 PM, Jan Stolarek <jan.stolarek <at> p.lodz.pl> wrote:
> 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 <at> 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
Ian Lynagh | 17 Dec 20:33 2012

Re: Separating build tree from the source tree


Hi Jan,

On Sat, Dec 15, 2012 at 04:08:23PM +0100, Jan Stolarek wrote:
> 
> [killy <at> 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
Jan Stolarek | 18 Dec 11:09 2012
Picon

Re: Separating build tree from the source tree

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
Simon Marlow | 18 Dec 15:16 2012
Picon

Re: Separating build tree from the source tree

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#Sourcetreesandbuildtrees

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,
(Continue reading)

Jan Stolarek | 18 Dec 21:45 2012
Picon

Re: Separating build tree from the source tree

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

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Jan Stolarek | 20 Dec 09:47 2012
Picon

Re: Separating build tree from the source tree

> 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
David Brown | 21 Dec 01:37 2012

Re: Separating build tree from the source tree

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
Jan Stolarek | 21 Dec 22:40 2012
Picon

Re: Separating build tree from the source tree

> 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.
Thanks! I inspected the Makefile and it turns out that there is no need for a workaround:

make maintainer-clean

does the job.

Janek

Gmane