Re: Can't build on Mavericks (different issue)

2015-10-27 Thread Andi Vajda


On Fri, 28 Mar 2014, Mike McCormick wrote:


Hi folks,

I am trying to build jcc to install JModelica.  The linking process dies:

building 'jcc' extension
gcc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -dynamiclib 
-D_jcc_lib -DJCC_VER="2.19" 
-I/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/include 
-I/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/include/darwin -I_jcc 
-Ijcc/sources 
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c 
jcc/sources/jcc.cpp -o build/temp.macosx-10.9-intel-2.7/jcc/sources/jcc.o -DPYTHON 
-fno-strict-aliasing -Wno-write-strings
gcc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -dynamiclib 
-D_jcc_lib -DJCC_VER="2.19" 
-I/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/include 
-I/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/include/darwin -I_jcc 
-Ijcc/sources 
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c 
jcc/sources/JCCEnv.cpp -o build/temp.macosx-10.9-intel-2.7/jcc/sources/JCCEnv.o -DPYTHON 
-fno-strict-aliasing -Wno-write-strings
g++ -Wl,-x -dynamiclib -undefined dynamic_lookup -Qunused-arguments 
build/temp.macosx-10.9-intel-2.7/jcc/sources/jcc.o 
build/temp.macosx-10.9-intel-2.7/jcc/sources/JCCEnv.o -o 
build/lib.macosx-10.9-intel-2.7/libjcc.dylib 
-L/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib -ljava 
-L/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/server 
-ljvm -Wl,-rpath 
-Wl,/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib 
-Wl,-rpath 
-Wl,/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/server 
-Wl,-S -install_name @rpath/libjcc.dylib -current_version 2.19 
-compatibility_version 2.19
ld: internal error: atom not found in 
symbolIndex(__ZN7JNIEnv_13CallIntMethodEP8_jobjectP10_jmethodIDz) for 
architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
bash-3.2#

I tried using Xcode and GCC and both stop with the same error at the same point 
in the process.  Any idea how to approach troubleshooting this?  The packages 
available via pip and easy_install do the same thing.m

M


This thread hasn't been updated in a long time and today it's affected me 
too on Mac OS X 10.10.3 with the latest Xcode 7 command line tools installed.

Searching the net, it seems that there is a combination of things at work here:

  - first, there seems to be a bug with -Wl,-x as a linker flag passed to
the compiler and since this flag is not needed, removing it works the
problem around. See the responses in this thread:
http://stackoverflow.com/questions/26570125/error-installing-pylucene-jcc-on-osx

  - second, in trying to create some kind of monkey patch for this, I looked
for where this flag was set: it is set in line 137 of setuptools'
build_ext.py file in this jolly code snippet:

try:
# XXX Help!  I don't have any idea whether these are right...
_CONFIG_VARS['LDSHARED'] = "gcc -Wl,-x -dynamiclib -undefined 
dynamic_lookup"
_CONFIG_VARS['CCSHARED'] = " -dynamiclib"
_CONFIG_VARS['SO'] = ".dylib"
customize_compiler(compiler)
finally:
_CONFIG_VARS.clear()
_CONFIG_VARS.update(tmp)

In other words, it's ugly.

The simplest way around this is to edit build_ext.py to just remove the 
-Wl,-x part of the LDSHARED flags being smashed here.


try:
# XXX Help!  I don't have any idea whether these are right...
_CONFIG_VARS['LDSHARED'] = "gcc -dynamiclib -undefined dynamic_lookup"
_CONFIG_VARS['CCSHARED'] = " -dynamiclib"
_CONFIG_VARS['SO'] = ".dylib"
customize_compiler(compiler)
finally:
_CONFIG_VARS.clear()
_CONFIG_VARS.update(tmp)

In my install, the source to setuptools' build_ext.py is here:

$ find ../_install -type f -print0 | xargs -0 grep 'Wl,-x'
../_install/lib/python2.7/site-packages/setuptools/command/build_ext.py:
_CONFIG_VARS['LDSHARED'] = "gcc -Wl,-x -dynamiclib -undefined dynamic_lookup"

I'm sorry this is so bad, words fail me too.

Andi..


[jira] [Resolved] (PYLUCENE-35) UnicodeEncodeError when a JavaException is raised

2015-10-27 Thread Andi Vajda (JIRA)

 [ 
https://issues.apache.org/jira/browse/PYLUCENE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andi Vajda resolved PYLUCENE-35.

Resolution: Fixed

in JCC's svn rev 1710939.

> UnicodeEncodeError when a JavaException is raised
> -
>
> Key: PYLUCENE-35
> URL: https://issues.apache.org/jira/browse/PYLUCENE-35
> Project: PyLucene
>  Issue Type: Bug
> Environment: Arch Linux x86_64 
> LANG=zh_CN.UTF-8
>Reporter: Vic Luo
>  Labels: easyfix, encoding
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> When a javaException is raised and the stacktrace includes unicode 
> characters, the stacktrace will not be printed. Instead, line 11 of 
> __init__.py will raise a UnicodeEncodingError:
> !!!  File 
> "/usr/lib/python2.7/site-packages/lucene-4.9.0-py2.7-linux-x86_64.egg/lucene/__init__.py",
>  line 17, in __str__!!!
> !!!return "\n".join((super(JavaError, self).__str__(), "Java 
> stacktrace:", str(writer)))!!!
> !!!UnicodeEncodeError: 'ascii' codec can't encode characters in position 
> 102-103: ordinal not in range(128)!!!
> I found a workaround: change that line to
> return u"\n".join((unicode(super(JavaError, self)), u"Java 
> stacktrace:", unicode(writer)))
> ,then it could print the correct stacktrace which contains unicode characters 
> in file path.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PYLUCENE-35) UnicodeEncodeError when a JavaException is raised

2015-10-27 Thread Andi Vajda (JIRA)

[ 
https://issues.apache.org/jira/browse/PYLUCENE-35?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14977701#comment-14977701
 ] 

Andi Vajda commented on PYLUCENE-35:


Thank you for the patch.

> UnicodeEncodeError when a JavaException is raised
> -
>
> Key: PYLUCENE-35
> URL: https://issues.apache.org/jira/browse/PYLUCENE-35
> Project: PyLucene
>  Issue Type: Bug
> Environment: Arch Linux x86_64 
> LANG=zh_CN.UTF-8
>Reporter: Vic Luo
>  Labels: easyfix, encoding
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> When a javaException is raised and the stacktrace includes unicode 
> characters, the stacktrace will not be printed. Instead, line 11 of 
> __init__.py will raise a UnicodeEncodingError:
> !!!  File 
> "/usr/lib/python2.7/site-packages/lucene-4.9.0-py2.7-linux-x86_64.egg/lucene/__init__.py",
>  line 17, in __str__!!!
> !!!return "\n".join((super(JavaError, self).__str__(), "Java 
> stacktrace:", str(writer)))!!!
> !!!UnicodeEncodeError: 'ascii' codec can't encode characters in position 
> 102-103: ordinal not in range(128)!!!
> I found a workaround: change that line to
> return u"\n".join((unicode(super(JavaError, self)), u"Java 
> stacktrace:", unicode(writer)))
> ,then it could print the correct stacktrace which contains unicode characters 
> in file path.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)