help-octave
[Top][All Lists]
Advanced

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

Re: octave 3.6.2 build error: invalid preprocessing directive #!


From: Richard
Subject: Re: octave 3.6.2 build error: invalid preprocessing directive #!
Date: Thu, 16 Aug 2012 21:22:47 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0

On 16/08/2012 17:32, Jordi Gutiérrez Hermoso wrote:
On 16 August 2012 12:06, Richard Crozier <address@hidden> wrote:
On 16/08/2012 16:51, Jordi Gutiérrez Hermoso wrote:
On 16 August 2012 11:35, Richard Crozier<address@hidden>  wrote:
I'm trying to build the octave 3.6.2 sources but compilation has stopped
with the output below. Could anyone suggest a fix?

In file included from oct-rand.cc:27:
/usr/bin/map:1:2: error: invalid preprocessing directive #!
What is this "/usr/bin/map" thing?

Looks like your build is somehow trying to compile an m-file or Perl
file as if it were a C++ source file. How did this happen? How did you
start the build?
well I just downloaded the sources and extracted them to the directory shown
at the bottom of the output, I then ran ./configure and make as normal.

There are some unusual circumstances which may or may not be
related.
I think they are... I think your environment might be very strange.
For some reason, g++ has decided that /usr/bin is a good place to go
looking for header files instead of /usr/include.

Can you please show me the output of the following commands?

     echo '#include <map>' > foo.c++
     cpp foo.c++
     echo $CFLAGS
     echo $CXXFLAGS

- Jordi G. H.


Sorry for the delay, here's the output:


bash-4.1$ echo '#include <map>' > foo.c++
bash-4.1$ cpp foo.c++
# 1 "foo.c++"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "foo.c++"
# 1 "/usr/bin/map" 1 3
In file included from foo.c++:1:
/usr/bin/map:1:2: error: invalid preprocessing directive #!


eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
/usr/bin/map:5:2: error: invalid preprocessing directive #$Id
/usr/bin/map:7:3: error: invalid preprocessing directive #map
/usr/bin/map:9:3: error: invalid preprocessing directive #See
/usr/bin/map:10:6: error: invalid preprocessing directive #http
/usr/bin/map:12:3: error: invalid preprocessing directive #Copyright
/usr/bin/map:13:3: error: invalid preprocessing directive #This
/usr/bin/map:14:3: error: invalid preprocessing directive #modify
/usr/bin/map:16:3: error: invalid preprocessing directive #Contact
    if 0; # not running under some shell
# 19 "/usr/bin/map" 3
my $PROGNAME = "map";
my $VERSION = "1.21";
my $DATE = "2000-Jun-26";

use Getopt::Long;
use Unicode::Map;

my %opt = ();
my $defaultCsId = "ISO-8859-1";

main: {
   $|=1; undef $/;

   GetOptions ( \%opt, "from=s", "help", "list", "to=s" );

   usage() if $opt{"help"};

   my $error = 0;
   if ( $opt{"list"} ) {
      $error = list_csids ( );
   } else {
      if ( !$opt{"to"} && !$opt{"from"} ) {
         usage ( );
      }
      $opt{"from"} ||= $defaultCsId;
      $opt{"to"} ||= $defaultCsId;
      $error = handle_stream ( );
   }

   exit $error;
}

sub handle_stream {
   undef $/;
   my $input = <STDIN>;
   my ( $unicode, $output, $csid );

   $csid = $opt { "from" };
   if ( $csid =~ /^unicode$/i) {
      $unicode = $input;
   } else {
      my $MapFrom = new Unicode::Map ( $csid );
      if ( !$MapFrom ) {
         print "Error! Mapping \"$csid\" not available!\n";
         return 0;
      }
      $unicode = $MapFrom -> to_unicode ( $input );
   }
   undef $input;

   $csid = $opt{"to"};
   if ( $csid =~ /^unicode$/i ) {
      $output = $unicode;
   } else {
      my $MapTo = new Unicode::Map ( $csid );
      if ( !$MapTo ) {
         print "Error! Mapping \"$csid\" not available!\n";
         return 0;
      }
      $output = $MapTo -> from_unicode ( $unicode );
   }
   undef $unicode;

   print STDOUT $output;
1}

sub list_csids {
   return 0 unless my $Map = new Unicode::Map ( );
   my (@alias, $last, $s);
   my $i=1;
   print "Defined character sets:\n";
   for ($Map->ids()) {
      $s = sprintf "%02d: $_", $i++;
      if (@alias = sort {$a cmp $b} $Map->alias($_)) {
         $last = pop(@alias);
         $s .= " (";
         $s .= join(", ", @alias);
         $s .= ", " if $#alias>=0;
         $s .= "$last)";
      }
      print "$s\n";
   }
   print "Done.\n";
1}

sub usage {
   _print_usage (
      "$PROGNAME V$VERSION ($DATE) - recode from and to Unicode\n"
."usage: $PROGNAME {--option [arg]} [--from cset] || [--to cset] file(s)",
      [
        "from s  Encoding of input files (default \"$defaultCsId\")",
        "list    Lists available character sets and their alias names.",
        "to   s  Encoding of output files (default \"$defaultCsId\")",
      ]
   );
   exit 0;
}

sub _print_usage {
   my ($header, $bodylistR, $footer) = @_;
   print "$header\n" if $header;
   print map "   --$_\n", sort { lc($a) cmp lc($b) } @$bodylistR;
   print "$footer\n" if $footer;
}

__END__

=head1 NAME

map - An utility to map texts from and to unicode

=head1 SYNOPSIS

 map - recode from and to various character sets.
       Reads from STDIN, writes to STDOUT.
 usage: map [--from cset] [--to cset] < input.txt > output.txt

 from s Encoding of input files (default "ISO-8859-1")
 list Lists available character sets and their alias names.
 to s Encoding of output files (default "ISO-8859-1")

=head1 DESCRIPTION

Maps text from one character set representation to another. This work is
actually long time very well done by C<recode>, but unfortunately recode
does not support Unicode and eastern asia character sets. But, if you have
pure 8 bit things to do, recode will still be the best solution.

Examples:

Conversion from ISO-8859-1 to Unicode:

 map --to unicode < iso-8859-1.txt > unicode.txt

Conversion from GB2312 to CP936:

 map --from cp936 --to GB2312 < gb2312.txt > cp936.txt

Conversion from CP850 to Unicode:

 map --from cp850 --to unicode < cp850.txt > unicode.txt

=head1 SEE ALSO

recode(1), Unicode::Map(3), Unicode::Map8(3), Unicode::String(3)

=head1 AUTHOR

Martin Schwartz E<lt>F<address@hidden>E<gt>.

=cut
# 1 "foo.c++" 2
bash-4.1$ echo $CFLAGS

bash-4.1$ echo $CXXFLAG

bash-4.1$


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]