Clem Wang created PYLUCENE-56:
---------------------------------
Summary: Can't build JCC on Mac
Key: PYLUCENE-56
URL: https://issues.apache.org/jira/browse/PYLUCENE-56
Project: PyLucene
Issue Type: Bug
Environment: MacOSX 10.15.7, Intel Core i7, Python 3.8.2, gcc
(Homebrew GCC 10.2.0_3) 10.2.0
following the instructions here:
http://lucene.apache.org/pylucene/jcc/install.html
svn co https://svn.apache.org/repos/asf/lucene/pylucene/trunk/jcc jcc
Checked out revision 1886645.
Reporter: Clem Wang
This is puzzling to me, as I can't figure out how the failing gcc command line
gets its arguments (mostly). I found one problem in the setup.py, but I can't
find the error causing strings anywhere in the files in the jcc directory of
sub directory.
Steps:
{code:java}
svn co https://svn.apache.org/repos/asf/lucene/pylucene/trunk/jcc jcc
Checked out revision 1886645.
cd jcc
python setup.py build
{code}
...
/opt/local/bin/gcc -Wno-unused-result -Wsign-compare -Wunreachable-code
-fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall
{color:#FF0000}*-iwithsysroot/*{color}System/Library/Frameworks/System.framework/PrivateHeaders
{color:#FF0000}*-iwithsysroot/*{color}Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers
{color:#FF0000}*-arch arm64*{color} -arch x86_64
-I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -dynamiclib -D_jcc_lib
-DJCC_VER="3.8"
-I/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include
-I/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include/darwin
-I_jcc3 -Ijcc3/sources -I/Users/cwang/3.7/include
-I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8
-c jcc3/sources/jcc.cpp -o
build/temp.macosx-10.14.6-x86_64-3.8/jcc3/sources/jcc.o -DPYTHON
-fno-strict-aliasing -Wno-write-strings -mmacosx-version-min=10.9 -std=c++11
{color:#FF0000}*-stdlib=libc++*{color}
which generates 4 errors due to the parts marked above in red bold:
*gcc:* *error:* this compiler does not support arm64
*gcc:* *error:* unrecognized command-line option
'*-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders*'
*gcc:* *error:* unrecognized command-line option
'*-iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers*'
*gcc:* *error:* unrecognized command-line option '*-stdlib=libc++*'
error: command '/opt/local/bin/gcc' failed with exit status 1
Obviously, the contradictory **
{code:java}
{code}
*-arch arm64*
needs to be removed but I can't find arm64 anywhere.
The unnecessary **
{code:java}
{code}
*-stdlib=libc++*
can be removed from setup.py:
CFLAGS = {
'darwin': ['-fno-strict-aliasing', '-Wno-write-strings',
'-mmacosx-version-min=10.9', '-std=c++11',
{color:#FF0000}*'-stdlib=libc++'*{color}],
After poking around, I figured out that gcc uses
{code:java}
-I {code}
not
{code:java}
-i {code}
for includes.
Making these modifications (and adding
{code:java}
-Wno-attributes{code}
to remove warnings)
I came up with this line that does successfully compile without errors:
/opt/local/bin/gcc -Wno-attributes -Wno-unused-result -Wsign-compare
-Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall
-I/System/Library/Frameworks/System.framework/PrivateHeaders
-I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers
-arch x86_64 -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp
-dynamiclib -D_jcc_lib -DJCC_VER="3.8"
-I/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include
-I/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include/darwin
-I_jcc3 -Ijcc3/sources -I/Users/cwang/3.7/include
-I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8
-c jcc3/sources/jcc.cpp -o
build/temp.macosx-10.14.6-x86_64-3.8/jcc3/sources/jcc.o -DPYTHON
-fno-strict-aliasing -Wno-write-strings -mmacosx-version-min=10.9 -std=c++11
But other than removing *'-stdlib=libc++'* from the setup.py file I have no
idea how to modify things to fix the compile errors by the line generated some
how by setup.py
--
This message was sent by Atlassian Jira
(v8.3.4#803005)