Problem with conflict between mysql and math.h - mysql

The problem is that the compiler says that there is a redefinition of a function between a library that belongs to MySQL and math.h from the std library.
I have been over this for two days and I still can't figure it out.
Has this ever happened to anyone?
This is the output from the compiler
C:\mingw\bin\mingw32-make.exe all
'Building file: ../src/interfaz/ventanaconf.cpp'
'Invoking: GCC C++ Compiler'
C:\mingw\bin\mingw32-g++.exe -mms-bitfields -I"c:\dev-cpp\gtkmm\include\gtkmm-2.4"
-I"c:\dev-cpp\gtkmm\lib\gtkmm-2.4\include" -I"c:\dev-cpp\gtkmm\include\glibmm-2.4"
-I"c:\dev-cpp\gtkmm\lib\glibmm-2.4\include" -I"c:\dev-cpp\gtkmm\include\gdkmm-2.4"
-I"c:\dev-cpp\gtkmm\lib\gdkmm-2.4\include" -I"c:\dev-cpp\gtkmm\include\pangomm-1.4"
-I"c:\dev-cpp\gtkmm\include\atkmm-1.6" -I"c:\dev-cpp\gtkmm\include\sigc++-2.0"
-I"c:\dev-cpp\gtkmm\lib\sigc++-2.0\include" -I"c:\dev-cpp\gtkmm\include\cairomm-1.0"
-I"c:\gtk\include\gtk-2.0"
-I"c:\gtk\include\glib-2.0"
-I"c:\gtk\lib\glib-2.0\include"
-I"c:\gtk\lib\gtk-2.0\include"
-I"c:\gtk\include\pango-1.0"
-I"c:\gtk\include\cairo"
-I"c:\gtk\include\freetype2"
-I"c:\gtk\include"
-I"c:\gtk\include\atk-1.0"
-I"c:\Archivos de programa\MySQL\MySQL Server 5.0\include"
-O0 -g3 -w -c -fmessage-length=0 -MMD -MP -MF"src/interfaz/ventanaconf.d"
-MT"src/interfaz/ventanaconf.d"
-o"src/interfaz/ventanaconf.o" "../src/interfaz/ventanaconf.cpp"
In file included from c:/Archivos de programa/MySQL/MySQL Server 5.0/include/my_global.h:73,
from ../src/interfaz/../gestiondb/gestordb.h:6,
from ../src/interfaz/../gestiondb/operacionesdb.h:5,
from ../src/interfaz/ventanamodulos.h:20,
from ../src/interfaz/ventanaconf.h:27,
from ../src/interfaz/ventanaconf.cpp:1:
c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h: **In function `double rint(double)':
c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h:228: error: redefinition of `double rint(double)'
C:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/math.h:620: **error: `double rint(double)' previously defined here**
C:\mingw\bin\mingw32-make.exe: *** [src/interfaz/ventanaconf.o] Error 1**
Thanks in advance!!!

This thread in the mysql support area seems to indicate that they've taken the definition of rint() out of their config_win.h file as of April this year (even though the patch was proposed in 2006). Are you using a version of the MySQL source newer than that?

The problem was about an included library, which linux simply ignores, but windows want out. There is no problem letting it out in linux neither...
Somedays i feel SOOOOOOOOOOOOOOOOOOOOOOO STUPID:..

In line 228 of c:/Archivos de programa/MySQL/MySQL Server 5.0/include/config-win.h you should find a declaration/definition of function named "rint". In line 620 of C:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/math.h you should find another definition of a function with the same name (which probably even does the same).
To solve the problem you will have to delete/outcomment/undefine one of these definitions.
Be prepared to get a similar problem when linking, if you also link two libraries with the same function.

Related

Mysql header not found even if is in a nonstandard location

I follow the basically solutions to solve it, but I already had the problem.
In my configure.ac file I have a check for mysql:
AC_CHECK_HEADER([mysql/mysql.h], ,AC_MSG_ERROR([Could not find mysql headers !]))
and of course it complain because, as explain here:
If the header files are installed in a nonstandard location, such as
/opt/include, and CPPFLAGS doesn't refer to that directory-for
example, as -I/opt/include-the AC_CHECK_HEADER macro will fail, even
though the files do exist on the system. However, this is an issue for
the system's administrator. Part of the convenience of autoconf is
that you, as the developer, don't need to worry about these details.
So, as developer, what's the way to go to solve it properly ?
I also put the path of real location in Makefile with -I/usr/include/mysql, but it continues to complain.
EDIT: as suggestd I post the configure.ac (the main parts):
useMysql=no
AC_MSG_CHECKING([whether to use mysql])
AC_ARG_ENABLE(mysql,
[ --enable-mysql Enable mysql support],
[MYSQL="$enableval"]
useMysql=yes,
[MYSQL="no"]
)
AC_MSG_RESULT([$MYSQL])
AC_SUBST([MYSQL])
[...]
if test "$MYSQL" = "yes"; then
AC_CHECKING([for MYSQL Library and Header files])
AC_CHECK_HEADER([mysql/mysql.h], ,AC_MSG_ERROR([Could not find mysql headers !]))
AC_CHECK_LIB(mysqlclient, mysql_init, [ MYSQL_LIBS="-lmysqlclient" ], [AC_MSG_ERROR([$PACKAGE_NAME requires but cannot find mysqlclient])])
AC_DEFINE(USE_MYSQL, 1, [Use MYSQL library])
AC_SUBST(MYSQL_LIBS)
fi
then I use the MYSQL_LIBS in the Makefile:
AM_CFLAGS = -g -fPIC -rdynamic -I$(top_srcdir)/include -I/usr/include/mysql

Erlang Config File Oddness

I have got the following .erlang file in my home directory (Ubuntu):
io:format("executing user profile in home/user/.erlang\n",[]).
code:add_pathz("/media/user/Disk2/Cloud/Workspace/Erlang").
code:add_pathz("/media/user/Disk2/Cloud/Workspace/Erlang/code").
shell_default:cd("/media/user/Disk2/Cloud/Workspace/Erlang").
io:format(".erlang rc finished\n",[]).
I can see that the file is run when I start the Erlang shell in the terminal. What is more, the shell_default:cd-command works fine. However, the code:add_pathz-commands do not. When I try to run anything in the code-directory, I get an "undefined function"-error. Besides, when I list the paths with "code:get_path().", I get:
[".","/usr/lib/erlang/lib/kernel-2.16.4/ebin",
"/usr/lib/erlang/lib/stdlib-1.19.4/ebin",
"/usr/lib/erlang/lib/xmerl-1.3.5/ebin",
"/usr/lib/erlang/lib/wx-1.1.1",
"/usr/lib/erlang/lib/webtool-0.8.9.2/ebin",
"/usr/lib/erlang/lib/typer-0.9.5/ebin",
"/usr/lib/erlang/lib/tv-2.1.4.10/ebin",
"/usr/lib/erlang/lib/tools-2.6.13/ebin",
"/usr/lib/erlang/lib/toolbar-1.4.2.3/ebin",
"/usr/lib/erlang/lib/test_server-3.6.4/ebin",
"/usr/lib/erlang/lib/syntax_tools-1.6.12/ebin",
"/usr/lib/erlang/lib/ssl-5.3.2/ebin",
"/usr/lib/erlang/lib/ssh-3.0/ebin",
"/usr/lib/erlang/lib/snmp-4.25/ebin",
"/usr/lib/erlang/lib/sasl-2.3.4/ebin",
"/usr/lib/erlang/lib/runtime_tools-1.8.13/ebin",
"/usr/lib/erlang/lib/reltool-0.6.4.1/ebin",
"/usr/lib/erlang/lib/public_key-0.21/ebin",
"/usr/lib/erlang/lib/pman-2.7.1.4/ebin",
"/usr/lib/erlang/lib/percept-0.8.8.2/ebin",
"/usr/lib/erlang/lib/parsetools-2.0.10/ebin",
"/usr/lib/erlang/lib/otp_mibs-1.0.8/ebin",
"/usr/lib/erlang/lib/os_mon-2.2.14/ebin",
"/usr/lib/erlang/lib/orber-3.6.26.1/ebin",
"/usr/lib/erlang/lib/odbc-2.10.18/ebin",
"/usr/lib/erlang/lib/observer-1.3.1.2/ebin",
"/usr/lib/erlang/lib/mnesia-4.11/ebin",
[...]|...]
Why isn't "code:add_pathz" working? Thanks.
Erlang R16B03
Eshell V5.10.4
Ubuntu LTS 14.04
The path above works. The fault was with .beam-files in the code-directory. Recompiling made them accessible from outside the "code"-directory.

Nap6.4 for tcl fails to install and make due to "conflicted types for Nap_parse"

I need to install Nap6.4, but it fails with an "error: conflicting types for Nap_parse". I have a Dockerfile where I include "ADD ./nap6_4_0src.tar.gz /usr/local" and from usr/local/nap/unix I type:
./configure --prefix=/usr/local && make && make install
I have installed Proj4, hdf4 and netcdf using the same approach. I have also tried other versions of Nap, but they all give the same error. I have spent the last days trying to modify the files under nap/generic, some of them are generated by Bison and there is also some m4 files there. Does anyone recognize this error and know how to fix it? Any help will be highly appreciated!
Here is the error message:
cc -c -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" - DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -DHAVE_UNISTD_H=1 -DISNAN64=isnan -DVERSION=\"6.4\" -DPATCHLEVEL=\".0\" -I`echo /build/nap/generic` -I`echo /usr/local/include` -I`echo /usr/local/include` -I`echo /usr/local/include` -I`echo /lib/ActiveTcl-8.6/include` -O -D__NO_STRING_INLINES -D__NO_MATH_INLINES -fPIC `echo /build/nap/generic/eval_tree.c`
In file included from /build/nap/generic/eval_tree.c:16:0:
/build/nap/generic/napParse.tab.h:79:5: error: conflicting types for 'Nap_parse'
int Nap_parse (void);
^
In file included from /build/nap/generic/eval_tree.c:14:0:
/build/nap/generic/nap.h,m4:610:13: note: previous declaration of Nap_parse was here
EXTERN int Nap_parse(void *Nap_param); /* Defined in napParse.y */
^
make: *** [eval_tree.o] Error 1
Additionally, I get some other errors:
napParse.tab.c:2122:46: error: macro "Nap_error" passed 2 arguments, but takes just 1
/usr/local/nap/generic/napParse.tab.c:65:25: error: 'Nap_error' undeclared (first use in this function)
#define yyerror Nap_error
^
napParse.tab.c:2122:7: note: in expansion of macro 'yyerror'
/usr/local/nap/generic/napParse.tab.c:65:25: note: each undeclared identifier is reported only once for each function it appears in
#define yyerror Nap_error
^
and
make: *** No rule to make target `netcdf.h', needed by `nap_get.o'.
I suspect the latter one along with some other similar errors are because I tried
./configure --prefix=/lib/ActiveTcl8.6
Any ideas of what goes wrong here?
The source code for Nap6.4 is very old, and it seems to expect a particular range of versions of bison. It's likely that your bison is too new to fit into this range.
In particular, lines 28 and 29 of napParse.y:
#define YYPARSE_PARAM Nap_param
#define YYLEX_PARAM Nap_param
will not have any effect if your bison is v2.7 or more recent. Those macros were already deprecated in 2002, and in 2012 they were actually removed from the generated code. So the defines will have no effect.
Also, in line 36:
%pure_parser
I think this may still be accepted but it has been deprecated for a good long time, too.
With a modern bison, you would want to delete those three lines, and then (where the %pure_parser declaration used to be), insert the following:
%define api.pure full
%param { void* Nap_param }
If your version of bison is not quite so up-to-date, it might complain about the %param line, in which case you could use:
%define api.pure full
%parse-param { void* Nap_param }
%lex-param { void* Nap_param }
You will also need to correct the definition of Nap_error, which you will find in the file generic/nap_check.h at line 194. That definition should read:
#define Nap_error(Nap_param, message) \
Nap_Check(Nap_param, __FILE__, __LINE__, message)
Current bison scanners add the parameter specified in %parse-param to the call to the error function, so you need to change the prototype of the macro to accept the parameter rather than picking it up from the environment.
If that works, you might want to file a bug report, although it is not at all clear to me that anyone is maintaining that software.

