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

perl 5.12.2 cross-compile fail @ "xconfig.h : error: invalid preprocessing directive ..." #10651

Open
p5pRT opened this issue Sep 21, 2010 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 21, 2010

Migrated from rt.perl.org#77972 (status was 'open')

Searchable as RT77972$

@p5pRT
Copy link
Author

p5pRT commented Sep 21, 2010

From pgngw+dev001+perl5-porters@f-m.fm

hi,

i'm working on a port & cross-compiled build (for openwrt backfire
10.03/atheros AR71xx, on openSUSE 11.3/x86_64) of perl 5.12.2, digging
through issues/bugs one at a time.

i've started with the existing package for perl 5.10.x from the repo.

i'm stuck at a fail of "build target miniperl binary" in
'config_h_.SH'-generated 'xconfig.h'.

some, not all, of the generated #defines seem wrong; not yet clear why.

all i can say, atm, is that the following just gets me as far as I get
-- i can't yet say, whether i've an OK build process; here's what i've
done so far​:

svn co svn​://svn.openwrt.org/openwrt/branches/backfire openwrt_backfire
cd openwrt_backfire
make menuconfig

  Target System (Atheros AR71xx/AR7240/AR913x) --->
  Target Profile (Buffalo WZR-HP-G300NH) --->
  ...
  [*] Build the OpenWrt SDK
  ...
make -j8 V=99

./scripts/feeds update
cp -a feeds/packages/lang/perl package/perl512
./scripts/feeds install -p packages libdb47 libxml2 libgdbm

### MAKE PATCH FAILURE​: " ... read-only; refusing to patch"
# https://forum.openwrt.org/viewtopic.php?pid=115258

vi scripts/patch-kernel.sh
  ...
  - ${uncomp} ${i} | patch -p1 -E -d ${targetdir}
  + ${uncomp} ${i} | patch -f -p1 -E -d ${targetdir}
  ...

make menuconfig
make -j8 package/libxml2/{clean,compile,install} V=99
make -j8 package/db47/{clean,compile,install} V=99
make -j8 package/gdbm/{clean,compile,install} V=99

# [FIXED] BUG​: https://bugzilla.novell.com/show_bug.cgi?id=640700
vi /usr/include/dbm.h
  ...
  -extern int dbmclose __P((DBM *));
  +extern int dbmclose __P((void));

