Bug 240492 - graphics/glew: Respect CFLAGS (unexpected optimizations in debug build)
Summary: graphics/glew: Respect CFLAGS (unexpected optimizations in debug build)
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2019-09-11 08:17 UTC by Jan Beich
Modified: 2022-05-02 15:43 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)
koobs: merge-quarterly?


Attachments
blind fix (663 bytes, patch)
2019-09-11 08:17 UTC, Jan Beich
koobs: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2019-09-11 08:17:18 UTC
Created attachment 207372 [details]
blind fix

Mk/bsd.port.mk strips -O* flags by default when building WITH_DEBUG. If user wants optimized debug build it should pass -g manually and define empty STRIP.

$ make WITH_DEBUG=
[...]
cc -DGLEW_NO_GLU -DGLEW_BUILD -pipe  -g -fstack-protector-strong -fno-strict-aliasing  -O2 -Wall -W -Iinclude -I/usr/local/include -fPIC  -o tmp/freebsd/default/shared/glew.o -c src/glew.c
cc -DGLEW_NO_GLU -DGLEW_STATIC -pipe  -g -fstack-protector-strong -fno-strict-aliasing  -O2 -Wall -W -Iinclude -I/usr/local/include -fPIC  -o tmp/freebsd/default/static/glew.o -c src/glew.c
cc -DGLEW_NO_GLU -pipe  -g -fstack-protector-strong -fno-strict-aliasing  -O2 -Wall -W -Iinclude -I/usr/local/include -fPIC -o tmp/freebsd/default/shared/glewinfo.o -c src/glewinfo.c
cc -DGLEW_NO_GLU -pipe  -g -fstack-protector-strong -fno-strict-aliasing  -O2 -Wall -W -Iinclude -I/usr/local/include -fPIC -o tmp/freebsd/default/shared/visualinfo.o -c src/visualinfo.c

Alternatively, a user may want to increase optimizations. To take effect CFLAGS from the ports framework have to be passed after vendor CFLAGS.

$ CFLAGS=-Ofast make
[...]
cc -DGLEW_NO_GLU -DGLEW_BUILD -Ofast  -fstack-protector-strong -fno-strict-aliasing  -O2 -Wall -W -Iinclude -I/usr/local/include -fPIC  -o tmp/freebsd/default/shared/glew.o -c src/glew.c
cc -DGLEW_NO_GLU -DGLEW_STATIC -Ofast  -fstack-protector-strong -fno-strict-aliasing  -O2 -Wall -W -Iinclude -I/usr/local/include -fPIC  -o tmp/freebsd/default/static/glew.o -c src/glew.c
cc -DGLEW_NO_GLU -Ofast  -fstack-protector-strong -fno-strict-aliasing  -O2 -Wall -W -Iinclude -I/usr/local/include -fPIC -o tmp/freebsd/default/shared/glewinfo.o -c src/glewinfo.c
cc -DGLEW_NO_GLU -Ofast  -fstack-protector-strong -fno-strict-aliasing  -O2 -Wall -W -Iinclude -I/usr/local/include -fPIC -o tmp/freebsd/default/shared/visualinfo.o -c src/visualinfo.c

https://www.freebsd.org/doc/en/books/porters-handbook/dads-cflags.html
Comment 1 Jan Beich freebsd_committer freebsd_triage 2019-09-11 08:25:08 UTC
Comment on attachment 207372 [details]
blind fix

Not enough for debug build. The library must NOT be stripped.

$ make install WITH_DEBUG=
$ file -L /usr/local/lib/libGLEW.so
/usr/local/lib/libGLEW.so: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, stripped

https://www.freebsd.org/doc/en/books/porters-handbook/install.html#install-strip
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-11 10:03:28 UTC
Comment on attachment 207372 [details]
blind fix

Approved by: portmgr (blanket: ports/framework compliance)
Comment 3 Jan Beich freebsd_committer freebsd_triage 2019-09-11 10:25:26 UTC
Comment on attachment 207372 [details]
blind fix

I've filed this bug because I'm not familar nor have time to dig into this port. My fix is NOT complete.
Comment 4 Rene Ladan freebsd_committer freebsd_triage 2022-05-02 10:46:56 UTC
Maintainer reset.
Comment 5 Rene Ladan freebsd_committer freebsd_triage 2022-05-02 10:47:08 UTC
Maintainer reset.