Bug 107739 - --enable-languages= duplicates yield odd error
Summary: --enable-languages= duplicates yield odd error
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build, diagnostic
Depends on:
Blocks:
 
Reported: 2022-11-17 20:17 UTC by Bernhard Reutner-Fischer
Modified: 2022-11-22 05:30 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-11-18 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Reutner-Fischer 2022-11-17 20:17:27 UTC
Mere cosmetics, but the error is contradicting it's own hint in a confusing way.

$ ../../src/gcc-13.mine/configure --enable-languages=c++,lto,lto
configure: error: 
The following requested languages could not be built: lto
Supported languages are: c,c,c++,fortran,go,lto,objc,obj-c++

or other dups like
$ ../../src/gcc-13.mine/configure --enable-languages=c++,c++,lto
configure: error: 
The following requested languages could not be built: c++
Supported languages are: c,c,c++,fortran,go,lto,objc,obj-c++

I'm not sure why duplicates are not ignored silently.
Comment 1 Andrew Pinski 2022-11-17 22:30:53 UTC
I thought this was fixed at one point.
Comment 2 Andrew Pinski 2022-11-18 03:31:47 UTC
Confirmed.
[apinski@linux oo]$ ../configure --enable-languages=c++,c++,lto
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for libphobos support... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada and is recent enough... no
checking for gdc... no
checking whether the D compiler works... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
configure: WARNING: using in-tree isl, disabling version check
configure: error:
The following requested languages could not be built: c++
Supported languages are: c,c,c++,fortran,go,lto,objc,obj-c++
Comment 3 Andrew Pinski 2022-11-18 03:45:43 UTC
So there are two issues but I don't know how to solve the second part of the issue.

The first issue is there is a missing g for the flags of the s command of the sed command here:
missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"`

But after doing that it still fails because if you had:
,c++,c++,lto,

It matches ,c++, and replaces it with , but then sed does not reconsiders the , again and does not match c++.

Someone with some better shell scripting knowledge should look into this.
Comment 4 Andreas Schwab 2022-11-18 07:55:24 UTC
missing_languages=`echo "$missing_languages" |
                   sed -e ':loop' -e "s/,$language,/,/" -e 't loop'`