rm package/perl512/patches/*
make -j8 package/perl512/{clean,compile} V=99

## FAIL

...
===> Stage 3​: Configure target perl

...
Fetching answers from config.sh...

Doing variable substitutions on .SH files...
Extracting config.h (with variable substitutions)
Extracting cflags (with variable substitutions)
Not re-extracting config.h
Extracting makeaperl (with variable substitutions)
Extracting makedepend (with variable substitutions)
Extracting Makefile (with variable substitutions)
Extracting myconfig (with variable substitutions)
Extracting pod/Makefile (with variable substitutions)
Extracting Policy.sh (with variable substitutions)
Extracting runtests (with variable substitutions)
Extracting utils/Makefile (with variable substitutions)
Extracting writemain (with variable substitutions)
Extracting x2p/cflags (with variable substitutions)
Extracting x2p/Makefile (with variable substitutions)
Extraction done.
touch
/build/openwrt_backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/perl/perl-5.12.2/.configured_-perl

===> Stage 4​: Build target miniperl binary

install -m 0644
/build/openwrt_backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/perl/perl-5.12.2/config.h
/build/openwrt_backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/perl/perl-5.12.2/xconfig.h
rm -f
/build/openwrt_backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/perl/perl-5.12.2/miniperl
make -C
/build/openwrt_backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/perl/perl-5.12.2
miniperl
make[3]​: Entering directory
`/build/openwrt_backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/perl/perl-5.12.2'
`sh cflags "optimize='-O2'" miniperlmain.o` miniperlmain.c
  CCCMD = mips-openwrt-linux-uclibc-gcc -DPERL_CORE -c -Os
  -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time
  -fhonour-copts -msoft-float -DUSE_CROSS_COMPILE
  -I/build/openwrt_backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/include
  -I/build/openwrt_backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/include
  -I/build/openwrt_backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include
  -I/build/openwrt_backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/include
  -O2 -Wall
In file included from perl.h​:40,
  from miniperlmain.c​:40​:
xconfig.h​:774​:3​: error​: invalid preprocessing directive #I_SYS_POLL
xconfig.h​:879​:3​: error​: invalid preprocessing directive #CAN_VAPROTO
xconfig.h​:1084​:3​: error​: invalid preprocessing directive
#HASATTRIBUTE_DEPRECATED
xconfig.h​:2415​:3​: error​: invalid preprocessing directive #I_GDBMNDBM
xconfig.h​:2416​:3​: error​: invalid preprocessing directive #I_GDBM_NDBM
xconfig.h​:2417​:3​: error​: invalid preprocessing directive
#NDBM_H_USES_PROTOTYPES
xconfig.h​:2418​:3​: error​: invalid preprocessing directive
#GDBMNDBM_H_USES_PROTOTYPES
xconfig.h​:2419​:3​: error​: invalid preprocessing directive
#GDBM_NDBM_H_USES_PROTOTYPES
xconfig.h​:3304​:3​: error​: invalid preprocessing directive #PERL_USE_DEVEL
xconfig.h​:3576​:3​: error​: invalid preprocessing directive
#HAS_GETADDRINFO
xconfig.h​:3618​:3​: error​: invalid preprocessing directive
#HAS_GETNAMEINFO
xconfig.h​:3648​:3​: error​: invalid preprocessing directive #HAS_INETNTOP
xconfig.h​:3654​:3​: error​: invalid preprocessing directive #HAS_INETPTON
xconfig.h​:4048​:3​: error​: invalid preprocessing directive #HAS_CTIME64
xconfig.h​:4049​:3​: error​: invalid preprocessing directive
#HAS_LOCALTIME64
xconfig.h​:4050​:3​: error​: invalid preprocessing directive #HAS_GMTIME64
xconfig.h​:4051​:3​: error​: invalid preprocessing directive #HAS_MKTIME64
xconfig.h​:4052​:3​: error​: invalid preprocessing directive #HAS_DIFFTIME64
xconfig.h​:4053​:3​: error​: invalid preprocessing directive #HAS_ASCTIME64
xconfig.h​:4059​:3​: error​: invalid preprocessing directive #HAS_TIMEGM
xconfig.h​:4132​:3​: error​: invalid preprocessing directive #I_ASSERT
xconfig.h​:4210​:3​: error​: invalid preprocessing directive #I_MALLOCMALLOC
xconfig.h​:4587​:3​: error​: invalid preprocessing directive #USE_DTRACE
make[3]​: *** [miniperlmain.o] Error 1
make[3]​: Leaving directory
`/build/openwrt_backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/perl/perl-5.12.2'
make[2]​: ***
[/build/openwrt_backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/perl/perl-5.12.2/.built-perl]
Error 2
make[2]​: Leaving directory `/build/openwrt_backfire/package/perl512'
make[1]​: *** [package/perl512/compile] Error 2
make[1]​: Leaving directory `/build/openwrt_backfire'
make​: *** [package/perl512/compile] Error 2

i've posted the generated 'xconfig.h' @​ http​://pastebin.com/8iv6Sbtz

note that @​ each of the id'd error line_nos, the #define looks wrong.
e.g., @​ 774,

  ...
  #
  #define I_SYS_PARAM /**/
  #

  #
  /* I_SYS_POLL​:
  #
  * This symbol, if defined, indicates that the program may
  include
  #
  * <sys/poll.h>. When I_POLL is also defined, it's probably
  safest
  #
  * to only include <poll.h>.
  #
  */
  #
