Bug #8149 make fails: No rule to make target
Submitted: 26 Jan 2005 18:51 Modified: 26 Jul 2006 17:34
Reporter: Bob Russell Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:4.1.9 OS:Solaris (Solaris 2.6)
Assigned to: Guilhem Bichot CPU Architecture:Any

[26 Jan 2005 18:51] Bob Russell
Description:
make fails with the following error:

Making all in libmysql_r
gnumake[2]: Entering directory `/usr2/home/rsr3/mysql-4.1.9/libmysql_r'
gnumake[2]: *** No rule to make target `my_init.lo', needed by `libmysqlclient_r.la'.  Stop.
gnumake[2]: Leaving directory `/usr2/home/rsr3/mysql-4.1.9/libmysql_r'
gnumake[1]: *** [all-recursive] Error 1
gnumake[1]: Leaving directory `/usr2/home/rsr3/mysql-4.1.9'
gnumake: *** [all] Error 2

How to repeat:
using 

gnumake 3.79.1
gcc 3.2.2

Ran this script from the top level of the mysql source distribution directory:

#! /usr/bin/ksh
export CC=gcc
export CXX=gcc
export PATH="/usr/pge2/gcc/bin:$PATH"
export CFLAGS="-O3"
export CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
./configure '--prefix=/usr/local/mysql' '--localstatedir=/usr/local/mysql/data' '--libexecdir=/usr/local/mysql/bin' '--with-comment=PGE MySQL-standard binary' '--with-extra-charsets=complex' '--with-server-suffix=-standard' '--enable-thread-safe-client' '--enable-local-infile' '--with-named-z-libs=no' '--disable-shared' '--with-readline' '--with-embedded-server' '--with-innodb' '--with-low-memory' '--enable-assembler'

Then ran

gnumake

and received the error listed in the problem description.

Suggested fix:
None.
[26 Jan 2005 19:14] Ido Dubrawsky
I'm also seeing this on Sun Solaris 9 (SPARC) with the following environment:

