Bug #50837 mysql_config.pl returns incorrect cflags
Description:
"mysql_config.pl --include" reports the wrong include path.
How to repeat:
Download mysql-noinstall-5.1.43-win32.zip and extract it into C:\
Run /c/mysql-5.1.43-win32/scripts/mysql_config.pl --include
It returns "/c/mysql-5.1.43-win32/include/mysql"
The correct path is "/c/mysql-5.1.43-win32/include"
Suggested fix:
This is line 165 of mysql_config.pl:
my $pkgincludedir = fix_path('', "include/mysql", "include");
fix_path() will return the first directory it finds, e.g. if $basedir is "/foo", it will look for "/foo/include/mysql" first, then "/foo/include", and if neither exists, it will return "" (the first argument) instead.
The headers are actually in /foo/include, but /foo/include/mysql exists (it contains only a single header, plugin.h) so fix_path returns that instead of /foo/include.
One possible fix is to have fix_path search for a specific file, e.g.
sub fix_path
{
my $default = shift;
my $file = shift;
my @dirs = @_;
foreach my $dirname ( @dirs )
{
my $path = "$basedir/$dirname";
if ( -f "$path/$file" )
{
return $path;
}
}
return $default;
}
then modify the calls accordingly:
my $pkglibdir = fix_path('', "libmysql.dll", "libmysql/relwithdebinfo",
"libmysql/release","libmysql/debug","lib/mysql","lib");
my $pkgincludedir = fix_path('', "mysql.h", "include/mysql", "include");
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: "mysql_config.pl --include" reports the wrong include path. How to repeat: Download mysql-noinstall-5.1.43-win32.zip and extract it into C:\ Run /c/mysql-5.1.43-win32/scripts/mysql_config.pl --include It returns "/c/mysql-5.1.43-win32/include/mysql" The correct path is "/c/mysql-5.1.43-win32/include" Suggested fix: This is line 165 of mysql_config.pl: my $pkgincludedir = fix_path('', "include/mysql", "include"); fix_path() will return the first directory it finds, e.g. if $basedir is "/foo", it will look for "/foo/include/mysql" first, then "/foo/include", and if neither exists, it will return "" (the first argument) instead. The headers are actually in /foo/include, but /foo/include/mysql exists (it contains only a single header, plugin.h) so fix_path returns that instead of /foo/include. One possible fix is to have fix_path search for a specific file, e.g. sub fix_path { my $default = shift; my $file = shift; my @dirs = @_; foreach my $dirname ( @dirs ) { my $path = "$basedir/$dirname"; if ( -f "$path/$file" ) { return $path; } } return $default; } then modify the calls accordingly: my $pkglibdir = fix_path('', "libmysql.dll", "libmysql/relwithdebinfo", "libmysql/release","libmysql/debug","lib/mysql","lib"); my $pkgincludedir = fix_path('', "mysql.h", "include/mysql", "include");