2

I'm using clang, llvm to compile MySQL and do some analysis. But the link stage is very time consuming(+5min) and I actually do not need the final executable. Only interested in several object files, which are successfully generated before the linking.

What I tried is to export LD AR to /bin/true but it then cannot compile saying no rule to make target xx.a. In general, is there a way to modify the makefile(from automake) only compile but not link?

Oxdeadbeef
  • 1,033
  • 2
  • 11
  • 26
  • never mind. I solved this by only exporting LD to /bin/true – Oxdeadbeef Jul 08 '12 at 05:53
  • thanks for the suggestion. I was searching for a "close" option but didn't find it. seems i need to post answer first :) – Oxdeadbeef Jul 08 '12 at 09:02
  • For those who come here looking for the same question but CMake instead of Make: https://stackoverflow.com/questions/1867745/cmake-use-a-custom-linker , and the answer is `cmake -DCMAKE_CXX_LINK_EXECUTABLE=/bin/true`. – Quuxplusone Dec 24 '22 at 16:09

1 Answers1

3

Put my workaround here in case someone is having similar need.

What I did is to export LD to /bin/true so that the last link stage can quickly pass which essentially do nothing but return successfully.

Sometimes, the build system may not honor this ENV variable. In that case, temporarily change `which ld' to a script calling /bin/true(make sure keep the original ld and change it back afterwards!) or use alias ld=/bin/true (haven't tried this method though).

Oxdeadbeef
  • 1,033
  • 2
  • 11
  • 26