Mercury Bugs - mercury
View Issue Details
0000203mercuryBugpublic2011-07-11 14:222013-03-18 15:23
Reporterjuliensf 
Assigned Towangp 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000203: Problem with DESTDIR and Darwin
DescriptionReported by Jeremy Huddleston (jeremyhu@macports.org) on mercury-bugs:

--------

And one more bug to report...
                                                                                                                                                                                                             
mercury-11.01 fails to make install the first time.
                                                                                                                                                                                                             
This looks like some bad logic for making boehm_gc a second time during the make install.
                                                                                                                                                                                                             
cp ./libatomic_ops-install/lib/libatomic_ops.a gc.a
cp: ./libatomic_ops-install/lib/libatomic_ops.a: No such file or directory
gmake[3]: *** [gc.a] Error 1
gmake[3]: Leaving directory
`/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_lang_mercury/mercury/work/mercury-11.01/install_grade_dir.hlc.gc/boehm_gc'
gmake[2]: *** [submake] Error 2
gmake[2]: Leaving directory
`/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_lang_mercury/mercury/work/mercury-11.01/install_grade_dir.hlc.gc/boehm_gc'
To clean up from failed install, remove
/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_lang_mercury/mercury/work/mercury-11.01/install_grade_dir.hlc.gc
gmake[1]: *** [install_grades] Error 1
gmake[1]: Leaving directory `/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_lang_mercury/mercury/work/mercury-11.01'
make: *** [install] Error 2
make: Leaving directory `/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_lang_mercury/mercury/work/mercury-11.01'
shell command " cd "/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_lang_mercury/mercury/work/mercury-11.01" && /usr/bin/make -w install
DESTDIR=/opt/local/var/macports/build/_Volumes_Home_jeremy_src_macports_trunk_dports_lang_mercury/mercury/work/destroot " returned error 2
                                                                                                                                                                                                             
Here's the full log, but I'm just doing a fairly standard ./configure && make && make install DESTDIR=/path/to/stage
TagsNo tags attached.
Attached Filesgz main.log.gz (131,988) 2011-07-11 14:24
https://bugs.mercurylang.org/file_download.php?file_id=123&type=bug
patch 0001-Fix-for-bug-203-DESTDIR-brokes-installation.patch (2,036) 2012-07-06 07:22
https://bugs.mercurylang.org/file_download.php?file_id=154&type=bug

Notes
(0000337)
jeremyhu   
2011-07-12 02:54   
Adding a note in hopes that it will add me to a CC list, since I don't see any CC UI (I'm not familiar with Mantis).
(0000340)
pbone   
2011-07-28 12:36   
I can confirm this.
(0000341)
pbone   
2011-07-28 13:01   
DESTDIR was only ever made to work when building Mercury for a single grade, that's all I needed when I implemented it. It _should_ work for builds with more than one grade but I never implemented that.

What this means is that this problem probably isn't Darwin specific, It also means that the solution is going to be more difficult since it's now about implementing an incomplete feature rather than fixing a bug.

Thanks.
(0000472)
ony   
2012-07-06 07:24   
That 0001-Fix-for-bug-203-DESTDIR-brokes-installation.patch is based on rotd-2012-07-01
(0000475)
pbone   
2012-07-08 11:01   
Thanks for the patch, I promise to look at it, but I don't have a lot of time at the moment.
(0000494)
pbone   
2013-01-09 00:25   
Hi ony.

Before reviewing your patches I want to make check some things with your experience with this bug. I want to ask about how you're using DESTDIR:

Are you giving a value for DESTDIR during make install?

Are you using more than one grade? (how is configure invoked?).

Thanks.
(0000495)
ony   
2013-01-09 04:17   
Configure was invoked as: ./configure --prefix=/usr --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --docdir=/usr/share/doc/mercury-12.08_beta20120813 --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --disable-silent-rules --enable-fast-install --libdir=/usr/lib64 --disable-most-grades

Library grades was intended to be built: asm_fast.gc, asm_fast.gc.debug, asm_fast.gc.decldebug, hlc.gc

After succesful reaching "make -j9". There was invoked: make -j9 -j1 DESTDIR=/var/tmp/paludis/build/dev-lang-mercury-12.08_beta20120813/image/ install

That caused:

/usr/bin/install -c -m 644 libatomic_ops.a '/var/tmp/paludis/build/dev-lang-mercury-12.08_beta20120813/image//var/tmp/paludis/build/dev-lang-mercury-12.08_beta20120813/work/mercury-compiler-12.08-beta-2012-08-13/install_grade_dir.asm_fast.gc.debug/boehm_gc/libatomic_ops-install/lib'

And as result:

cp ./libatomic_ops-install/lib/libatomic_ops.a gc.a
cp: cannot stat './libatomic_ops-install/lib/libatomic_ops.a': No such file or directory
make[3]: *** [gc.a] Error 1
make[3]: Leaving directory `/var/tmp/paludis/build/dev-lang-mercury-12.08_beta20120813/work/mercury-compiler-12.08-beta-2012-08-13/install_grade_dir.asm_fast.gc.debug/boehm_gc'
make[2]: *** [submake] Error 2
make[2]: Leaving directory `/var/tmp/paludis/build/dev-lang-mercury-12.08_beta20120813/work/mercury-compiler-12.08-beta-2012-08-13/install_grade_dir.asm_fast.gc.debug/boehm_gc'
To clean up from failed install, remove /var/tmp/paludis/build/dev-lang-mercury-12.08_beta20120813/work/mercury-compiler-12.08-beta-2012-08-13/install_grade_dir.asm_fast.gc.debug
make[1]: *** [install_grades] Error 1
make[1]: Leaving directory `/var/tmp/paludis/build/dev-lang-mercury-12.08_beta20120813/work/mercury-compiler-12.08-beta-2012-08-13'
make: *** [install] Error 2
(0000500)
wangp   
2013-03-18 15:23   
I applied a patch based on ony's. Thanks.

Issue History
2011-07-11 14:22juliensfNew Issue
2011-07-11 14:24juliensfFile Added: main.log.gz
2011-07-12 02:54jeremyhuNote Added: 0000337
2011-07-28 12:36pboneNote Added: 0000340
2011-07-28 12:36pboneAssigned To => pbone
2011-07-28 12:36pboneReproducibilityhave not tried => always
2011-07-28 12:36pboneStatusnew => assigned
2011-07-28 13:01pboneNote Added: 0000341
2012-07-06 07:22onyFile Added: 0001-Fix-for-bug-203-DESTDIR-brokes-installation.patch
2012-07-06 07:24onyNote Added: 0000472
2012-07-08 11:01pboneNote Added: 0000475
2013-01-09 00:25pboneNote Added: 0000494
2013-01-09 04:17onyNote Added: 0000495
2013-03-18 15:23wangpNote Added: 0000500
2013-03-18 15:23wangpStatusassigned => resolved
2013-03-18 15:23wangpResolutionopen => fixed
2013-03-18 15:23wangpAssigned Topbone => wangp