Bug #40047 automake should pick up $(CXX) to link libndbclient.
Submitted: 15 Oct 2008 12:57 Modified: 16 Oct 2008 19:08
Reporter: Igor Vlasenko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.28, 5.1.28-ndbcluster-6.3.18 OS:Linux
Assigned to: Sveta Smirnova CPU Architecture:Any
Tags: automake, C++, Contribution, libndbclient, linkage

[15 Oct 2008 12:57] Igor Vlasenko
Description:
libndbclient was tried to be linked with $(CC), not $(CXX).

I do know that it is recommended to define CXX=gcc for build,
but in my case $(CXX) was g++, and linkage of libndbclient.so
with $(CC) set to gcc had failed.

after applying a patch below (officially suggested by 
automake manual (Libtool-Convenience-Libraries.html, How-the-Linker-is-Chosen.html))
libndbclient was linked successfully.

It is safe to apply this patch, 
because if trick with CXX=gcc is used, it does not matter.

But 
1) it does help for "naive build":
./configure; make; make install

2) Also, there is a possibility that some new code will 
require CXX to be set to g++. So it is safe to keep
the code ready.

How to repeat:
It is an experimental package for ALt Linux.
http://git.altlinux.org/people/viy/packages/?p=MySQL.git;a=summary
Proposed patch is Patch2. 
Disabling it fails the build.

Suggested fix:
as recommended at
http://www.gnu.org/software/automake/manual/html_node/Libtool-Convenience-Libraries.html

--- mysql-5.1.28/storage/ndb/src/Makefile.am	2008-10-12 19:55:54 +0000
+++ mysql-5.1.28/storage/ndb/src/Makefile.am	2008-10-12 20:11:52 +0000
@@ -20,6 +20,8 @@
 ndblib_LTLIBRARIES = libndbclient.la
 
 libndbclient_la_SOURCES =
+# Dummy C++ source to cause C++ linking.
+nodist_EXTRA_libndbclient_la_SOURCES = dummy.cxx
 
 libndbclient_la_LDFLAGS = -version-info @NDB_SHARED_LIB_VERSION@ @NDB_LD_VERSION_SCRIPT@
[16 Oct 2008 9:03] Sveta Smirnova
Thank you for the report.

Please indicate which exact version of gcc you use and exact error you get: having $(CXX)=g++ works fine for me.
[16 Oct 2008 19:08] Igor Vlasenko
After update I no more can reproduce the problem, so it is not a problem :)
It looks like a bug in toolchain, not in MySQL.
thanks!