Bug 176105 - databases/mysql51-client: 5.1.68 Fails to build with clang
databases/mysql51-client: 5.1.68 Fails to build with clang
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Alex Dupre
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-13 11:50 UTC by Bernard Spil
Modified: 2013-05-06 11:50 UTC (History)
0 users

See Also:


Attachments
patch-include_my_net.h (422 bytes, text/x-chdr; charset=US-ASCII)
2013-05-06 09:22 UTC, Bernard Spil
no flags Details
patch-configure.txt (478 bytes, patch)
2013-05-06 11:41 UTC, Bernard Spil
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bernard Spil 2013-02-13 11:50:00 UTC
Building 5.1.68 with clang fails, building with gcc (base) completes without problems.

Output from make 

libtool: compile:  clang -DDEFAULT_CHARSET_HOME=\"/usr/local\" -DMYSQL_DATADIR=\"/var/db/mysql\" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR=\"/usr/local/etc\" -DSHAREDIR=\"/usr/local/share/mysql\" -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID -I. -I../include -I../include -I../include -O2 -fno-strict-aliasing -pipe -march=pentium-m -O3 -fno-omit-frame-pointer -fno-gcse -MT password.lo -MD -MP -MF .deps/password.Tpo -c password.c -o password.o >/dev/null 2>&1
mv -f .deps/password.Tpo .deps/password.Plo
/bin/sh ../libtool --preserve-dup-deps --tag=CC    --mode=compile clang -DDEFAULT_CHARSET_HOME="\"/usr/local\""  -DMYSQL_DATADIR="\"/var/db/mysql\""  -DDEFAULT_HOME_ENV=MYSQL_HOME  -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX  -DDEFAULT_SYSCONFDIR="\"/usr/local/etc\""  -DSHAREDIR="\"/usr/local/share/mysql\"" -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID -I. -I../include -I../include -I../include       -O2 -fno-strict-aliasing -pipe -march=pentium-m  -O3 -fno-omit-frame-pointer -fno-gcse -MT manager.lo -MD -MP -MF .deps/manager.Tpo -c -o manager.lo manager.c
libtool: compile:  clang -DDEFAULT_CHARSET_HOME=\"/usr/local\" -DMYSQL_DATADIR=\"/var/db/mysql\" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR=\"/usr/local/etc\" -DSHAREDIR=\"/usr/local/share/mysql\" -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID -I. -I../include -I../include -I../include -O2 -fno-strict-aliasing -pipe -march=pentium-m -O3 -fno-omit-frame-pointer -fno-gcse -MT manager.lo -MD -MP -MF .deps/manager.Tpo -c manager.c  -fPIC -DPIC -o .libs/manager.o
clang: warning: argument unused during compilation: '-fno-gcse'
In file included from manager.c:20:
In file included from ../include/my_global.h:444:
/usr/include/sys/timeb.h:42:2: warning: "this file includes <sys/timeb.h> which is deprecated" [-W#warnings]
#warning "this file includes <sys/timeb.h> which is deprecated"
 ^
manager.c:132:10: error: too few arguments to function call, expected 6, have 5
    hp = my_gethostbyname_r(host,&tmp_hostent,buff2,sizeof(buff2),
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/my_net.h:113:74: note: expanded from macro 'my_gethostbyname_r'
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
                                      ~~~~~~~~~~~~~~~                    ^
/usr/include/netdb.h:250:1: note: 'gethostbyname_r' declared here
int             gethostbyname_r(const char *, struct hostent *, char *, size_t,
^
1 warning and 1 error generated.
*** [manager.lo] Error code 1
1 error
*** [all] Error code 2
1 error
*** [all-recursive] Error code 1
1 error
*** [do-build] Error code 1

Stop in /usr/ports/databases/mysql51-client.

Fix: 

Use gcc
How-To-Repeat: Use clang
Build databases/mysql51-client
Comment 1 Edwin Groothuis freebsd_committer 2013-02-13 11:50:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Alex Dupre freebsd_committer 2013-04-23 10:40:35 UTC
State Changed
From-To: open->feedback

Propose a patch, please :-)
Comment 3 Bernard Spil 2013-04-23 18:33:48 UTC
Hi Alex,

If I knew how to write a patch I would :D

Duplicate of http://www.freebsd.org/cgi/query-pr.cgi?pr=167805 I now see,
sorry for that

Bug is also reported in llvm.org bug-database
http://llvm.org/bugs/show_bug.cgi?id=15206

And in MySQL manual
http://docs.oracle.com/cd/E17952_01/refman-5.1-en/compilation-problems.html

So probably the correct question is: How to fiddle the options to clang to
compile this without failing or to change the macro so it works.

Found a bug in the bug-database of MySQL as well but there the answer is
simply 'use g++' and bugs will be closed referring to that statement.

Kind regards,

Spil.



On Tue, Apr 23, 2013 at 11:40 AM, <ale@freebsd.org> wrote:

> Synopsis: databases/mysql51-client: 5.1.68 Fails to build with clang
>
> State-Changed-From-To: open->feedback
> State-Changed-By: ale
> State-Changed-When: Tue Apr 23 09:40:35 UTC 2013
> State-Changed-Why:
> Propose a patch, please :-)
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=176105
>
Comment 4 Alex Dupre freebsd_committer 2013-05-06 09:52:14 UTC
State Changed
From-To: feedback->closed

Fixed, thanks!
Comment 5 dfilter freebsd_committer 2013-05-06 09:53:23 UTC
Author: ale
Date: Mon May  6 08:52:05 2013
New Revision: 317485
URL: http://svnweb.freebsd.org/changeset/ports/317485

Log:
  Fix build with clang.
  
  PR:		ports/176105
  Submitted by:	Spil <spil.oss@gmail.com>

Added:
  head/databases/mysql50-server/files/patch-include_my_net.h   (contents, props changed)
  head/databases/mysql51-server/files/patch-include_my_net.h   (contents, props changed)

Added: head/databases/mysql50-server/files/patch-include_my_net.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/mysql50-server/files/patch-include_my_net.h	Mon May  6 08:52:05 2013	(r317485)
@@ -0,0 +1,11 @@
+--- include/my_net.h.orig	2013-05-06 10:44:34.000000000 +0200
++++ include/my_net.h	2013-05-06 10:45:11.000000000 +0200
+@@ -110,7 +110,7 @@
+ 				   int buflen, int *h_errnop);
+ #define my_gethostbyname_r_free()
+ #else
+-#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
++#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E),NULL)
+ #define my_gethostbyname_r_free()
+ #endif /* !defined(HAVE_GETHOSTBYNAME_R) */
+ 