774 # I_SYS_POLL /**/
  #

  #
  /* I_SYS_RESOURCE​:
  #
  * This symbol, if defined, indicates to the C program that
  it should
  #
  * include <sys/resource.h>.
  #
  */
  #
  #define I_SYS_RESOURCE /**/
  ...

looking at other instances in the file, I suspect (?) it should be
either,

  774 #define I_SYS_POLL /**/

or

  774 /*#define I_SYS_POLL / **/

not

  774 # I_SYS_POLL /**/

fwiw, the install of exiting 5.10.x packages from the repo ends up with
a broken install.

otoh, a cross-compile build of perl 5.10.x from the repos works well.
.../ipkgs-install/ dirs & files scp'd from the build host to the openwrt
target work fine.

5.12.2 clearly has some differences ...

any help is appreciated.

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2010

From @obra

On Tue 21.Sep'10 at 12​:27​:00 -0700, pgngw+dev001+perl5-porters@​f-m.fm wrote​:

# New Ticket Created by pgngw+dev001+perl5-porters@​f-m.fm
# Please include the string​: [perl #77972]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=77972 >

hi,

i'm working on a port & cross-compiled build (for openwrt backfire
10.03/atheros AR71xx, on openSUSE 11.3/x86_64) of perl 5.12.2, digging
through issues/bugs one at a time.

i've started with the existing package for perl 5.10.x from the repo.

i'm stuck at a fail of "build target miniperl binary" in
'config_h_.SH'-generated 'xconfig.h'.

some, not all, of the generated #defines seem wrong; not yet clear why.

all i can say, atm, is that the following just gets me as far as I get
-- i can't yet say, whether i've an OK build process; here's what i've
done so far​:

Thanks very much for the writeup so far. To the best of my knowledge,
our cross-compile process is currently unworkably bitrotten. I don't
know anyone else (with a possible single exception) who's cross-built
Perl in recent memory.

I would love to be proven wrong / have my statements become outdated.

-jesse

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2010

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2010

From dev001p5p@f-m.fm

hi,

( this reply _may_ come out of order; as perl.org's ezmlm is,
apparently, incapable of subscribing my usual email -- with "+" & "-" in
it -- i've changed for this list. )

i'm working on a port & cross-compiled build (for openwrt backfire
10.03/atheros AR71xx, on openSUSE 11.3/x86_64) of perl 5.12.2, digging
through issues/bugs one at a time.

i've started with the existing package for perl 5.10.x from the repo.

i'm stuck at a fail of "build target miniperl binary" in
'config_h_.SH'-generated 'xconfig.h'.

some, not all, of the generated #defines seem wrong; not yet clear why.

all i can say, atm, is that the following just gets me as far as I get
-- i can't yet say, whether i've an OK build process; here's what i've
done so far​:

Thanks very much for the writeup so far. To the best of my knowledge,
our cross-compile process is currently unworkably bitrotten. I don't
know anyone else (with a possible single exception) who's cross-built
Perl in recent memory.

I would love to be proven wrong / have my statements become outdated.

-jesse

just a little context --

for the vast majority of native-environment cases, this is, of course,
not a problem.

for perl-on-embedded devices, e.g. all the off-the-shelf
converted-to-openwrt routers (linksys, buffalo, etc etc), that use perl,
building ON the devices is, atm, a non-starter, as build toolchains are
not readily, if at all, available. x-compile is, basically, the only
option.

the problem manifests itself, e.g.​: on openwrt, it currently ships with
an old perl 5.10.x which ships with an old CPANPLUS that's missing the
Internal​::Sqlite capability (for these low-RAM boxes, Internal​::Memory
can be ... a challenge). self-updating ON the box -- with low RAM &
without a gcc/toolchain -- is darn near impossible.

the ideal solution is to get newer perl , e.g. 5.12.2, built in the
x-compile env and do the work there.

i hear your "currently unworkably bitrotten", though, & hope there's
some potential for progress here ...

@PoliteFox
Copy link

