Menu

#3 Wrong order of arguments in makefile, fails with ld --as-needed

v1.0 (example)
open
nobody
None
5
2014-02-08
2014-02-08
No

The included Makefile for unix has some problems:

  1. It adds -lm to the CFLAGS. -lm is a linker option and as such has no place in CFLAGS (which are used for compiler flags).
  2. Due to this, -lm appears on the command line way before any object files. This leads to it being discarded when the linker flag --as-needed is set. An example failure can be observed under Ubuntu:

/«PKGBUILDDIR»/grammyVM.c:1498: undefined reference to `log10'

To solve this I did:

a) Add -lm to LDLIBS
b) Added LDLIBS at the end of the command line

Makefile attached.

1 Attachments

Discussion


Log in to post a comment.

MongoDB Logo MongoDB