Comment 21 for bug 2002043

Revision history for this message
Fabio Augusto Miranda Martins (fabio.martins) wrote :

Alright, thanks for the information @Steve.

Hi @Nafees,

With the information above, it seems there's a regression risk if we fix this bug in python2.7 in Focal, and the risk outstands the benefits of the fix, as it seems to be an uncommon use-case and there's a workaround for it, so we wouldn't be able to apply the patch.

As a workaround, you can:

1. Export the desired CFLAGS in ~/.bashrc:

i.e.:

export CFLAGS="-fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-vvQ8AI/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security"

2. Source .bashrc and compile:

ubuntu@ip-172-31-43-65:~/testprog$ source ~/.bashrc
ubuntu@ip-172-31-43-65:~/testprog$ python2 setup.py build_ext --inplace
running build_ext
building 'test' extension
aarch64-linux-gnu-gcc -pthread -fno-strict-aliasing -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-vvQ8AI/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c testmodule.c -o build/temp.linux-aarch64-2.7/testmodule.o
creating build/lib.linux-aarch64-2.7
aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-vvQ8AI/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-vvQ8AI/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC build/temp.linux-aarch64-2.7/testmodule.o -o build/lib.linux-aarch64-2.7/test.so
copying build/lib.linux-aarch64-2.7/test.so ->

3. You will have the desired CFLAGS:

ubuntu@ip-172-31-43-65:~/testprog$ strings build/lib.linux-aarch64-2.7/test.so | grep -- -O
GNU C17 9.4.0 -mlittle-endian -mabi=lp64 -g -g -O2 -fno-strict-aliasing -fwrapv -fstack-protector-strong -fPIC -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection

Would that work for you moving forward?

Regards,
Fabio Martins