Bug 155568

Summary: bsd.gcc.mk: Fixing dependency not to pick ccache stubs
Product: Ports & Packages Reporter: Akinori MUSHA <knu>
Component: Individual Port(s)Assignee: Gerald Pfeifer <gerald>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Akinori MUSHA freebsd_committer freebsd_triage 2011-03-15 09:40:09 UTC
If you have devel/ccache installed and ${LOCALBASE}/libexec/ccache in your path to benefit from it, dependency check is faked by the symlinks to ccache in the directory and ports that depend on a specific gcc version fail to build.

This is caused by bsd.gcc.mk not specifying the full path of a gcc binary in BUILD_DEPENDS/RUN_DEPENDS .

Fix: Apply the attached patch.

Patch attached with submission follows:
How-To-Repeat: Install devel/ccache and have /usr/local/libexec/ccache in your path, deinstall lang/gcc45 if it is installed, and try building math/blas for example.
It fails with a message saying gfortran45 is not found, while the port tells USE_FORTRAN=yes which should add lang/gcc45 as dependency.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-03-15 09:40:20 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gerald

bsd.gcc.mk is gerald territory (via the GNATS Auto Assign Tool)
Comment 2 Gerald Pfeifer freebsd_committer freebsd_triage 2011-03-27 22:18:04 UTC
Responsible Changed
From-To: gerald->ehaupt

Thanks for the fine analysis and the patch.  I thought about this thrice 
now, and something has been making me feel uneasy about the suggested 
change which I finally managed to nail down now. 

Basically my concern is that we "lie" to the system and the patch only 
works around that.  Rather than going this direction, and breaking 
cases where someone has installed a version of GCC (or CLang) in some 
different location, but with the right name, can we tighten up ccache? 

What I have in mind is this: 

1. During installation, ccache only creates those links for executables 
it actually finds on the system.  

2. It does so via a script that the user can manually invoke at any 
time in case she makes changes to the system. 

For extra bonus points: 

3. This script, if present, is also called by the post-install and 
post-deinstall targets of the lang/gcc* ports.
Comment 3 Emanuel Haupt freebsd_committer freebsd_triage 2011-03-28 10:07:25 UTC
Gerald, I like the idea. I'll follow up a patch for ccache within a few
hours.
Comment 4 Emanuel Haupt freebsd_committer freebsd_triage 2011-03-28 15:02:46 UTC
The following patch implements the idea gerald suggested:

http://people.freebsd.org/~ehaupt/misc/ccache.diff

The script 'ccache-update-links' is executed when the port is
installed. If a user installs an additional compiler after the
installation of ccache he can simply run the script manually.

Another possibilty would be a hook in ports/Mk/bsd.gcc.mk that will run
the script if ccache is installed.

Feedback would be gratefully apreciated.

Emanuel
Comment 5 gerald 2011-03-29 02:21:36 UTC
On Mon, 28 Mar 2011, Emanuel Haupt wrote:
> The following patch implements the idea gerald suggested:
> 
> http://people.freebsd.org/~ehaupt/misc/ccache.diff

Nice!  I love it.

> Feedback would be gratefully apreciated.

In the messages I think "Creating" and "Removing" are more customary
for a script to describe its ongoing actions.

Perhaps the -h option of the script could print a line or two of
what it's doing?

Is this really sbin material, or just bin?  I'll readily admit I
wouldn't know.

Do you want to consult $LOCALBASE in addition to $PREFIX (and the
hardcoded /usr/bin)?  

Right now it seems the link is always created to $PREFIX/bin, even
if the desired executable may have been found under /usr/bin, or am
I reading this incorrectly?

And I will confess that I don't really understand that world thingie. :-)


Thanks for jumping on this so readily (and quickly, even)!

Gerald
Comment 6 Emanuel Haupt freebsd_committer freebsd_triage 2011-03-29 13:36:39 UTC
> In the messages I think "Creating" and "Removing" are more customary
> for a script to describe its ongoing actions.

Corrected.
 
> Perhaps the -h option of the script could print a line or two of
> what it's doing?

Also corrected.

> Is this really sbin material, or just bin? I'll readily admit I
> wouldn't know.

Good point. I moved it to bin.

> Do you want to consult $LOCALBASE in addition to $PREFIX (and the
> hardcoded /usr/bin)?

I don't know, all the ports compiler seem to get installed to $PREFIX
the hardcoded /usb/bin is for the base compiler.

> Right now it seems the link is always created to $PREFIX/bin, even
> if the desired executable may have been found under /usr/bin, or am
> I reading this incorrectly?

The links always point to 'ccache':

