No code optimization in Makefile
bol-van opened this issue · comments
No -O2, -O3. 'make' produces unoptimized, big and slow code.
Use make DEBUG=no
to produce binary with optimizations.
I don't think it's a good idea to make DEBUG by default.
In compile guide there's no indication that DEBUG=no is required for production builds.
https://i2pd.readthedocs.io/en/latest/devs/building/unix/
Following instruction a user gets bad binary
I agree that documentation should be improved.
By the way, it is located in repository nearby:
https://github.com/PurpleI2P/i2pd_docs_en
If user build binary himself, I assume that user do it not just for fun. That's why debug is enabled by default.
User can do it for many reasons. For example, I do it because I use debian sid (unstable) , you do not have builds for sid, and mainteiners do not update i2pd fast.
Most programs expect configure/make to build, that's what most users expect
Use debuild --no-tgz-check -us -uc -b
as described in documentation for Debian/Ubuntu.
In my cases (Bullseye, Bookworm) was -O2:
g++ -g -O2 -ffile-prefix-map=/home/user1/i2pd=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -std=c++17 -fPIC -maes -MMD -MP -DUSE_UPNP -D__AES__ -DOPENSSL_SUPPRESS_DEPRECATED -DGITVER=2.50.1-7-g c5cab05a -Ilibi2pd -Ilibi2pd_client -Ii18n -c -o obj/libi2pd/api.o libi2pd/api.cpp
Sure, there're many ways to make it properly.
I just emphasized that standard build way does not produce expected result as it does in most other programs