Bug #49947 vi.c:918:74: macro "__weak_reference" requires 2 arguments, but only 1 given
Submitted: 27 Dec 2009 19:26 Modified: 6 Jan 2010 21:03
Reporter: oicu cc Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.1.41 OS:Windows (cygwin 1.7.1)
Assigned to: CPU Architecture:Any
Tags: weak_reference

[27 Dec 2009 19:26] oicu cc
Description:
version: mysql-5.0.89.tar.gz / mysql-5.1.41.tar.gz

Similar to Bug #42817

./configure --without-server

could not find "sys/ttydefaults.h"

I found this file from newwork, put it in /usr/include/sys, and recompile success.

./make
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include    -O3
  -MT vi.o -MD -MP -MF .deps/vi.Tpo -c -o vi.o vi.c
vi.c:918:74: macro "__weak_reference" requires 2 arguments, but only 1 given
vi.c:918: error: parse error before "__weak_reference"
vi.c:918: warning: data definition has no type or storage class
vi.c: In function `vi_alias':
vi.c:928: error: `get_alias_text' undeclared (first use in this function)
vi.c:928: error: (Each undeclared identifier is reported only once
vi.c:928: error: for each function it appears in.)
vi.c:937: warning: assignment makes pointer from integer without a cast
make[2]: *** [vi.o] Error 1
make[2]: Leaving directory `/home/oicu/mysql-5.1.41/cmd-line-utils/libedit'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/oicu/mysql-5.1.41/cmd-line-utils'
make: *** [all-recursive] Error 1

How to repeat:
cygwin 1.7.1 default install.

Add packages:
cygrunsrv
binutils
flex
bison
cron
gcc-core
gcc-mingw-core
m4
make
perl
libtool
lighttpd
libncurses-devel
libxml2
libxml2-devel
libiconv
libjpeg
libpng
libfreetype6
gd
libgd
zlib
openssh
gmp
wget

-------------

wget http://ring.nict.go.jp/archives/NetBSD/NetBSD-release-4-0/src/sys/sys/ttydefaults.h
put it in /usr/include/sys

decompression mysql-5.0.89.tar.gz  or  mysql-5.1.41.tar.gz

./configure --without-server
./make        ==>> repeat the error
[29 Dec 2009 1:58] Benjamin Bryant
add cygwin readline package

./configure --without-server --without-readline CFLAGS=-O2  CXXFLAGS=-O2
[29 Dec 2009 3:34] MySQL Verification Team
Please see [29 Dec 2:58] Benjamin Bryant comments. Thanks in advance.
[30 Dec 2009 22:20] oicu cc
-______-!

I modified the "vi.c" then compile success,
later, I found the method from network:
./configure --without-server --without-readline CFLAGS=-O2
also compile success.
I am still thank you very much.
[4 Jan 2010 9:53] Susanne Ebrecht
Is it ok for you when we close this bug report now?
[25 Mar 2010 1:44] Bk Chockalingam
Anyone else seeing this error during make?  How did you get around this?

make[2]: Entering directory `/cygdrive/c/Users/bk/Downloads/mysql-5.1.45/client'
g++ -DMYSQL_CLIENT_NO_THREADS -DDEFAULT_MYSQL_HOME="\"/usr/local/mysql\"" -DMYSQL_DATADIR="\"/usr/local/mysql/var\"" -I. -I../include -I../include -I../include
-I../regex     -O2   -fno-implicit-templates -fno-exceptions -fno-rtti -MT mysql.o -MD -MP -MF .deps/mysql.Tpo -c -o mysql.o mysql.cc
mysql.cc:1038: error: redefinition of `struct _hist_entry'
../include/readline/readline.h:46: error: previous definition of `struct _hist_entry'
mysql.cc:1041: error: invalid type in declaration before `;' token
mysql.cc:1041: error: conflicting declaration `typedef int HIST_ENTRY'
../include/readline/readline.h:49: error: `HIST_ENTRY' has a previous declaration as `typedef struct _hist_entry HIST_ENTRY'
mysql.cc: In function `void initialize_readline(char*)':
mysql.cc:2433: error: `rl_completion_func_t' was not declared in this scope
mysql.cc:2433: error: expected primary-expression before `)' token
mysql.cc:2434: error: invalid conversion from `char* (*)(const char*, int)' to `int (*)(const char*, int)'
mysql.cc:2436: error: `rl_command_func_t' was not declared in this scope
mysql.cc:2436: error: expected primary-expression before `)' token
make[2]: *** [mysql.o] Error 1
make[2]: Leaving directory `/cygdrive/c/Users/bk/Downloads/mysql-5.1.45/client'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/cygdrive/c/Users/bk/Downloads/mysql-5.1.45/client'
make: *** [all-recursive] Error 1
[28 Jul 2010 16:30] Donato Espera
Mine worked perfectly using these flags in configure options below:

./configure --prefix /opt/mysql --without-server --without-readline --without-libedit CFLAGS=-O2  CXXFLAGS=-O2
[25 Nov 2011 17:01] Mateo Laino
Hello.
I'm suffering the same problem trying to build MySQL 5.1.60 with cygwin.
I would like to use cacti-spine under windows xp.

First when I make I had the same reported problems with ttydefaults.h.
I downloaded it in usr/include/sys/sys/ and tryed again.

Now when I meke I have the following output:

Mateo Laiño@ml /src/mysql-5.1.60
$ make
Making all in .
make[1]: Entering directory `/src/mysql-5.1.60'
make abi_headers="include/mysql/plugin.h include/mysql.h" do_abi_check
make[2]: Entering directory `/src/mysql-5.1.60'
set -ex; \
        for file in include/mysql/plugin.h include/mysql.h; do \
                 gcc -E -nostdinc -dI -DMYSQL_ABI_CHECK \
                          -I./include \
                          -I./include/mysql \
                          -I./sql \
                          -I./include \
                          -I./include/mysql \
                          -I./sql \
                                         $file 2>/dev/null | \
                          /usr/bin/sed -e '/^# /d' \
                                    -e '/^[     ]*$/d' \
                                    -e '/^#pragma GCC set_debug_pwd/d' \
                                    -e '/^#ident/d' > \
                                               ./abi_check.out; \
                          /usr/bin/diff -w $file.pp ./abi_check.out; \
                          /usr/bin/rm ./abi_check.out; \
        done
+ for file in include/mysql/plugin.h include/mysql.h
+ gcc -E -nostdinc -dI -DMYSQL_ABI_CHECK -I./include -I./include/mysql -I./sql
I./include -I./include/mysql -I./sql include/mysql/plugin.h
+ /usr/bin/sed -e '/^# /d' -e '/^[      ]*$/d' -e '/^#pragma GCC set_debug_pwd
' -e '/^#ident/d'
+ /usr/bin/diff -w include/mysql/plugin.h.pp ./abi_check.out
+ /usr/bin/rm ./abi_check.out
+ for file in include/mysql/plugin.h include/mysql.h
+ gcc -E -nostdinc -dI -DMYSQL_ABI_CHECK -I./include -I./include/mysql -I./sql
I./include -I./include/mysql -I./sql include/mysql.h
+ /usr/bin/sed -e '/^# /d' -e '/^[      ]*$/d' -e '/^#pragma GCC set_debug_pwd
' -e '/^#ident/d'
+ /usr/bin/diff -w include/mysql.h.pp ./abi_check.out
+ /usr/bin/rm ./abi_check.out
make[2]: Leaving directory `/src/mysql-5.1.60'
make[1]: Leaving directory `/src/mysql-5.1.60'
Making all in include
make[1]: Entering directory `/src/mysql-5.1.60/include'
make  all-am
make[2]: Entering directory `/src/mysql-5.1.60/include'
make[2]: Leaving directory `/src/mysql-5.1.60/include'
make[1]: Leaving directory `/src/mysql-5.1.60/include'
Making all in Docs
make[1]: Entering directory `/src/mysql-5.1.60/Docs'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/src/mysql-5.1.60/Docs'
Making all in cmd-line-utils
make[1]: Entering directory `/src/mysql-5.1.60/cmd-line-utils'
Making all in libedit
make[2]: Entering directory `/src/mysql-5.1.60/cmd-line-utils/libedit'
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include    -g
2   -MT vi.o -MD -MP -MF .deps/vi.Tpo -c -o vi.o vi.c
In file included from el.h:50:0,
                 from vi.c:51:
chartype.h:65:2: warning: #warning Build environment does not support non-BMP
aracters
vi.c:921:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'c
r'
vi.c:922:36: error: macro "__weak_reference" requires 2 arguments, but only 1
ven
vi.c: In function 'vi_alias':
vi.c:933:6: error: 'my_get_alias_text' undeclared (first use in this function)
vi.c:933:6: note: each undeclared identifier is reported only once for each fu
tion it appears in
vi.c:942:13: warning: assignment makes pointer from integer without a cast
make[2]: *** [vi.o] Error 1
make[2]: Leaving directory `/src/mysql-5.1.60/cmd-line-utils/libedit'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/src/mysql-5.1.60/cmd-line-utils'
make: *** [all-recursive] Error 1

If I ./configure --without-server --without-readline --without-libedit CFLAGS=-02 CXXFLAGS=-02

I get the following response:

configure: error: Could not find system readline or libedit libraries
              Use --with-readline or --with-libedit to use the bundled
              versions of libedit or readline

any idea? how can I ./configure?
Help please.

Thanks, Mateo Laiño.