Bug 208525 - databases/mysql57-server: Fix build with libc++ 3.8.0
Summary: databases/mysql57-server: Fix build with libc++ 3.8.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: easy, patch-ready
Depends on:
Blocks: 208158
  Show dependency treegraph
 
Reported: 2016-04-04 18:40 UTC by Dimitry Andric
Modified: 2016-04-09 04:20 UTC (History)
2 users (show)

See Also:
mmokhi: maintainer-feedback+


Attachments
Fix several std::map declarations in databases/mysql57-server (4.57 KB, patch)
2016-04-04 18:40 UTC, Dimitry Andric
no flags Details | Diff
Dimitry's patch + some format handling to satisft portlint (5.22 KB, patch)
2016-04-06 14:13 UTC, Mahdi Mokhtari
mmokhi: maintainer-approval+
Details | Diff
patches_error (3.80 KB, text/plain)
2016-04-08 08:08 UTC, Vladimir Omelchuk
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2016-04-04 18:40:55 UTC
Created attachment 168978 [details]
Fix several std::map declarations in databases/mysql57-server

During the exp-run in bug 208158, it was found that databases/mysql57-server gives errors with libc++ 3.8.0 [1]:

In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.10/storage/innobase/buf/buf0buf.cc:33:
In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.10/storage/innobase/include/ha_prototypes.h:32:
In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.10/storage/innobase/include/univ.i:594:
In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.10/storage/innobase/include/sync0types.h:32:
In file included from /wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.10/storage/innobase/include/ut0new.h:124:
/usr/include/c++/v1/map:837:5: error: implicit instantiation of undefined template '__static_assert_test<false>'
    static_assert((is_same<typename allocator_type::value_type, value_type>::value),
    ^
/usr/include/c++/v1/__config:632:35: note: expanded from macro 'static_assert'
    typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
                                  ^
/wrkdirs/usr/ports/databases/mysql57-server/work/mysql-5.7.10/storage/innobase/buf/buf0buf.cc:359:19: note: in instantiation of template class 'std::__1::map<const unsigned char *, buf_chunk_t *, std::__1::less<const unsigned char *>, ut_allocator<std::__1::pair<const unsigned char *, buf_chunk_t *> > >' requested here
        buf_chunk_map_reg->insert(buf_pool_chunk_map_t::value_type(
                         ^

This is because the value_type for a std::map<> should have a const key argument.  Fix a number of std::map declarations and typedefs by sprinling const in the right places.

[1] http://package18.nyi.freebsd.org/data/headamd64PR208158-default/2016-03-22_18h30m05s/logs/errors/mysql57-server-5.7.10_3.log
Comment 1 Mahdi Mokhtari freebsd_committer freebsd_triage 2016-04-04 20:31:23 UTC
Hi, I've checked your patch, i like to ask some points:

Doesn't it cause errors for other builds (that doesn't use libc++3.8) ? [if yes i think there's a solution to apply the patch conditionally :D]

You can now successfully build both mysql57 server and client after you apply this patch ?

I'm okay to approve patch :), if you confirm both.
if you didn't tried to build (or you're busy and cant try it now), tell me and i'll do it ;)
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2016-04-04 20:47:58 UTC
(In reply to Mahdi Mokhtari from comment #1)
> Hi, I've checked your patch, i like to ask some points:
> 
> Doesn't it cause errors for other builds (that doesn't use libc++3.8) ? [if
> yes i think there's a solution to apply the patch conditionally :D]

This shouldn't change anything for systems with earlier versions of libc++, or with libstdc++.

The only reason this issue now pops up with libc++ 3.8 is that they've put a static assertion in the std::map class, which checks at compile time whether the value_type was defined correctly.  It turns out a lot of software makes mistakes in this area. :)


> You can now successfully build both mysql57 server and client after you
> apply this patch ?

Yes, I verified that, both with the old and new libc++.


> I'm okay to approve patch :), if you confirm both.
> if you didn't tried to build (or you're busy and cant try it now), tell me
> and i'll do it ;)

It would be nice if you double-checked on your system(s), to see if it also works OK for you.  I could have made a mistake... :)
Comment 3 Mahdi Mokhtari freebsd_committer freebsd_triage 2016-04-04 21:02:50 UTC
(In reply to Dimitry Andric from comment #2)
> It would be nice if you double-checked on your system(s), to see if it also works OK for you.  I could have made a mistake... :)
Okay, i'll inform you on my test results tomorrow (in my time :D [it's now near mid-night] )   ;)