Octave crashes on matrix multiplication of dimension 52 by 52

magic(5) * magic(5) // works
magic(52) * magic(52) // fails
panic: Illegal instruction -- stopping myself...
attempting to save variables to 'octave-core'...
save to 'octave-core' complete
I am on Ubuntu 13.04, 32 bit, linux kernel 3.8.0-31-generic
I tried uninstalling atlas as mentioned here but could not find libatlas3gf-base so removed fgfs-atlas instead but that did not work.
Install the following packages first
libblas3gf
libblas-doc
libblas-dev
liblapack3gf
liblapack-doc
liblapack-dev
And if that does not work, search for 'blas linear' in your software package manager and install all except for Java,python,perl etc.
Ref: http://ubuntuforums.org/showthread.php?t=1505249

dpkg-shlibdeps: error: no dependency information found for

I'm compiling a deb package and when I run dpkg-buildpackage I get:
dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/libopencv_highgui.so.2.3
...
make: *** [binary-arch] Error 2
This happens because I installed the dependency manually. I know that the problem will be fixed if I install the dependency (or use checkinstall), and I want to generate the package anyway because I'm not interested on dependency checking. I know that I can give to dpkg-shlibdeps the option --ignore-missing-info which prevents a fail if dependency information can't be found. But I don't know how to pass this option to dpkg-shlibdeps since I'm using dpkg-buildpackage and dpkg-buildpackage calls dpkg-shlibdeps...
I have already tried:
sudo dpkg-buildpackage -rfakeroot -d -B
And with:
export DEB_DH_MAKESHLIBS_ARG=--ignore-missing-info
as root.
Any ideas?
use:
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
if your rule file hasn't the dh_shlibdeps call in it. That's usually the case if you've
%:
dh $#
as only rule in it ... in above you must use a tab and not spaces in front of the dh_shlibdeps
If you want it to just ignore that flag, change the debian/rules line from:
dh_shlibdeps
to:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
Yet another way, without modifying build scripts, just creating one file.
You can specify local shlib overrides by creating debian/shlibs.local with the following format: library-name soname-version dependencies
For example, given the following (trimmed) ldd /path/to/binary output
libevent-2.0.so.5 => /usr/lib/libevent-2.0.so.5 (0x00007fc9e47aa000)
libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007fc9e4161000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fc9e3b1a000)
The contents of debian/shlibs.local would be:
libevent-2.0 5 libevent-2.0
libgcrypt 20 libgcrypt
libpthread 0 libpthread
The "dependencies" list (third column) doesn't need to be 100% accurate - I just use the library name itself again.
Of course this isn't needed in a sane debian system which has this stuff defined in /var/lib/dpkg/info (which can be used as inspiration for these overrides). Mine isn't a sane debian system.
Instead of merely ignoring the error, you might also want to fix the source of the error, which is usually either a missing or an incorrect package.shlibs or package.symbols file in package which contains the shared library triggering the error.
[1] documents how dpkg-shlibdeps uses the package.shlibs resp. package.symbols, files, [2] documents the format of the package.shlibs and package.symbols files.
[1] https://manpages.debian.org/jessie/dpkg-dev/dpkg-shlibdeps.1.en.html
[2] https://www.debian.org/doc/debian-policy/ch-sharedlibs.html
You've just misspelled your export. It should be like this:
export DEB_DH_SHLIBDEPS_ARGS_ALL=--dpkg-shlibdeps-params=--ignore-missing-info
dpkg-buildpackage uses make to process debian/rules. in this process, dpkg-buildpackage it might call dpkg-shlibdeps.
thus, the proper way to pass modify a part of the package building process is to edit debian/rules.
it's hard to give you any more hints, without seeing the actual debian/rules.
Finally I did it in the brute way:
I edited the script /usr/bin/dpkg-shlibdeps, changing this :
my $ignore_missing_info = 0;
to
my $ignore_missing_info = 1;
You can use this:
dh_makeshlibs -a -n
exactly after dh_install