Opened 4 years ago

Closed 4 years ago

#61299 closed defect (fixed)

python3x: -Wno-unused-result in _sysconfigdata__darwin_darwin.py unrecognized by gcc 4.2

Reported by: chrstphrchvz (Christopher Chavez) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc: tobypeterson
Port: python37 python38 python39 py-cchardet py-pycryptodome py-fann2

Description (last modified by chrstphrchvz (Christopher Chavez))

python37, python38, and python39 ports build using -Wno-unused-result; this argument gets saved in CFLAGS and other variables in _sysconfigdata__darwin_darwin.py, and is used again when building ports for Python modules. On macOS 10.6, Python itself is built using an alternative compiler (e.g. MacPorts' clang 3.7 or clang 9.0) which recognizes -Wno-unused-result, but modules (e.g. py3x-cchardet) might try to build using a system compiler (e.g. gcc 4.2) which doesn't recognize the option:

/usr/bin/gcc-4.2 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -isysroot/ -Isrc/ext/uchardet/src -I/opt/local/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/cchardet/_cchardet.cpp -o build/temp.macosx-10.6-x86_64-3.9/src/cchardet/_cchardet.o
cc1plus: error: unrecognized command line option "-Wno-unused-result"

Possibly related to #56458. (I personally am not using macOS 10.6.)

Change History (12)

comment:1 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Port: py-cchardet added; py-chardet removed

comment:2 Changed 4 years ago by kencu (Ken)

other than bootstrapping, or a few ports needed to bootstrap clang-9.0, like clang-3.7, every build on 10.6.8 should be using clang-9.0 to build.

I think the question might be how could py3x-cchardet be using the ancient gcc-4.2 and let's fix that if possible.

(I am using 10.6, all day, every day, and have never seen any such error with thousands of ports installed, by the way.)

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:3 in reply to:  2 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Port: py-fann2 added

py38-fann2 is another example:

/usr/bin/gcc-4.2 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -isysroot/ -DSWIG_COMPILE -I./include -I../include -Iinclude -I/opt/local/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c fann2/fann2_wrap.cxx -o build/temp.macosx-10.6-x86_64-3.8/fann2/fann2_wrap.o
cc1plus: error: unrecognized command line option "-Wno-unused-result"

Replying to kencu:

other than bootstrapping, or a few ports needed to bootstrap clang-9.0, like clang-3.7, every build on 10.6.8 should be using clang-9.0 to build.

Why is this not the case on the 10.6 builders?

comment:4 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Description: modified (diff)
Port: python39 py-pycryptodome added; python36 removed

python39 is affected; python35 and python36 are not affected.

py37-pycryptodome and py38-pycryptodome are additional examples of ports failing to build on 10.6 because of this issue.

comment:5 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

In 2e5437a827f9ce39f7322bbcf00b7ca6f0063998/macports-ports (master):

py-cchardet: drop noarch, workaround GCC error

Port installs architecture-specific shared library built from
Cythonized code.

Avoid unrecognized command line option "-Wno-unused-result" error
See: #61299

py27-cchardet: fix distname

comment:6 Changed 4 years ago by kencu (Ken)

I see that you pushed this through, although you don't use 10.6 or any older systems, you say.

blacklisting all gcc compilers is not the right fix for this problem.

comment:7 Changed 4 years ago by jmroot (Joshua Root)

Just removing noarch would have caused the right compiler to be picked.

comment:8 Changed 4 years ago by kencu (Ken)

Chris -- can you fix these again please?

comment:9 in reply to:  7 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Replying to jmroot:

Just removing noarch would have caused the right compiler to be picked.

Thanks for pointing this out. Even though the examples I noticed so far all used noarch inappropriately, that being the cause of this issue was not obvious to me. I'm fine with this being closed.

comment:10 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

In 2fcfce40f95637821c0a5c286eeb5097bd640dfd/macports-ports (master):

py-cchardet: do not blacklist compilers (https://github.com/macports/macports-ports/pull/8722)

Removing noarch was sufficient
See: #61299#comment:7

comment:11 Changed 4 years ago by kencu (Ken)

thank you

comment:12 Changed 4 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.