Re: glib-mkenums in glib 2




On Dec 26, 2012, at 10:18 AM, John Emmas <johne53 tiscali co uk> wrote:

As many of you will know, GTK's MSVC project files have gotten quite a long way out of date now (presumably since Tor's departure, which was a great pity).  I'm trying to bring mine up-to-date so that they'll build from the latest GIT sources.  I'm starting with glib which is currently at version 2.35 I believe.

Along the way I thought I might as well make use of MSVC's ability to launch external programs and scripts which can be run before (and even during) the build process.  My hope was that I'd be able to make a Visual Studio project file that would do everything needed to build glib - including building those files that need to be auto-generated.  Everything seems to have worked fine, except for glib-mkenums.  glib-mkenums is a perl script that needs to get run from time to time to ensure that gio/gioenumtypes.c and gio/gioenumtypes.h are up-to-date.

Taking he header file as an example, it seems as if this command line should work:-

perl glib-mkenums --template <path_to_gioenumtypes.h.template>  >  <path_to_gioenumtypes.h>

Obviously, in the real example, those paths are the actual paths.  However, in fact, it consistently gives me this error output:-

/* Generated data (by glib-mkenums) */

Use of uninitialized value $_[0] in substitution (s///) at E:/Program Files/Perl/lib/File/Basename.pm line 338.
fileparse(): need a valid pathname at glib-mkenums line 259

I'm not sure where Perl is up to these days but I'm running version 5.12.1.  Do I need to update Perl to a newer version or can anyone suggests anything else that might be causing this error?

I'm not hugely familiar with Perl but FWIW, here's how the script looks around line 259 of glib-mkenums:

if (length($fhead)) {
    my $prod = $fhead;
    my $base = basename ($ARGV[0]);   /* <---  THIS IS LINE 259 !! */

    $prod =~ s/\@filename\@/$ARGV[0]/g;
    $prod =~ s/\@basename\@/$base/g;
    $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
    $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
    chomp ($prod);
    print "$prod\n";
}

ARGV should be a hint: It means the same thing in perl as it does in C. It seems that glib-mkenums either isn't getting an @ARGV or it's somehow getting cleared before that line.

It's certainly not a perl version problem.

Try running the command from a cmd shell and see if you get the same error. If it works from the shell, then there's something about the way MSVS is launching perl that's causing the problem.

Regards,
John Ralls
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]