Bug #8979 Build defect disables RAID feature for max builds
Submitted: 5 Mar 2005 16:14 Modified: 16 Mar 2005 19:25
Reporter: Kent Boortz Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:all OS:Any (all)
Assigned to: CPU Architecture:Any

[5 Mar 2005 16:14] Kent Boortz
Description:
We mix objects compiled from C and C++ in our libraries.
This means that automake not always knows how to link
executables, if to use CCLD or CXXLD in the make files.
The program 'isamchk' is linked using CCLD, but for a max
build with --raid it will link in C++ object files that need
new/delete.

For gcc builds we actually use gcc, not g++, for compiling
and linking C++ code and objects. This means we reduce
the run time dependency of C++ libraries the users might
not have installed on his system.

To overcome the need for new/delete, for gcc we add to 
CFLAGS and CXXFLAGS the define -DHAVE_MYSYS_NEW.
This makes most link problems for 'isamchk' go away.
But there are still cases where it don't.

For non gcc builds where we use the native C and C++
compilers, the use of --raid should not cause any problems,
as we use the vendor C++ libraries that contain new/delete.
But when linking 'isamchk' with CCLD the C compiler is
used for the linking, that know nothing about new/delete.

How to repeat:
Compile on Solaris using CC=c-5.0 CXX=CC, and configure with --with-isam, --raid.

Suggested fix:
There are several ways to solve this

  A) Convince automake that 'isamchk' should
      be linked with CXXLD.

  B) Rewrite the RAID support not to use C++.

  C) Add to LDFLAGS the vendor C++ library that
      is needed.

  D) Don't compile with RAID support on platforms
      with compile problems.

Personally I prefer B first, A second. C and D are not
good options.

If this is a 4.0 problem only, as ISAM isn't compiled
in by default for newer releases, then B is of course
overkill. Then A or D seems reasonable.
[5 Mar 2005 21:10] Kent Boortz
It is tempting to use the only documented way I can find on

  http://www.gnu.org/software/automake/manual/html_mono/automake.html

To add to "isam/Makefile.am" the line

  isamchk_LINK = $(CXXLD) -o $@

Trouble is, this will bypass libtool, i.e. it will not give a
command line similar to what automake would give for
a C++ link. This is a defect in automake I think, that the 
only way to specify what linker to use, is that there is a 
C++ file in the 'isamchk_SOURCES' define. Ugly, but we 
could of course rename "isamchk.c" to "isamchk.cc" or
link with a dummy C++ file.
[16 Mar 2005 19:25] Brian Aker
Almost no one uses this. We will remove it in 5.1.

Agreement came from Monty, Brian, and Peter Z.
[16 Mar 2005 19:35] Brian Aker
Sorry, we will remove this in 5.0.