> Yes, I verified that, both with the old and new libc++.
Okay. Another small thing is, with this patch 'portlint' screams me about [FATAL] warning that is about patch formats.
I think we should just regenerate the patch with 'make makepatch' to keep it (portlint) satisfied and happy (it's small stuff we can do at end ;D after the current patch verified works with libc on 10.X and 11.X)
Comment 4 Mahdi Mokhtari freebsd_committer freebsd_triage 2016-04-06 14:13:36 UTC
Created attachment 169038 [details]
Dimitry's patch + some format handling to satisft portlint

Hi.
I applied your previous patch on my tree and tested building it with poudriere.
It was okay for me.
Just to satisfy portlint about some errors (warnings) about patch formats, i used to reword it.

I approve+ ed it :)
Just waiting for a port-committer to commit it ;) [do it if you're a port-committer]
Thanks for your patch/help :D
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-04-07 22:24:19 UTC
A commit references this bug:

Author: dim
Date: Thu Apr  7 22:23:20 UTC 2016
New revision: 412695
URL: https://svnweb.freebsd.org/changeset/ports/412695

Log:
  In the exp-run for bug 208158, building databases/mysql57-server
  resulted in errors with libc++ 3.8.0, because it declares the allocators
  for several std::map declarations incorrectly.  Fix this by sprinkling
  const in the right places.

  Approved by:	mokhi64@gmail.com (maintainer)
  PR:		208525
  MFH:		2016Q2

Changes:
  head/databases/mysql57-server/Makefile
  head/databases/mysql57-server/files/patch-include_CMakeLists.txt
  head/databases/mysql57-server/files/patch-man_CMakeLists.txt
  head/databases/mysql57-server/files/patch-sql_json__dom.h
  head/databases/mysql57-server/files/patch-storage_innobase_buf_buf0buf.cc
  head/databases/mysql57-server/files/patch-storage_innobase_dict_dict0stats.cc
  head/databases/mysql57-server/files/patch-storage_innobase_sync_sync0debug.cc
Comment 6 Vladimir Omelchuk 2016-04-08 08:07:22 UTC
Double records in the patches (see attachment)!

Part error log:
...
===>  Patching for mysql57-server-5.7.10_4
===>  Applying FreeBSD patches for mysql57-server-5.7.10_4
Ignoring previously applied (or reversed) patch.
1 out of 1 hunks ignored--saving rejects to sql/json_dom.h.rej
=> Patch patch-sql_json__dom.h failed to apply cleanly.
...
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/mysql57-server
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/mysql57-server
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade20160408-5050-1jqwal7 env UPGRADE_TOOL=portupgrade UPGRADE_PORT=mysql57-server-5.7.10_4 UPGRADE_PORT_VER=5.7.10_4 make
** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
	! databases/mysql57-server (mysql57-server-5.7.10_4)	(patch error)
Comment 7 Vladimir Omelchuk 2016-04-08 08:08:05 UTC
Created attachment 169098 [details]
patches_error
Comment 8 commit-hook freebsd_committer freebsd_triage 2016-04-08 08:43:13 UTC
A commit references this bug:

Author: dim
Date: Fri Apr  8 08:42:35 UTC 2016
New revision: 412723
URL: https://svnweb.freebsd.org/changeset/ports/412723

Log:
  Fix patches that were accidentally concatenated twice in r412695.

  Reported by:	Vladimir Omelchuk <admin@vladiom.com.ua>
  Pointy hat to:	dim
  PR:		208525
  MFH:		2016Q2

Changes:
  head/databases/mysql57-server/files/patch-sql_json__dom.h
  head/databases/mysql57-server/files/patch-storage_innobase_buf_buf0buf.cc
  head/databases/mysql57-server/files/patch-storage_innobase_dict_dict0stats.cc
  head/databases/mysql57-server/files/patch-storage_innobase_sync_sync0debug.cc
Comment 9 Dimitry Andric freebsd_committer freebsd_triage 2016-04-08 08:44:08 UTC
(In reply to Vladimir Omelchuk from comment #6)
> Double records in the patches (see attachment)!

Sorry about that, fixed in r412723.
Comment 10 Mahdi Mokhtari freebsd_committer freebsd_triage 2016-04-08 20:38:12 UTC
(In reply to Dimitry Andric from comment #9)
May i know, what was removed with last patch ?
Comment 11 Mahdi Mokhtari freebsd_committer freebsd_triage 2016-04-08 20:42:56 UTC
To explain more, build fail reported on 10.3 amd_64.
"http://package19.nyi.freebsd.org/data/103i386-default-build-as-user/412698/logs/mysql57-server-5.7.10_4.log"

Is it after commiting second, or before that?
Comment 12 Mahdi Mokhtari freebsd_committer freebsd_triage 2016-04-08 20:45:47 UTC
as i am seeing the reason of failure is "=> Patch patch-sql_json__dom.h failed to apply cleanly."
Im gonna test it myself too :)
Comment 13 Dimitry Andric freebsd_committer freebsd_triage 2016-04-08 21:25:25 UTC
(In reply to Mahdi Mokhtari from comment #12)
> as i am seeing the reason of failure is "=> Patch patch-sql_json__dom.h
> failed to apply cleanly."

Yes, since you modified the patch in comment 4, I downloaded your version, svn reverted my changes and applied your patch instead.  However, I had apparently forgotten that I already had the added files in my tree, so then the patch program will happily append another copy at the end of each file.
Comment 14 Mahdi Mokhtari freebsd_committer freebsd_triage 2016-04-08 21:35:18 UTC
(In reply to Dimitry Andric from comment #13)
It has been corrected with the second patch that Vladimir submitted ?
Comment 15 Dimitry Andric freebsd_committer freebsd_triage 2016-04-08 21:56:58 UTC
(In reply to Mahdi Mokhtari from comment #14)
> (In reply to Dimitry Andric from comment #13)
> It has been corrected with the second patch that Vladimir submitted ?

I committed a fix in r412723, see comment 8.
Comment 16 Vladimir Omelchuk 2016-04-08 22:14:01 UTC
After committed a fix in r412723, patches work is fine!
Thanks Dimitry!


Part build log:
...
root@vladiom:~ # portupgrade -f 'mysql57-s*'
[Reading data from pkg(8) ... - 975 packages found - done]
--->  Reinstalling 'mysql57-server-5.7.10_4' (databases/mysql57-server)
--->  Building '/usr/ports/databases/mysql57-server'
===>  Cleaning for mysql57-server-5.7.10_4
===>  License GPLv2 accepted by the user
===>  Found saved configuration for mysql57-server-5.7.10_3
===>   mysql57-server-5.7.10_4 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by mysql57-server-5.7.10_4 for building
===>  Extracting for mysql57-server-5.7.10_4
=> SHA256 Checksum OK for mysql-5.7.10.tar.gz.
=> SHA256 Checksum OK for boost_1_59_0.tar.gz.
/usr/ports/databases/mysql57-server/work/mysql-5.7.10/sql/sql_hints.yy.cc
/usr/ports/databases/mysql57-server/work/mysql-5.7.10/sql/sql_hints.yy.h
===>  Patching for mysql57-server-5.7.10_4
===>  Applying FreeBSD patches for mysql57-server-5.7.10_4
===>   mysql57-server-5.7.10_4 depends on file: /usr/local/bin/cmake - found
===>   mysql57-server-5.7.10_4 depends on executable: bison - found
===>   mysql57-server-5.7.10_4 depends on file: /usr/local/bin/ccache - found
===>   mysql57-server-5.7.10_4 depends on shared library: libmysqlclient.so.20 - found (/usr/local/lib/mysql/libmysqlclient.so.20)
===>  Configuring for mysql57-server-5.7.10_4
...
Comment 17 Mahdi Mokhtari freebsd_committer freebsd_triage 2016-04-09 04:20:28 UTC
(In reply to Dimitry Andric from comment #15)
Aha yeah I see.
All good.
Thanks a lot again guys.