Author Topic: Compiling on Fedora 15 x86_64  (Read 2740 times)

Geceni

  • Hydlaa Resident
  • *
  • Posts: 66
    • View Profile
Compiling on Fedora 15 x86_64
« on: October 10, 2011, 07:00:32 am »
Hi, I'm having some problems building psserver from SVN. I've followed all of the instructions here: https://planeshift.svn.sf.net/svnroot/planeshift/trunk/docs/compiling.html. Everything compiles OK, but it appears that the mysql plugin is not compiling. I say that because when I run
Code: [Select]
./psserverI get the following error:
Code: [Select]
Your configuration files are in... /home/user/.PlaneShift

crystalspace.pluginmgr.loadplugin:
  could not load plugin ‘crystalspace.sndsys.element.ogg’
  could not load plugin ‘planeshift.database.mysql’
(irrelevant output omitted here)
Sun Oct  9 21:45:18 2011, Sun Oct  9 21:45:18 2011, Database Host: 'localhost' User: 'planeshift' Databasename: 'planeshift' Port: 0

planeshift.application.server:
  No iDataConnection plugin!
Sun Oct  9 21:45:18 2011, <src/server/psserver.cpp:297 Initialize SEVERE>
Sun Oct  9 21:45:18 2011, Could not create database or connect to it:
Sun Oct  9 21:45:18 2011, error while initializing server!

Up near the top, I see that it doesn't load the mysql plugin. I have the mysql, mysql-dev, and mysql C++ API and dev libraries installed on my system via yum. I'm thinking that the problem has something to do with the output of the ./configure script right before compiling.

Code: [Select]
(irrelevant output here)
checking if pkg-config recognizes mysqlclient... no
checking for mysqlclient-config... no
checking for libmysqlclient... no
(more irrelevant output)
Optional Dependencies
---------------------
Missing
  PostgreSQL           (database)
  Sqlite3              (database)
  hunspell             (other)
  mysql                (database)

I've tried to specify the location of the libmysqlclient.so with:
Code: [Select]
./configure --with-mysqlclient=<insert directory here>I wasn't sure if the configure script was looking for the binary .so file or the headers, so I tried running it different times with the path to the binary (/usr/lib64/mysql) and the path to the headers in (/usr/include/mysql). Also note that I have both the 64-bit and 32-bit development libraries for mysql installed.

At this point I'm out of ideas... if some helpful developer could shed some light on the problem, I'd appreciate it greatly.

I want to build the server both because I'm interested in applying for the dev team, and I'm also interested in working (some time off in the future) on a modified version of the server/client to allow for fully dynamic virtual worlds. And besides that, PS is just THAT cool.  ;)

Thanks,
Geceni
« Last Edit: October 10, 2011, 07:02:28 am by Geceni »

weltall

  • Moderator
  • Veteran
  • *
  • Posts: 1671
    • View Profile
    • http://weltall.heliohost.org
Re: Compiling on Fedora 15 x86_64
« Reply #1 on: October 11, 2011, 06:45:42 am »
we use the c api

Geceni

  • Hydlaa Resident
  • *
  • Posts: 66
    • View Profile
Re: Compiling on Fedora 15 x86_64
« Reply #2 on: October 11, 2011, 07:10:59 am »
OK, I've tried running ./configure instead pointing to the standard C API headers, with no success... also tried again with the path pointing to the 32 and 64 bit libmysqlclient binaries, just to make sure I'd checked all of the directory paths possible. Is ./configure searching for a header, or a .so? I would *think* that since ./configure --help prints that it will search the directory path supplied as well as dir/include and dir/lib that it would be looking for a header... not sure about that though.

Any suggestions?

P.S. I checked yum again... I have the most recent mysql-devel packages installed, both for 64 and 32-bit... although I would think that only the 64-bit package would be needed to build on a 64-bit processor.
« Last Edit: October 11, 2011, 07:18:20 am by Geceni »

weltall

  • Moderator
  • Veteran
  • *
  • Posts: 1671
    • View Profile
    • http://weltall.heliohost.org
Re: Compiling on Fedora 15 x86_64
« Reply #3 on: October 11, 2011, 08:40:11 am »
configure tries to compile a simple project calling  a function of mysqlclient library by using the -L -I flags pointing to your defined variables, if you've defined them, and -lmysqlclient. check config.log to know why it failed compiling

Geceni

  • Hydlaa Resident
  • *
  • Posts: 66
    • View Profile
Re: Compiling on Fedora 15 x86_64
« Reply #4 on: October 12, 2011, 12:20:43 am »
There were a couple of issues.
1) It wasn't finding the mysql headers. That error was resolved with --with-mysqlclient=/usr/include/mysql/
2) The second I'm still a bit puzzled by. Here's the output copied from config.log
Code: [Select]
configure:16703: checking if pkg-config recognizes mysqlclient
configure:16714: result: no
configure:16786: checking for mysqlclient-config
configure:16819: result: no
configure:17095: checking for libmysqlclient
configure:17175: gcc -o conftest -I/usr/include/mysql/include -DCS_MYSQLCLIENT_PATH=mysqlclient    -L/usr/include/mysql/lib   conftest.c -framework mysqlclient   >&5
gcc: error: mysqlclient: No such file or directory

(irrelevant output here - contents of source file it failed to compile)

configure:17175: gcc -o conftest -I/usr/include/mysql -DCS_MYSQLCLIENT_PATH=mysqlclient    -L/usr/include/mysql   conftest.c -framework mysqlclient   >&5
gcc: error: mysqlclient: No such file or directory

(irrelevant output here - more file contents)

