📜 ⬆️ ⬇️

Apt-build. Non-working optimization.

Crossposting from the blog

Again, do not kick, it's just a thought.

So there is such a wonderful apt-build project. It is remarkable that it was created with a good purpose, namely: rebuilding binary packages under the machine | architecture | processor | with the necessary optimizations. Basically cool!
What is the divorce?
')
UPD: With the help of the community safely understood the work of apt-build. Optimization occurs. But not entirely explicit way. Under the cut details.



And that no optimization happens. At all. In fact, apt-build rebuilds the package to the level of the package in the repository, that is, it works to heat the room. Why does this happen? And because the configuration file apt-build.conf is put with the device. And all the optimizations that you have written there are not used. You can easily see this if you take a closer look at the output of the script at the beginning of the work, at the moment of assigning values ​​to the variables “CFLAGS”, “CXXFLAGS”

---

dpkg-buildpackage: CFLAGS : -g -O2
dpkg-buildpackage: CPPFLAGS :
dpkg-buildpackage: LDFLAGS : -Wl,-Bsymbolic-functions
dpkg-buildpackage: FFLAGS : -g -O2
dpkg-buildpackage: CXXFLAGS : -g -O2

---


Aha not at all what we say in the config

#cat /etc/apt/apt-build.conf

build-dir = /var/cache/apt-build/build
repository-dir = /var/cache/apt-build/repository
Olevel = -O3
mtune = -mtune=core2
options = "-pipe -fomit-frame-pointer "
make_options = " -j2"


Google is crammed (at least in RuNet) with a link to the same article about "how to optimize debian", by the way, it also exists on the Habré, in the apt-build part it’s absolutely crazy, where the author left the default O2 optimization, and I did not bother to check whether it works at all. A couple of posts on the case on the forums as a result does not lead to anything, people do not know how to solve it (it may not be for nothing that the man says “BUGS: Many”;)

In general, the only solution, and I don’t know how efficient (testing) it is to apt-build source code, unpack it. Then use your hands in debian / rules to change the flags to taste, and then continue the build.

like

#apt-build --noupdate --source build-source firefox

rule debian / rules

#apt-build --reinstall --yes --noupdate --source install firefox

--reinstall - This is because my firefox is already worth it.

UPD : In vain the water was mutil. In fact, just read the documentation.

Q: gcc and g ++ options!

A: *** They are called with them! ***
What is your command?
the wrapper wraps (yeah, it does) calls to gcc / g ++ and adds options you
specified in the apt-build configuration file.
You will not see this on your screen.
Try `ps ax | grep gcc 'instead of a proof, while building.

I apologize ... On the other hand, we understood ... I do not think that everyone knew about the specifics of apt-build.

Source: https://habr.com/ru/post/55961/


All Articles