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

configure script unable to check for C compiler #297

Open
ghost opened this issue Feb 23, 2023 · 6 comments
Open

configure script unable to check for C compiler #297

ghost opened this issue Feb 23, 2023 · 6 comments

Comments

@ghost
Copy link

ghost commented Feb 23, 2023

configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

It also fails to check for various utilities like sed,... even though they are all there!

Note: this is after passed --build=x86_64-w64-mingw32 to configure script, otherwise it will not able to detect the platform. See #296

@rmyorston
Copy link
Owner

I think we need more information about you're trying to do before we can help.

@ghost
Copy link
Author

ghost commented Feb 24, 2023

I think we need more information about you're trying to do before we can help.

Try it yourself: http://fox-toolkit.org/ftp/fox-snapshot.zip

@rmyorston
Copy link
Owner

A couple of problems with the configure script:

  • The test for the path separator only works if /bin/sh exists.
  • The tests for executables try adding extensions, but I couldn't find anything that set the variable which is supposed to list possible extensions.

I got configure --build=x86_64-w64-mingw32 to work by setting these environment variables before running it:

export PATH_SEPARATOR=';'
export ac_executable_extensions='.exe'

Running make then got stuck almost immediately.

@ghost
Copy link
Author

ghost commented Feb 25, 2023

Running make then got stuck almost immediately.

Same experience, even though I pass the path to the utilities directly via environment variable like SED="path/to/sed" CC="path/to/gcc" ./configure --build=x86_64-w64-mingw32. The configure script is something generated by autoconf. I have no idea why it's this way.

@rmyorston
Copy link
Owner

The problem with the build getting stuck is due to this function in the libtool script (which is created from ltmain.sh during configuration):

# Convert file name or path ARG from MSYS format to w32 format.  Return
# result in func_convert_core_msys_to_w32_result.
func_convert_core_msys_to_w32 ()
{
  $debug_cmd

  # awkward: cmd appends spaces to result
  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
}

In the Cygwin world /c is considered to be a path referencing C:\ so cmd /c has to be written as cmd //c. In the real world of Windows //c has no special meaning so cmd doesn't know it's supposed to be running a single command and enters interactive mode where it gets stuck.

I've no idea why libtool is using such a convoluted method to get $1 into sed, but since we don't really need to "backslashify" it anyway the function can be reduced to:

func_convert_core_msys_to_w32 ()
{
  $debug_cmd

  func_convert_core_msys_to_w32_result="$1"
}

With that change the build gets much further. I don't know how much further because I stopped it after a while.

The issue has been discussed on the libtool mailing list.

@rmyorston
Copy link
Owner

Actually, the problem in libtool is a consequence of setting the build OS to mingw64. That gets some things right for w64devkit but the filename conversion is wrong because we aren't using MSYS2. Other things may be wrong too.

We can only get so far by hacking GNU Autotools as they currently exist. The ultimate solution is to have proper support for the w64devkit environment in Autotools.

Anyway, here's a script that can be sourced before running configure:

export PATH_SEPARATOR=';'
export ac_executable_extensions='.exe'
export build_alias="$(uname -m)-pc-mingw64"

if [ -f configure ]
then
    echo "Converting configure..."
    sed -i 's/func_convert_file_msys_to_w32/func_convert_file_noop/' configure
fi

I've used this to successfully build Expat with w64devkit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant