How do I determine the fastest link order?

前端 未结 4 625
小蘑菇
小蘑菇 2021-02-01 14:14

I have about 50 different static libraries being linked into my c++ project and the linking takes on average 70s.

I\'ve found that moving around with the link order of

4条回答
  •  猫巷女王i
    2021-02-01 14:52

    As an alternative, why not try compiling your libraries to shared libraries rather than static libraries?

    Where I work, one large projects link time was around 6 minutes, this was for only 5 libraries!

    My solution was (for a debug version), create .so files alphabetically (libA.so, libB.so etc) so each indivdual link wasn't too long, and the final link was much shorter, because all the (partial) linking had been done previously. The release version was built in the old fashioned way because there was a perceived 'danger' with my new method.

    I managed to get a 1 module compile/link cycle down from 6 minutes to 10 seconds using this method.

提交回复
热议问题