LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   AIX (https://www.linuxquestions.org/questions/aix-43/)
-   -   PHP-5.6.4 compilation: how to define struct flock (https://www.linuxquestions.org/questions/aix-43/php-5-6-4-compilation-how-to-define-struct-flock-4175530509/)

NevemTeve 01-09-2015 04:36 AM

PHP-5.6.4 compilation: how to define struct flock
 
Tried to compile PHP-5.6.4, but got error message:
Code:

checking "whether flock struct is linux ordered"... "no"
checking "whether flock struct is BSD ordered"... "no"
configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no

in linux, 'struct flock' comes from fcntl.h, it's something like this (with large-file-support):
Code:

struct flock
  {
    short int l_type;
    short int l_whence;
    __off64_t l_start;
    __off64_t l_len;
    __pid_t l_pid;
  };

In AIX, 'struct flock' lives in flock.h, it's something like this:
Code:

struct flock {
 short l_type;
 short l_whence;
 unsigned int l_sysid;
 pid_t l_pid;
 int l_vfs;
 off_t l_start;
 off_t l_len;
};

And here is what PHP came up with:
Code:

#include <fcntl.h>

struct flock lock = { 1, 2, 3, 4, 5 };

int main() {
    if(lock.l_start == 1 && lock.l_len == 2 && lock.l_type == 4 && lock.l_whence == 5) {
        return 0;
    }
    return 1;
}

The only comment I can come up with is: *sigh*

Later: --enable-opcache=no solved this problem. Next one:
Code:

/usr/local/src/php-5.6.4/ext/oci8/oci8.c: In function 'php_oci_connection_ping':
/usr/local/src/php-5.6.4/ext/oci8/oci8.c:2224:2: error: 'version' undeclared (first use in this function)


NevemTeve 01-09-2015 05:26 AM

It was because of the old Oracle version... Now I'm trying this:

Code:

if explist $ORACLE_HOME/lib32/libclntsh.so | grep -q OCIPing; then
    echo Happy
else
    echo '*** Except troubles with OCIPing ***'
fi

That helped. Now my only concern is these warnings from ld (when linking sapo/cli/php):
Code:

ld: 0711-415 WARNING: Symbol HARDCODED_INI is already exported.
...
ld: 0711-415 WARNING: Symbol zval_used_for_init is already exported.


NevemTeve 01-09-2015 06:25 AM

Ok, I found the reason: ld was been given two export files: one generated by libtool (because of option -export-dynamic) and one generated by PHP's compilation scripts.

NevemTeve 01-09-2015 07:26 AM

And now:
Code:

It is not safe to rely on the system's timezone settings.
You are *required* to use the date.timezone setting or the
date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning,
you most likely misspelled the timezone identifier.

of course it worked in the previous version. /usr/local/etc/php.ini:
Code:

[Date]
; Defines the default timezone used by the date functions
; 20090403.LZS: új érték: Europe/Budapest
date.timezone = Europe/Budapest

Edit: the message comes from php_date.c name's DATE_TZ_ERRMSG

NevemTeve 01-09-2015 07:51 AM

function parse_tz.c:seek_to_tz_position tries to find "Europe/Budapest" in ints database. I think it should work:
Code:

p tzdb->index[424]
$18 = {id = 0x107cc554 <empty_fcall_info_cache+7456> "Europe/Budapest", pos = 182008}


NevemTeve 01-09-2015 08:06 AM

Recompiled with option '-g', now works. So now I recompile it again without '-g' and see what happens.

Now it works. Next step: repeat it on another computer.

20150109.1509: On the second computer ./configure failed when it couldn't find libreadline.a's dependency libcurses.a... solution:
Code:

sed 's;termcap;curses;g' configure

NevemTeve 01-09-2015 09:48 AM

20150109.1540: Got back to the first computer, compiled PHP again, result: from CLI works, from Apache doesn't work. Also it cannot load the plugins (imagick and a home-made plugin).

20150109.1735: Well, if was my fault: I didn't add configure option --with-layout=GNU so it took the ini-file from some exotic place instead of /usr/local/etc/php.ini

NevemTeve 01-09-2015 11:58 AM

Note: in the version the default value of default_charset is 'UTF-8', not empty as it used to be!

NevemTeve 01-10-2015 03:26 PM

Another computer with older AIX, linking libphp5.so:
Code:

ld: 0711-317 ERROR: Undefined symbol: .CMSG_SPACE
ld: 0711-317 ERROR: Undefined symbol: .CMSG_LEN

20150110.2141: So it should come from sys/sockets.h, but not always...
I could either define symbol _LINUX_SOURCE_COMPAT or hack a special little file called /usr/local/include/sys/socket.h... I think I'll go for the second option.

20150111.1120: It's something like this:
Code:

/* socket.h */

#ifndef _H_SYS_SOCKET

/* install this file into  /usr/local/include/sys */

#include_next <sys/socket.h>

#ifndef CMSG_ALIGN
#define CMSG_ALIGN _CMSG_ALIGN
#define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
#define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
#endif

#endif

Hopefully, it won't cause trouble in any AIX version


All times are GMT -5. The time now is 08:25 AM.