php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70158 Building with static imap fails
Submitted: 2015-07-28 13:28 UTC Modified: 2015-07-29 17:13 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: IMAP related
PHP Version: 7.0Git-2015-07-28 (Git) OS: Windows
Private report: No CVE-ID: None
 [2015-07-28 13:28 UTC] cmb@php.net
Description:
------------
On Windows trying to build with the imap extension statically
linked fails. This happens with the latest deps[1], but most
likely also with self compiled c-client libs.

The cause is that openlog(), syslog() and flock() are defined by
imap's[2] as well as PHP's[3] Unix compat layer for Windows.

[1] <http://windows.php.net/downloads/php-sdk/>
[2] <https://github.com/winlibs/imap/blob/master/src/osdep/nt/yunchan.c>
[3] <https://github.com/php/php-src/tree/php-7.0.0beta2/win32>

Test script:
---------------
configure --disable-all --enable-cli --with-imap
nmake

Expected result:
----------------
no errors

Actual result:
--------------
cclient_a.lib(os_w2k.obj) : error LNK2005: flock already defined in flock_compat.obj
cclient_a.lib(os_w2k.obj) : error LNK2005: openlog already defined in wsyslog.obj
cclient_a.lib(os_w2k.obj) : error LNK2005: syslog already defined in wsyslog.obj

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-28 13:28 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2015-07-28 19:18 UTC] cmb@php.net
-Status: Assigned +Status: Open -Assigned To: cmb +Assigned To:
 [2015-07-29 08:06 UTC] ab@php.net
Hi Christoph,

yeah, imap is never built static on Windows. And, the same c-client is used unchanged through all the PHP versions.

As far as I see, c-client uses the same implementation by Mark Crispin. In PHP it already contains some patches. I just went through winlibs and there are several other libs using at least openlog/syslog - libsasl, openldap, net-snmp, postgresql. Without going much into detail what I previously thought - we could export those symbols in PHP and patch c-client. But probably it's too much given other libs will possibly need to be patched and there's no good possibility to evaluate the impacts.

With the ext/imap case I would rather disable the static building (eq force to be shared always, like intl or fileinfo). It's compiled shared in the official releases (snapshot build). Also for security reasons as c-client is dead.

Thanks.
 [2015-07-29 15:01 UTC] cmb@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ce3c869d19f3acf4befae15a4e37f527c57fa92e
Log: Fix #70158: Building with static imap fails
 [2015-07-29 15:01 UTC] cmb@php.net
-Status: Open +Status: Closed
 [2015-07-29 15:05 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2015-07-29 15:05 UTC] cmb@php.net
Well, disabling static builds of ext/imap makes sense for the
reasons you mentioned, Anatol. I've committed that to master.
 [2015-07-29 17:13 UTC] ab@php.net
Yeah, plus the fact it fails to build static with vanilla c-client. There are quite some limitations in several cases as many libs try to emulate Linux APIs, or have own rules, or etc. :) All that affect core and PECL builds.

Thanks, Christoph.
 [2015-08-04 20:54 UTC] ab@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ce3c869d19f3acf4befae15a4e37f527c57fa92e
Log: Fix #70158: Building with static imap fails
 [2016-07-20 11:37 UTC] davey@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ce3c869d19f3acf4befae15a4e37f527c57fa92e
Log: Fix #70158: Building with static imap fails
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC