I'm building PHP7 on an OpenWRT machine (an ARM router). I wanted to include MySQL, so I had to build that as well. OpenWRT is 99.5% ordinary linux, but there are some weird building / shared library things that probably don't get exercised often, so I've run into some difficulties.
MySQL builds OK (after some screwing around) and I have a libmysqlclient.so
that works. However, the configure
process for PHP7 fails when trying to link the MySQL test program, because libmysqlclient.so
must be linked with the C++ standard libraries, not the C standard libs. (MySQL is apparently at least partially C++, and it uses std::...stuff...
.) Configure
tries to compile the test program with gcc
, which doesn't include the C++ libraries in the link, so the test fails.
I bodged over this by making a simple C/C++ switching script: if the command line includes -lmysqlclient
then I exec g++ $*
else exec gcc $*
. Then I told configure
to use my script as the C compiler.
It occurs to me that there must be a better way to handle this, though. It seems like libmysqlclient.so
should have some way to tell the linker that it also needs libstdc++.so
, so that even if gcc
is used to link, all the necessary libraries would get pulled in.
Is there some way to mark dependencies in libmysqlclient.so
? Or to make configure
smarter about running test programs?