Added: head/databases/mysql51-server/files/patch-include_my_net.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/mysql51-server/files/patch-include_my_net.h	Mon May  6 08:52:05 2013	(r317485)
@@ -0,0 +1,11 @@
+--- include/my_net.h.orig	2013-05-06 10:44:34.000000000 +0200
++++ include/my_net.h	2013-05-06 10:45:11.000000000 +0200
+@@ -110,7 +110,7 @@
+ 				   int buflen, int *h_errnop);
+ #define my_gethostbyname_r_free()
+ #else
+-#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
++#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E),NULL)
+ #define my_gethostbyname_r_free()
+ #endif /* !defined(HAVE_GETHOSTBYNAME_R) */
+ 
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 6 Bernard Spil 2013-05-06 11:41:55 UTC
Hi Alex,

Thought that this fixes it but it doesn't. It allows mysql51-client to
build correctly but clang build for mysql51-server still fails on the
accept call.
With this modified patch-configure it does build OK.

files/patch-configure
--- configure.orig      2013-03-06 07:33:45.000000000 +0100
+++ configure   2013-05-06 11:51:13.000000000 +0200
@@ -24768,8 +24768,8 @@
 # Some system specific hacks
 #

-MAX_C_OPTIMIZE="-O3"
-MAX_CXX_OPTIMIZE="-O3"
+MAX_C_OPTIMIZE=""
+MAX_CXX_OPTIMIZE=""

 case $SYSTEM_TYPE in
   *solaris2.7*)
@@ -31108,7 +31108,7 @@


 cat >>confdefs.h <<_ACEOF
-#define SOCKET_SIZE_TYPE $mysql_cv_btype_last_arg_accept
+#define SOCKET_SIZE_TYPE u_int
 _ACEOF

 CXXFLAGS="$ac_save_CXXFLAGS"