# ls -laR /usr/local/libexec/ccache
total 6
drwxr-xr-x  3 root  wheel  512 Mar 29 14:27 .
drwxr-xr-x  5 root  wheel  512 Mar 29 14:27 ..
lrwxr-xr-x  1 root  wheel   21 Mar 29 14:27 c++ -> /usr/local/bin/ccache
lrwxr-xr-x  1 root  wheel   21 Mar 29 14:27 cc -> /usr/local/bin/ccache
lrwxr-xr-x  1 root  wheel   21 Mar 29 14:27 g++ -> /usr/local/bin/ccache
lrwxr-xr-x  1 root  wheel   21 Mar 29 14:27 g++34 -> /usr/local/bin/ccache
lrwxr-xr-x  1 root  wheel   21 Mar 29 14:27 gcc -> /usr/local/bin/ccache
lrwxr-xr-x  1 root  wheel   21 Mar 29 14:27 gcc34 -> /usr/local/bin/ccache
drwxr-xr-x  2 root  wheel  512 Mar 29 14:27 world

/usr/local/libexec/ccache/world:
total 6
drwxr-xr-x  2 root  wheel  512 Mar 29 14:27 .
drwxr-xr-x  3 root  wheel  512 Mar 29 14:27 ..
lrwxr-xr-x  1 root  wheel    6 Mar 29 14:27 c++ -> ccache
lrwxr-xr-x  1 root  wheel    6 Mar 29 14:27 cc -> ccache
-r-xr-xr-x  1 root  wheel  257 Mar 29 14:27 ccache
lrwxr-xr-x  1 root  wheel    6 Mar 29 14:27 g++ -> ccache
lrwxr-xr-x  1 root  wheel    6 Mar 29 14:27 g++34 -> ccache
lrwxr-xr-x  1 root  wheel    6 Mar 29 14:27 gcc -> ccache
lrwxr-xr-x  1 root  wheel    6 Mar 29 14:27 gcc34 -> ccache

> And I will confess that I don't really understand that world
> thingie. :-)

The whole 'world' thingie was introduced with:
http://www.freebsd.org/cgi/query-pr.cgi?pr=155008

Discussion on ports:
http://www.mail-archive.com/freebsd-ports@freebsd.org/msg31095.html

For now I'll commit the patch. Thanks for the ideas and the feedback.

Emanuel
Comment 7 dfilter service freebsd_committer freebsd_triage 2011-03-29 15:15:38 UTC
ehaupt      2011-03-29 14:15:03 UTC

  FreeBSD ports repository

  Modified files:
    devel/ccache         Makefile 
    devel/ccache/files   ccache-howto-freebsd.txt.in 
                         pkg-message.in 
  Added files:
    devel/ccache/files   ccache-update-links.sh.in 
  Log:
  Only create symlinks for existing compiler. This functionality is outsourced
  into a script which can be run manually after installing or deinstalling
  additional compiler.
  
  PR:             155568 (based on)
  
  Revision  Changes    Path
  1.60      +16 -44    ports/devel/ccache/Makefile
  1.15      +3 -5      ports/devel/ccache/files/ccache-howto-freebsd.txt.in
  1.1       +56 -0     ports/devel/ccache/files/ccache-update-links.sh.in (new)
  1.5       +1 -1      ports/devel/ccache/files/pkg-message.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 8 Emanuel Haupt freebsd_committer freebsd_triage 2011-03-29 15:29:48 UTC
Responsible Changed
From-To: ehaupt->gerald

Back to gerald, feel free to implement additional Mk hooks.
Comment 9 dfilter service freebsd_committer freebsd_triage 2011-09-10 14:37:02 UTC
gerald      2011-09-10 13:36:48 UTC

  FreeBSD ports repository

  Modified files:
    lang/gcc46           pkg-plist 
  Log:
  Also update ccache links (when appropriate) in case of package
  installation and deinstallation.
  
  My code for handling the port installation case sneaked in via
  the previous commit.
  
  PR:             155568
  Submitted by:   ehaupt
  
  Revision  Changes    Path
  1.114     +3 -1      ports/lang/gcc46/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 10 Gerald Pfeifer freebsd_committer freebsd_triage 2011-09-10 14:37:07 UTC
State Changed
From-To: open->closed

Last piece to address this applied to lang/gcc46 in addition to 
earlier adjustments to ccache.  lang/gcc47 shall follow, the other 
lang/gcc ports are in the process of being more and more deemphasized.
Comment 11 dfilter service freebsd_committer freebsd_triage 2011-09-10 21:03:54 UTC
gerald      2011-09-10 20:03:45 UTC

  FreeBSD ports repository

  Modified files:
    lang/gcc47           Makefile distinfo pkg-plist 
  Log:
  Update to the 20110903 snapshot of GCC 4.7.
  
  On the way update ccache links (when appropriate) when installing
  and deinstalling this port/package. [1]
  
  PR:             155568 [1]
  Submitted by:   ehaupt [1]
  
  Revision  Changes    Path
  1.503     +4 -1      ports/lang/gcc47/Makefile
  1.368     +2 -2      ports/lang/gcc47/distinfo
  1.115     +3 -1      ports/lang/gcc47/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"