bcgsc / tigmint

⛓ Correct misassemblies using linked AND long reads
https://bcgsc.github.io/tigmint/
GNU General Public License v3.0
54 stars 13 forks source link

Cannot compile the bundled while modified copy of make: make-4.1/glob/glob.c:1342: undefined reference to `__alloca' #69

Closed mmokrejs closed 2 years ago

mmokrejs commented 2 years ago

Hi, yet another undocumented property of tigmint is that it uses it's own but modified copy of GNU make. Of course, over the years things have changed and make does not compile anymore:

gcc  -g -O2 -Wl,--export-dynamic  -o make ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o getopt.o getopt1.o guile.o implicit.o job.o load.o loadapi.o main.o misc.o output.o read.o remake.o rule.o signame.o strcache.o variable.o version.o vpath.o hash.o xml.o remote-stub.o glob/libglob.a   -ldl 
/usr/bin/ld: glob/libglob.a(glob.o): in function `glob_in_dir':
/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:1367: undefined reference to `__alloca'
/usr/bin/ld: /foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:1342: undefined reference to `__alloca'
/usr/bin/ld: foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:1256: undefined reference to `__alloca'
/usr/bin/ld: /foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:1283: undefined reference to `__alloca'
/usr/bin/ld: glob/libglob.a(glob.o): in function `glob':
/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:581: undefined reference to `__alloca'
/usr/bin/ld: glob/libglob.a(glob.o):/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:732: more undefined references to `__alloca' follow
collect2: error: ld returned 1 exit status

That's the reason why you should better submit the XML-patch to upstream and rely on an improved version.

  1. The fix for the compile issues was already invented a few times. https://github.com/osresearch/heads/issues/352
  2. Please update the README.md (as always) to make it clear the pipeline uses it's own make.
mmokrejs commented 2 years ago

And don't get trapped yourself with the the "rm -rf" zapping your patched version of make source tree:


tigmint-master $ make
make -C xml-patch-make
make[1]: Entering directory '/foo/tigmint-master/xml-patch-make'
rm -rf make-4.1
mkdir -p make-4.1
tar xvfz make-4.1.tar.gz -C make-4.1
...
mmokrejs commented 2 years ago

After you fix the previous compile error, there is one more:


gcc  -g -O2 -Wl,--export-dynamic  -o make ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o getopt.o getopt1.o guile.o implicit.o job.o load.o loadapi.o main.o misc.o output.o read.o remake.o rule.o signame.o strcache.o variable.o version.o vpath.o hash.o xml.o remote-stub.o glob/libglob.a   -ldl 
/blah/x86_64-pc-linux-gnu/bin/ld: glob/libglob.a(glob.o): in function `glob_in_dir':
/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:1269: undefined reference to `__stat'
/blah/x86_64-pc-linux-gnu/bin/ld: glob/libglob.a(glob.o): in function `glob':
/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:1036: undefined reference to `__stat'
/blah/x86_64-pc-linux-gnu/bin/ld: /foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:814: undefined reference to `__stat'
/blah/x86_64-pc-linux-gnu/bin/ld: /foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/glob/glob.c:960: undefined reference to `__stat'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:650: make] Error 1
make[3]: Leaving directory '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1'

https://github.com/osresearch/heads/pull/1035

lcoombe commented 2 years ago

Hi @mmokrejs,

Just to make sure I understand - you are running the Makefile in the main repo? (ie. executingmake`)?

To be honest, this is a file that Shaun (original developer of Tigmint, who has since moved on) generated around the time that we were working on the manuscript, and I've never even looked at it myself! I believe he used it for testing, but we have since integrated tests into our CI.

