Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.20.1.19 configure fails if enable-cxx but no C++ compiler found #14195

Closed
mikaelj opened this issue Apr 24, 2019 · 11 comments · Fixed by #14461
Labels

Comments

@mikaelj
Copy link

@mikaelj mikaelj commented Apr 24, 2019

Steps to Reproduce

./configure --enable-cxx

Current Behavior

No C++ available => CXX command = "no", and subsequent test for size_t fails.

checking if size_t is unsigned long... no
checking if size_t is unsigned int... no
checking if size_t is unsigned __int64... no
checking if size_t is unsigned long long... no
./configure: line 421: test: int: integer expression expected
configure: error: Unable to determine size_t among unsigned long
./configure: line 310: return: int: numeric argument required
./configure: line 320: exit: int: numeric argument required

Expected Behavior

./configure should either fail early when an invalid C++ compiler was found (i.e. "no" - which in itself is a bug?), or tolerate that a C++ compiler doesn't exist and ignore enable-cxx.

On which platforms did you notice this

[ ] macOS
[x] Linux
[ ] Windows

Version Used:

5.20.1.19

@jaykrell

This comment has been minimized.

Copy link
Collaborator

@jaykrell jaykrell commented Apr 24, 2019

What happens in this section? Yeah I could try it myself.

AC_CHECK_TOOL(CC, gcc, gcc)
AC_PROG_CC
AC_CHECK_TOOL(CXX, g++, g++)
AC_PROG_CXX
@mikaelj

This comment has been minimized.

Copy link
Author

@mikaelj mikaelj commented Apr 24, 2019

configure:5777: checking for i686-buildroot-linux-gnu-g++
configure:5804: result: no
configure:5978: checking for C++ compiler version
configure:5987: no --version >&5
./configure: line 5989: no: command not found
configure:5998: $? = 127
configure:5987: no -v >&5
./configure: line 5989: no: command not found
configure:5998: $? = 127
configure:5987: no -V >&5
./configure: line 5989: no: command not found
configure:5998: $? = 127
configure:5987: no -qversion >&5
./configure: line 5989: no: command not found
configure:5998: $? = 127
configure:6002: checking whether we are using the GNU C++ compiler
configure:6021: no -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os   -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP conftest.cpp >&5
./configure: line 2095: no: command not found
configure:6021: $? = 127
@marek-safar

This comment has been minimized.

Copy link
Member

@marek-safar marek-safar commented Apr 30, 2019

This is nice to have, we could add explicit check for c++ compiler

@angeloc

This comment has been minimized.

Copy link
Contributor

@angeloc angeloc commented May 8, 2019

@marek-safar : I'm intrested in solving this problem, any advice?

@marek-safar

This comment has been minimized.

Copy link
Member

@marek-safar marek-safar commented May 10, 2019

One way of doing that is to add additional check in configure.ac (e.g. include AC_LANG([C++]))

@ffontaine

This comment has been minimized.

Copy link

@ffontaine ffontaine commented May 12, 2019

From my understanding, since version 5.16.0.179 and d8af775, mono
requires the availability of a working C++ compiler to get the exact type of size_t. So, in the context of buildroot, I think the only available option is to add this new C++ dependency to the mono package.

@mikaelj

This comment has been minimized.

Copy link
Author

@mikaelj mikaelj commented May 12, 2019

From my understanding, since version 5.16.0.179 and d8af775, mono
requires the availability of a working C++ compiler to get the exact type of size_t. So, in the context of buildroot, I think the only available option is to add this new C++ dependency to the mono package.

But the configure script's C++ compiler detection is broken. That's the problem. It detects "no", so it should do some sanity checking to verify that it is indeed a correct C++ compiler. Or at least a command. Refer to the output in the post above.

@ffontaine

This comment has been minimized.

Copy link

@ffontaine ffontaine commented May 12, 2019

Indeed, the build system could be enhanced to bail out if no working C++ compiler is found.

To fix this error, those lines should be updated:

# AC_PROG_CXX helpfully sets CXX to g++ even if no c++ compiler is found so check
# GXX instead. See http://lists.gnu.org/archive/html/bug-autoconf/2002-04/msg00056.html
if test "x$CXX" = "xg++"; then
	if test "x$GXX" != "xyes"; then
		# automake/libtool is so broken, it requires g++ even if the c++ sources
		# are inside automake conditionals
		AC_MSG_ERROR([You need to install g++])
	fi
fi

GXX seems pretty old and not used anymore (at least, it's not set in http://autobuild.buildroot.org/results/ee6/ee6d037154127cc6572f06e9a78bae383ea381bc//mono-5.20.1.27/config.log). Moreover, CXX is correctly set to "no" if no C++ compiler is found so I'll send a PR to fix this error in a few minutes. Tell me if it works for you.

@angeloc

This comment has been minimized.

Copy link
Contributor

@angeloc angeloc commented May 12, 2019

@ffontaine : anyway, the configure switch --enable-cxx is used to enable or disable c++ compiled code, so I don't think the buildroot package should depend mandatory on c++ support, probably is more correct to use --enable-cxx only when c++ is available.

@ffontaine

This comment has been minimized.

Copy link

@ffontaine ffontaine commented May 12, 2019

@angeloc since d8af775, C++ is mandatory as C++ is intentionally used through AC_LANG_PUSH(C++) to retrieve the exact type of size_t, here is an extract of this commit:


# Get the exact type of size_t, not just its size.
# This is so we can find an exact printf format among u, lu, llu, I64u.
# To avoid warnings about slight mismatches.
# C99 runtime "zu" dependency is being avoided here.
#
# We have to compile as C++ because C is too lenient
# and lets the wrong thing compile, with warnings.
#
# Note: "zu" or ifdef <something> have the advantage
# of producing installable "biarch" headers. i.e. one Mac header
# for Mac/x86 and Mac/amd64.

AC_LANG_PUSH(C++)

Without C++ support, AC_LANG_PUSH(C++) will use CXX which is set to "no". We can avoid the build failure by returning an error if no C++ compiler is found but this is a upstream decision to use C++ in their build system. --enable-cxx won't help us as this will just enable/disable the building of mono C++ code (and it is disabled by default).

angeloc added a commit to angeloc/mono that referenced this issue May 12, 2019
Since commit d8af775, c++ compiler is required to compile.
This patch checks if the c++ compiler is available as soon as possible
and returns an error in case it is not found.

Fixes: mono#14195

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
akoeplinger added a commit that referenced this issue May 12, 2019
Since commit d8af775, c++ compiler is required to compile.
This patch checks if the c++ compiler is available as soon as possible
and returns an error in case it is not found.

Fixes: #14195

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
@jaykrell

This comment has been minimized.

Copy link
Collaborator

@jaykrell jaykrell commented May 13, 2019

There might be a way to remove the C++ compiler requirement, such as by using function pointers instead of integer pointers. I'll try to get around to trying it.

baulig added a commit to baulig/mono that referenced this issue May 15, 2019
Since commit d8af775, c++ compiler is required to compile.
This patch checks if the c++ compiler is available as soon as possible
and returns an error in case it is not found.

Fixes: mono#14195

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.