Any progress since year 2010? I am asking because I am trying to crosscompile it in gentoo, and receive the error:

make[1]: Entering directory '/usr/aarch64-baikal-linux-gnu/tmp/portage/dev-lang/perl-5.32.0-r1/work/perl-5.32.0'
x86_64-pc-linux-gnu-gcc -DPERL_CORE -DUSE_CROSS_COMPILE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fwrapv -fno-strict-aliasing -c -o miniperlmain.host.o miniperlmain.c
In file included from perl.h:31,
                 from miniperlmain.c:57:
xconfig.h:1279:3: error: invalid preprocessing directive #GENTOO_LIBDIRS
 1279 | # GENTOO_LIBDIRS ""  /**/
      |   ^~~~~~~~~~~~~~
make[1]: *** [Makefile:108: miniperlmain.host.o] Error 1
make[1]: Leaving directory '/usr/aarch64-baikal-linux-gnu/tmp/portage/dev-lang/perl-5.32.0-r1/work/perl-5.32.0'
make: *** [Makefile:79: all] Error 2
 * ERROR: dev-lang/perl-5.32.0-r1::gentoo failed (compile phase):

@jkeenan
Copy link
Contributor

jkeenan commented Jan 31, 2021

Any progress since year 2010? I am asking because I am trying to crosscompile it in gentoo, and receive the error:

make[1]: Entering directory '/usr/aarch64-baikal-linux-gnu/tmp/portage/dev-lang/perl-5.32.0-r1/work/perl-5.32.0'
x86_64-pc-linux-gnu-gcc -DPERL_CORE -DUSE_CROSS_COMPILE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fwrapv -fno-strict-aliasing -c -o miniperlmain.host.o miniperlmain.c
In file included from perl.h:31,
                 from miniperlmain.c:57:
xconfig.h:1279:3: error: invalid preprocessing directive #GENTOO_LIBDIRS
 1279 | # GENTOO_LIBDIRS ""  /**/
      |   ^~~~~~~~~~~~~~
make[1]: *** [Makefile:108: miniperlmain.host.o] Error 1
make[1]: Leaving directory '/usr/aarch64-baikal-linux-gnu/tmp/portage/dev-lang/perl-5.32.0-r1/work/perl-5.32.0'
make: *** [Makefile:79: all] Error 2
 * ERROR: dev-lang/perl-5.32.0-r1::gentoo failed (compile phase):

It's likely that the overwhelming majority of readers of this list, myself included, have never cross-compiled perl. I read in INSTALL:

bout the cross-compilation support of Configure: There's two forms.
The more common one requires some way of transferring and running
executables in the target system, such as an ssh connection; this is the
C<./Configure -Dusecrosscompile -Dtargethost=...> route.  The second
method doesn't need access to the target system, but requires you to
provide a config.sh, and a canned Makefile; the rest of this section
describes the former.

Which of these two approaches have you been attempting?

Thank you very much.
Jim Keenan

@tormath1
Copy link

Hi, I came across this issue too:

In file included from perl.h:31,
                 from miniperlmain.c:57:
xconfig.h:1279:3: error: invalid preprocessing directive #GENTOO_LIBDIRS
 1279 | # GENTOO_LIBDIRS ""  /**/
      |   ^~~~~~~~~~~~~~
make[1]: *** [Makefile:108: miniperlmain.host.o] Error 1
make[1]: Leaving directory '/build/amd64-usr/var/tmp/portage/dev-lang/perl-5.32.1/work/perl-5.32.1'
make: *** [Makefile:79: all] Error 2

This

# GENTOO_LIBDIRS ""  /**/

should actually be

# define GENTOO_LIBDIRS ""  /**/

so it seems that there is an issue in the rendering of the xconfig.h from this patch: https://github.com/gentoo-perl/perl-patchset/blob/perl-5.32/patches/0030-Add-support-for-Dgentoolibdirs.patch

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

No branches or pull requests

5 participants