I'm personally inclined to just move it out of the main directory to a subdirectory so it isn't confusing for users because I don't really think it's necessary (Ie. I've deleted it on my end and everything still works fine). Would that be OK with you, or did you want to use it for a particular purpose?

mmokrejs commented 2 years ago

Yes, I execute main in the top-level directory, which recurses into ./xml-patch-make/make-4.1/make-4.1/ eventually. The issue we have too new glibc on the cluster. I assume it may be easier to update the xml-make patch to apply over more recent make sources. Or even better, try to get the changes accepted by upstream. But, if the xml-make is not necessary, I do not mind it to be deleted. But certainly it got executed for mme one:

tigmint-master$ patch -p1 < make-4.2.1.patch
...
patch -p1 < d77ffeda4fc5d25b47f778563e6b7842dfef317d.patch # well this one does not apply anymore
...
tigmint-master$ make

...

gcc  -g -O2 -Wl,--export-dynamic  -o make ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o getopt.o getopt1.o guile.o implicit.o job.o load.o loadapi.o main.o misc.o output.o read.o remake.o rule.o signame.o strcache.o variable.o version.o vpath.o hash.o remote-stub.o glob/libglob.a   -ldl
make[4]: Entering directory '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1'
 /usr/bin/mkdir -p '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/../bin'
  /usr/bin/install -c make '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/../bin/./xml-make4.1'
 /usr/bin/mkdir -p '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/../include'
 /usr/bin/install -c -m 644 gnumake.h '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/../include'
 /usr/bin/mkdir -p '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/../share/man/man1'
 /usr/bin/install -c -m 644 'make.1' '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1/../share/man/man1/xml-make4.1.1'
make[4]: Leaving directory '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1'
make[3]: Leaving directory '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1'
make[2]: Leaving directory '/foo/tigmint-master/xml-patch-make/make-4.1/make-4.1'
make[1]: Leaving directory '/foo/tigmint-master/xml-patch-make'
xml-patch-make/make-4.1/make-4.1/make --xml tigmint-make.xml -f bin/tigmint-make all
xml-patch-make/make-4.1/make-4.1/make: unrecognized option '--xml'
Usage: make [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
  -d                          Print lots of debugging information.
  --debug[=FLAGS]             Print various types of debugging information.
  -e, --environment-overrides
                              Environment variables override makefiles.
  --eval=STRING               Evaluate STRING as a makefile statement.
  -f FILE, --file=FILE, --makefile=FILE
                              Read FILE as a makefile.
  -h, --help                  Print this message and exit.
  -i, --ignore-errors         Ignore errors from recipes.
  -I DIRECTORY, --include-dir=DIRECTORY
                              Search DIRECTORY for included makefiles.
  -j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.
  -k, --keep-going            Keep going when some targets can't be made.
  -l [N], --load-average[=N], --max-load[=N]
                              Don't start multiple jobs unless load is below N.
  -L, --check-symlink-times   Use the latest mtime between symlinks and target.
  -n, --just-print, --dry-run, --recon
                              Don't actually run any recipe; just print them.
  -o FILE, --old-file=FILE, --assume-old=FILE
                              Consider FILE to be very old and don't remake it.
  -O[TYPE], --output-sync[=TYPE]
                              Synchronize output of parallel jobs by TYPE.
  -p, --print-data-base       Print make's internal database.
  -q, --question              Run no recipe; exit status says if up to date.
  -r, --no-builtin-rules      Disable the built-in implicit rules.
  -R, --no-builtin-variables  Disable the built-in variable settings.
  -s, --silent, --quiet       Don't echo recipes.
  -S, --no-keep-going, --stop
                              Turns off -k.
  -t, --touch                 Touch targets instead of remaking them.
  --trace                     Print tracing information.
  -v, --version               Print the version number of make and exit.
  -w, --print-directory       Print the current directory.
  --no-print-directory        Turn off -w, even if it was turned on implicitly.
  -W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
                              Consider FILE to be infinitely new.
  --warn-undefined-variables  Warn when an undefined variable is referenced.

This program built for x86_64-unknown-linux-gnu
Report bugs to <bug-make@gnu.org>
make: *** [Makefile:68: tigmint-make.xml] Error 2
tigmint-master$

I know all these Makefiles resemble those in abyss. Even zsh bug I reported after @sjackman added the timing feature while not documenting the new dependency. I was lazy to look up the old thread. ;-)

lcoombe commented 2 years ago

Thanks for the feedback, @mmokrejs! I did just go ahead and move that Makefile to tests so it's not in the top-level directory and hopefully won't cause confusion. Like I mentioned, I never used it myself! I'd suggest using our test demos at tests/test_installation if you want some data to test installations.

lcoombe commented 2 years ago

Closing - moved Makefile in question to tests directory to avoid it causing confusion.