[idubraws@elrond mysql-4.1.9]
4 $ make --version
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
[idubraws@elrond mysql-4.1.9]
5 $ gcc --version
gcc (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[idubraws@elrond mysql-4.1.9]
6 $ ./configure --prefix=/opt/depot/mysql-4.1.9 --with-openssl=/opt/depot/openssl-0.9.7e --with-openssl-includes=/opt/depot/openssl-0.9.7e/include --with-openssl-libs=/opt/depot/openssl-0.9.7e/lib --with-tcp-port=3306 --with-zlib-dir=/opt/depot/zlib-1.2.1 --with-unix-socket-path=/tmp/mysql.sock --with-mysqld-user=mysqld

The build fails with the following:

 gcc -DDEFAULT_CHARSET_HOME=\"/opt/depot/mysql-4.1.9\" -DDATADIR=\"/opt/depot/my
sql-4.1.9/var\" -DSHAREDIR=\"/opt/depot/mysql-4.1.9/share/mysql\" -DUNDEF_THREAD
S_HACK -DDONT_USE_RAID -I. -I. -I.. -I../include -I/opt/depot/openssl-0.9.7e/inc
lude -I/opt/depot/zlib-1.2.1/include -O3 -DDBUG_OFF -D_FILE_OFFSET_BITS=64 -DHAV
E_RWLOCK_T -MT errmsg.lo -MD -MP -MF .deps/errmsg.Tpo -c errmsg.c  -fPIC -DPIC -
o .libs/errmsg.o
 gcc -DDEFAULT_CHARSET_HOME=\"/opt/depot/mysql-4.1.9\" -DDATADIR=\"/opt/depot/my
sql-4.1.9/var\" -DSHAREDIR=\"/opt/depot/mysql-4.1.9/share/mysql\" -DUNDEF_THREAD
S_HACK -DDONT_USE_RAID -I. -I. -I.. -I../include -I/opt/depot/openssl-0.9.7e/inc
lude -I/opt/depot/zlib-1.2.1/include -O3 -DDBUG_OFF -D_FILE_OFFSET_BITS=64 -DHAV
E_RWLOCK_T -MT errmsg.lo -MD -MP -MF .deps/errmsg.Tpo -c errmsg.c -o errmsg.o >/
dev/null 2>&1
make[2]: *** No rule to make target `my_init.lo', needed by `libmysqlclient.la'. Stop.
make[2]: Leaving directory `/export/home/idubraws/src/mysql-4.1.9/libmysql'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/export/home/idubraws/src/mysql-4.1.9'
make: *** [all] Error 2
[26 Jan 2005 20:31] Guilhem Bichot
Hello.
Please, where does the source come from? Did you download a source .tar.gz, untar it and then ./configure etc. Or did you get the source using BitKeeper ('bk pull').
Just in case it was from BitKeeper: we think there is a bug in BitKeeper which sometimes wipes checked-out copies out, thus making some files missing; 'bk -r get -Sq' looks like fixing it, and then ./configure can be called with success.
Let us know.
[26 Jan 2005 20:37] Bob Russell
The source code I used was the downloaded tarball mysql-4.1.9.tar.gz.
[28 Jan 2005 15:46] Bob Russell
I provided the requested feedback on 26 Jan 9:37pm, but the bug report still shows a status of "need feedback".  I'm not sure how to indicate the feedback was provided, but am hoping this entry will do it.
[28 Jan 2005 22:03] Guilhem Bichot
It just worked from me with this same .tar.gz and the same "configure" line, except that I didn't change PATH.
As a workaround, could you please try this, in the decompressed source tree where you compile:
cd libmysql/
ln -s ../mysys/my_init.c my_init.c
cd ..
and retry 'gnumake'?
Thanks.
[28 Jan 2005 22:09] Guilhem Bichot
The "ln" command I gave is normally in the Makefile; it is weird that it didn't execute in your case. It is present in the libmysql/Makefile.in shipped in the .tar.gz.
In any case, let's first see if the "ln" fixes the problem.
[28 Jan 2005 22:29] Bob Russell
I created the soft link as requested, and reran gnumake (without doing a "gnumake clean" or "gnumake distclean" first), and got the same error as before.

I looked at Makefile, Makefile.in, Makefile.am and Makefile.shared.  None of them have any reference to my_init.c.  The only references to my_init.<anything> are to my_init.lo.  The time stamps for Makefile.* are all Jan 11 14:06 (PST = GMT-8).
[28 Jan 2005 22:53] Guilhem Bichot
Was the error in the exact same dir: libmysql ? exact same message?
(I'm asking because the lack of libmysql_r/my_init.c could make the compilation of libmysql_r fail too, but I expected libmysql/ to work now).
There should be something like this in libmysql/Makefile:
link_sources:
for f in $$ms $(mysysheaders); do \
	    rm -f $(srcdir)/$$f; \
	    /bin/ln -s $(srcdir)/../mysys/$$f $(srcdir)/$$f; \
	  done; 
Now, ms is:
ms=`echo $(mysysobjects) | sed "s;\.lo;.c;g"`; \
and mysysobjects:
mysysobjects = $(mysysobjects1) $(mysysobjects2)
and mysysobjects1:
mysysobjects1 = my_init.lo ...
So it takes the string my_init.lo, replaces .lo by .c, makes my_init.c and does:
/bin/ln -s $(srcdir)/../mysys/my_init.c $(srcdir)/my_init.c;
normally :)
The link_sources target is called only by "make" in the top directory (just above libmysql/, that's why one needs to cd .. to see if the ln helps).
Problem can be 'sed' not working, srcdir badly set in Makefile,  link_sources not called...
If ln really does not help, I would suggest:
cd libmysql; make clean; cd ..;
'make -n' (in the top directory) to see if link_sources is made.
[29 Jan 2005 13:19] Guilhem Bichot
Bob:
I tested on Solaris 9 (== SunOS 5.9) and it built ok, with your configure line.
Could you please paste here the output of this (just to be sure):
chdir libmysql/
ln -s ../mysys/my_init.c my_init.c
chdir ..
pwd
gnumake
?
[29 Jan 2005 13:24] Guilhem Bichot
P.S.: I used same make as you:
GNU Make 3.80
[29 Jan 2005 14:08] Dean Grimes
Hi,

I'm having the same problem on SCO OperServer5 on all versions 5.0.X.

 gcc -DDEFAULT_CHARSET_HOME=\"/d/mysql\" -DDATADIR=\"/d/mysql/var\" -DSHAREDIR=\
"/d/mysql/share/mysql\" -DUNDEF_THREADS_HACK -DDONT_USE_RAID -I. -I. -I.. -I../i
nclude -O3 -DDBUG_OFF -DSCO -c errmsg.c -Wp,-MD,.deps/errmsg.TPlo -o errmsg.o >/
dev/null 2>&1
make[2]: *** No rule to make target `my_init.lo', needed by `libmysqlclient.la'.
  Stop.
make[2]: Leaving directory `/d/cdev/mysql-4.1.9/libmysql'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/d/cdev/mysql-4.1.9'
make: *** [all] Error 2

Thanks,
Dean
[29 Jan 2005 22:20] Guilhem Bichot
Hi,

The symbolic links:

[guilhem 23:17 /m/logiciels/mysql-4.1.9] ll libmysql*/my_init.c
lrwxrwxrwx  1 guilhem users 20 2005-01-29 23:17 libmysql/my_init.c -> ./../mysys/my_init.c
lrwxrwxrwx  1 guilhem users 21 2005-01-29 23:17 libmysql_r/my_init.c -> ../libmysql/my_init.c

are created the first time "make" is run *in the top directory*. Only the first time, or until "make clean" is done (then at next "make" the symlinks will be re-created).
What triggers the creation of symlink is the absence of files named linked_*_sources in the top directory:

[guilhem 23:17 /m/logiciels/mysql-4.1.9] ll linked_*_sources
-rw-r--r--  1 guilhem users 10 2005-01-29 23:17 linked_libmysql_r_sources
-rw-r--r--  1 guilhem users 10 2005-01-29 23:17 linked_libmysql_sources
<cut>

Those files above are not in mysql-4.1.9.tar.gz. When "make" runs for the first time in top-directory, it will creates those files and the symlinks.
If those files above exist when later "make" runs in the top directory, symlinks are not created (assumption is they already were). "make clean" in top directory removes linked_*_sources.
For example if one does:
download mysql-4.1.9.tar.gz
./configure; make # creates symlinks and creates linked_*_sources files
cd libmysql; make clean # deletes my_init.c symlink
make; # failure
cd ..; make # won't recreate the deleted symlink so failure.

So, normally this should work:
cd top-directory; make clean; make 
does it work for any of you? If not, when "make" fails (please paste error), do the symlinks "my_init.c" exist in libmysql and libmysql_r? do the linked_*_sources files exist in top directory?
[30 Jan 2005 22:31] Guilhem Bichot
Another scenario for failure:
make;
make clean Control-C (interruption after removing the symlinks but before removing the linked_*_sources files)
make; # symlinks not remade, error
[31 Jan 2005 21:35] Dean Grimes
Further investigation revealed an interesting anomaly:

If I run 'make distclean' I will get the 'No rule to make target' error, but if I completely remove the mysql-4.1.9 tree and un-tar fresh, everything will compile.
[1 Feb 2005 10:56] Guilhem Bichot
Hi,
Whether it's the same error at "make distclean" depends on the target which is reported in the "no rule to make target". For example, in "make distclean" I expect it to be "no rule to make target distclean" which is not the same thing as "no rule to make target my_init.lo".
make -k distclean
should remove everything necessary.
Then ./configure then make.
[2 Feb 2005 16:42] Bob Russell
Please note that I had done a "gnumake distclean" prior to the configure and gnumake I first reported.   I did not interrupt the distclean, and also did not use the -k switch with gnumake (but the distclean didn't end with an error, so that shouldn't have mattered).

After creating the soft link to my_init.c as suggested, make failed at the same point when a couple of include files could not be found.  I created soft links to them, and retried, again getting a compilation error at the same point.  So I deleted the distribution entirely, untarred it again, and did configure and gnumake on the clean distribution.  This resulted in a successful make and make install, and I now have the installed binaries running, although I have done very little testing of the binaries at this point.

It looks to me as though the problem is with distclean.
[3 Mar 2005 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[31 Mar 2005 9:54] Guilhem Bichot
I committed something which will at least remove the problem of interrupting "make distclean" before it's done. But I remember this was not the problem here.
Maybe if you compile 4.1.11 (to be released in April), please save the entire output ("script some.trace.file") from the extraction of the tar, to the compilation failure (my_init.c complain), and upload the trace in the "Files" section in this bug report. If we have this trace, it's very likely that we can fix the problem.
Thank you very much.
[1 May 2005 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".