在solaris 10 sparc上将perl编译为64位

时间:2018-04-25 14:00:26

标签: c perl gcc 64-bit solaris

我正在尝试在perl 5.22.2上编译Solaris,sparc,为64位(os为64位)。 它编译并链接为32位二进制文​​件,现在我已将-m64标记添加到CFLAGSLDFLAGS,我收到以下错误:

...skipping...
perlio.c:3400: error: structure has no member named `_ptr'
perlio.c:3408: error: structure has no member named `_ptr'
perlio.c: In function `PerlIOStdio_get_base':
perlio.c:3531: error: structure has no member named `_base'
perlio.c: In function `PerlIOStdio_get_bufsiz':
perlio.c:3538: error: structure has no member named `_cnt'
perlio.c:3538: error: structure has no member named `_ptr'
perlio.c:3538: error: structure has no member named `_base'
perlio.c: In function `PerlIOStdio_get_ptr':
perlio.c:3547: error: structure has no member named `_ptr'
perlio.c: In function `PerlIOStdio_get_cnt':
perlio.c:3554: error: structure has no member named `_cnt'
perlio.c: In function `PerlIOStdio_set_ptrcnt':
perlio.c:3575: error: structure has no member named `_ptr'
perlio.c:3594: error: structure has no member named `_cnt'
make: *** [perlio.o] Error 1

作为参考,我从perlio.c中提取了上述行:

3400:   STDCHAR *eptr = (STDCHAR*)PerlSIO_get_ptr(s);
3408:       if ((STDCHAR*)PerlSIO_get_ptr(s) != --eptr || ((*eptr & 0xFF) != ch)) {
3531:    return (STDCHAR*)PerlSIO_get_base(stdio);
3538:    return PerlSIO_get_bufsiz(stdio);
3547:    return (STDCHAR*)PerlSIO_get_ptr(stdio);
3554:    return PerlSIO_get_cnt(stdio);
3575:   PerlSIO_set_ptr(stdio, ptr); /* LHS STDCHAR* cast non-portable */
3594:    PerlSIO_set_cnt(stdio, cnt);

看起来它对源做了一些奇怪的事情,注意_ptr如何被视为一个单独的实体,而该函数被称为PerlSIO_get_ptr。看起来被切断了。

任何人都知道这里发生了什么?使用perlbrew之类的东西不是一个选项,我需要自己编译:(。

1 个答案:

答案 0 :(得分:2)

事实证明我需要将-Duse64bitall标志添加到Configure脚本中。所以最后我能够用

构建
export CFLAGS=-m64 # not sure if really nessessary - just what I did
./Configure -Duse64bitall -Dcc=gcc -d
make

对于我的设置,我还需要更多的库,所以这是一个相当简化的版本。但是它解决了这篇文章中描述的问题。