Bug 77707

Summary: Fix for ports/77403 introduced circular dependency in ports tree
Product: Ports & Packages Reporter: freebsd
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description freebsd 2005-02-19 03:40:17 UTC
The fix for ports/77403, commited on 13th February, introduced a possible circular dependency in the ports tree. The following line was added to the port's Makefile:

USE_GCC= 2.7+

The way this is handled by Mk/bsd.gcc.mk, the port now depends on the earliest version of GCC that is at least 2.7. On my machine, the installed versions of GCC are 3.4 (system) and 3.2 (from ports). Since the earliest version of GCC on this machine is 3.2, the GCC 3.2 port now depends on itself. This is a very bad thing (TM) and, for example, breaks the INDEX build.

Fix: 

USE_GCC= 2.7+ is completely useless as no version of GCC prior to 2.7 is available on FreeBSD anyway - neither in ports nor in the system. The obvious fix is therefore to remove this line from the port's Makefile.
How-To-Repeat: On a machine with the following two versions of GCC installed, run make index with an up-to-date ports tree:

* system GCC > 3.2 (OSVERSION >= 501103)
* GCC 3.2 installed from ports

The GCC 3.2 port will pick up itself as a build dependency.
Comment 1 Mark Linimon 2005-02-19 03:53:59 UTC
On Sat, 19 Feb 2005, Bartosz Fabianowski wrote:

> USE_GCC= 2.7+ is completely useless as no version of GCC prior to 2.7 is
> available on FreeBSD anyway - neither in ports nor in the system. The
> obvious fix is therefore to remove this line from the port's Makefile.

Well AFAIR it's not; I think a recent change to bsd.port.mk requires
USE_GCC to be set to some useful value, where previously the port
internally used USE_GCC for its own purposes.  So we've overloaded
the meaning of the variable.  At least this is what I recall.

But you're correct in that the current situation is broken.  I don't
know enough about the problem to suggest a correct fix.

You might try rebuilding this port without that line in it to prove
that it really will build that way.

mcl
Comment 2 freebsd 2005-02-19 04:12:56 UTC
> So we've overloaded the meaning of the variable.  At least this is
> what I recall.

I see. It doesn't seem to have been announced anywhere big time, so 
missed that information. Sorry.

While lang/gcc32 will build just fine without USE_GCC, the compiler used 
in this case (cc) will complain a lot about GCC extensions being used. 
So that's not a good idea. It seems to me that the following might be a 
proper fix:

bsd.gcc.mk should try to satisfy the USE_GCC with the system compiler 
first and only if that does not match the version requested, it should 
try port versions. This way, USE_GCC= 2.7+ would take on the same 
meaning as the old USE_GCC= X in that it simply requests for system GCC 
to be used. At the same time, things such as USE_GCC= 3.1 would continue 
to work because if the system compiler isn't 3.1, bsd.gcc.mk would keep 
looking for an acceptable GCC.

- Bartosz
Comment 3 freebsd 2005-02-19 04:21:05 UTC
I have to correct myself. The build of lang/gcc32 without USE_GCC set 
just died. So that's not an option.
Comment 4 Sergey Matveychuk freebsd_committer freebsd_triage 2005-03-11 18:03:16 UTC
I can't reproduce it:
# uname -a
FreeBSD stable-5.sem-home.ciam.ru 5.3-RELEASE-p4 FreeBSD 5.3-RELEASE-p4 
#13: Fri Jan 14 04:39:21 MSK 2005 
root@stable-5.sem-home.ciam.ru:/usr/obj/usr/src/sys/CURRENT  i386
# pkg_info|grep gcc
gcc-3.2.3_3         GNU Compiler Collection 3.2.3
# cd /usr/ports/lang/gcc32
# make pretty-print-build-depends-list
This port requires package(s) "gettext-0.14.1 gmake-3.80_2 
libiconv-1.9.2_1" to build.

-- 
Sem.
Comment 5 freebsd 2005-03-12 20:00:39 UTC
The same sequence of commands on my machine:

# uname -a
FreeBSD takahe.local 5.4-PRERELEASE FreeBSD 5.4-PRERELEASE #0: Thu Mar 10 03:09:38 CET 2005     root@takahe.local:/usr/obj/usr/src/sys/TAKAHE  i386
# pkg_info|grep gcc
gcc-3.2.3_3         GNU Compiler Collection 3.2.3
# cd /usr/ports/lang/gcc32
# make pretty-print-build-depends-list
This port requires package(s) "gcc-3.2.3_3 gettext-0.14.1 gmake-3.80_2 libiconv-1.9.2_1" to build.

Not quite sure what to make of this. While ports/Mk/bsd.gcc.mk is commented, I still cannot fully follow what it is doing. Looking at that file, it seems to me that it will always pick the lowest version of GCC that meets the port's demands. Seems to work differently on your machine though. Very confusing indeed.
Comment 6 Volker Stolz freebsd_committer freebsd_triage 2005-04-11 19:44:17 UTC
State Changed
From-To: open->closed

Fixed by adamw on 2005-03-20. Thanks for your submission!