configure:17175: gcc -o conftest -I/usr/include/mysql    -L/usr/include/mysql   conftest.c -lmysqlclient   >&5
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status

So it looks like gcc is searching for an executable called mysqlclient to link to, and is failing because it cannot find it? What exactly *is* this "mysqlclient" file supposed to be anyway? I tried creating a link called "mysqlclient" to /usr/lib64/mysql/libmysqlclient.so, and it still does not recognize it, so evidently it's looking for this file in the local directory, not the search path. Is it supposed to be /usr/lib64/mysql/libmysqlclient.so, or one of the other shared objects in the /usr/lib64/mysql/ directory?

Aiwendil

  • Hydlaa Citizen
  • *
  • Posts: 463
    • View Profile
Re: Compiling on Fedora 15 x86_64
« Reply #5 on: October 12, 2011, 02:34:43 am »
Code: [Select]
configure:17175: gcc -o conftest -I/usr/include/mysql/include -DCS_MYSQLCLIENT_PATH=mysqlclient    -L/usr/include/mysql/lib   conftest.c -framework mysqlclient   >&5
looks a lot like the MacOS way of trying to find mysqlclient. The "-framework" option should be only available in MacOS. More interesting is the following though:
Code: [Select]
configure:17175: gcc -o conftest -I/usr/include/mysql    -L/usr/include/mysql   conftest.c -lmysqlclient   >&5
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
This line looks like the linux test that determines if mysqlclient is available. And the "-L/usr/include/mysql" option is clearly wrong. This one should be "-L/usr/lib64". (or maybe "/usr/lib64/mysql" if the mysql .so files are in a subfolder for you). Sorry...no clue though how to make it like this. I find the directory structure you seem to have kind of strange. I can understand having a "mysql" subdir in "include"...but the "mysql" dir in "lib64" is strange for me. First off -with-mysqlclient should be used with "/usr"...configure then looks in "/usr/include" for the include files and "/usr/lib" for the libraries. But that won't solve your issues as it has to look in "/usr/lib/mysql" for the libraries...no real clue how to solve this. Making links from "/usr/lib/mysql" to "/usr/lib" might solve this...but not very elegant.

Also later on in the logfile you should have some CS config results looking something like this:
Code: [Select]
cs_cv_libmysqlclient=yes
cs_cv_libmysqlclient_cflags=
cs_cv_libmysqlclient_lflags=
cs_cv_libmysqlclient_libs=-lmysqlclient
...
cs_cv_prog_pkg_config_mysqlclient=no
...
cs_cv_with_mysqlclient=yes
Sorry...I really hate autoconf and don't know much about it so my interpretation might be very wrong (Didn't bother to look at the configure.ac file to see what they are really about):
cs_cv_libmysqlclient - Was mysqlclient found on your system
cs_cv_libmysqlclient_cflags - CFLAGS added to gcc when compiling mysql related stuff
cs_cv_libmysqlclient_lflags - LDFLAGS added to gcc/ld when linking mysql related stuff
cs_cv_libmysqlclient_libs - library added when linking mysql related stuff
cs_cv_prog_pkg_config_mysqlclient - Wild guess there...but looks like if pkg-config was used to figure out how to include mysql
cs_cv_with_mysqlclient - I guess no if "--without-mysqlclient" was given to configure

But in basic this means if you have something in "cs_cv_libmysqlclient_libs" and "cs_cv_libmysqlclient" and "cs_cv_with_mysqlclient" are "yes" for you mysql should be correctly configured for compiling.

Edit: okay...I'm too stupid to read a full code-paste. Reworked the post to fit

Edit2:
Okay..looked at configure.ac now.
Code: [Select]
# Check for MySQL
#----------------------------------------------------------------------------

CS_NOTABLE([mysql], [database], [], [$cs_cv_libmysqlclient],
    [CS_CHECK_LIB_WITH([mysqlclient],
[AC_LANG_PROGRAM([[#include <mysql.h>]],
[MYSQL mysql; mysql_init(&mysql);])], [/usr /usr/include/mysql|/usr/lib /usr/local/mysql /usr/include/mysql|/usr/lib/mysql /usr/local/include/mysql|/usr/local/lib/mysql /usr/lib /usr/local/mysql], [],
[CS_EMIT_BUILD_RESULT([cs_cv_libmysqlclient], [LIBMYSQLCLIENT])])])
This looks a lot as if configure already checks for includes in "/usr/include/mysql" and for libraries "/usr/lib/mysql"....so it should work for you without any problems at all. Any chance your linux distribution misses a symbolic link from "/usr/lib" to "/usr/lib64"?
« Last Edit: October 12, 2011, 02:51:02 am by Aiwendil »

Geceni

  • Hydlaa Resident
  • *
  • Posts: 66
    • View Profile
Re: Compiling on Fedora 15 x86_64
« Reply #6 on: October 12, 2011, 06:42:09 am »
Thanks Aiwendil! I followed your suggestion to make a link in /usr/lib/ to /usr/lib64/mysql/libmysqlclient.so.

The first thing I did was use yum to remove the i686 packages,since I don't need them anyway and their presence could only confuse things. I then ran:
Code: [Select]
ln -s /usr/lib64/mysql/libmysqlclient.so.18.0.0 libmysqlclient.so in /usr/lib/.

After these changes, ./configure was able to detect the presence of the mysqlclient library without even setting the --with-mysqlclient flag.

So, note to linux users... look out for missing links in /usr/lib/ to /usr/lib64/.

The server is now running just fine and dandy, and psnpcclient is re-compiling. :D

Thanks a million to both weltall and Aiwendil for your help on this.