Skip to content

WCS build fails on Mac - #98

Merged
mdboom merged 3 commits into
astropy:masterfrom
mdboom:setup/adjust_compiler
Dec 1, 2011
Merged

mdboom merged 3 commits into
astropy:masterfrom
mdboom:setup/adjust_compiler

Conversation

@mdboom

@mdboom mdboom commented Nov 30, 2011

Copy link
Copy Markdown
Contributor

I'm not sure when this was introduced, but as of 7a7884f, astropy does not compile on Mac:

/Developer/usr/bin/llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -pipe -O2 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DECHO -DWCSTRIG_MACRO -DASTROPY_WCS_BUILD -D_GNU_SOURCE -DWCSVERSION=4.8.2 -DNDEBUG -UDEBUG -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/Users/tom/tmp/astropy/astropy/wcs/src/wcslib/C -I/Users/tom/tmp/astropy/astropy/wcs/src -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /Users/tom/tmp/astropy/astropy/wcs/src/wcslib/C/wcserr.c -o build/temp.macosx-10.6-x86_64-2.7/Users/tom/tmp/astropy/astropy/wcs/src/wcslib/C/wcserr.o
/Users/tom/tmp/astropy/astropy/wcs/src/wcslib/C/wcserr.c:140: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
{standard input}:0:End-of-File not at end of a line
{standard input}:116:End-of-File not at end of a line
{standard input}:unknown:Partial line at end of file ignored
{standard input}:unknown:Undefined local symbol L_.str
{standard input}:unknown:Undefined local symbol L_.str1
{standard input}:unknown:Undefined local symbol L_.str2
error: command '/Developer/usr/bin/llvm-gcc-4.2' failed with exit status 1

I'm assigning this to @mdboom since the error occurs with compiling the WCS files.

@ghost ghost assigned mdboom Nov 30, 2011
@jiffyclub

Copy link
Copy Markdown
Contributor

This is probably the same as #31. @mdboom's compiler detection doesn't always seem to work. You can manually set the compiler with export CC=/usr/bin/clang.

@astrofrog

Copy link
Copy Markdown
Member Author

I'm actually using 10.6 (not 10.7 as in #31), and didn't have any issues until some time in the last few days, so something must have changed in the compiler detection that is causing this issue.

@mdboom

mdboom commented Nov 30, 2011

Copy link
Copy Markdown
Contributor

The compiler detection code has not changed for some time and it is still working on Lion. Perhaps there was an XCode update recently? If astropy really is at fault, and I can't reproduce this here, maybe you could try running git bisect to determine when it broke? Or at least roll back to sometime last week when you last remember it working.

When you do cc --version what do you get? If you add this version string (i.e. the first token of that output) to compiler_mapping in setup_helpers.py does that resolve the issue? We may want to have a blanket black list on all versions of llvm-gcc (which is a half-baked transitional compiler anyway) instead of targeting very specific versions of it as we do now. (We don't really know how widespread this compiler bug is.)

@astrofrog

Copy link
Copy Markdown
Member Author

If I change compiler_mapping to:

compiler_mapping = {
    'i686-apple-darwin10-llvm-gcc-4.2': 'clang',
    'i686-apple-darwin11-llvm-gcc-4.2': 'clang'
    }

it uses clang to compile, and works fine. Shall I commit that change?

@mdboom

mdboom commented Nov 30, 2011

Copy link
Copy Markdown
Contributor

That seems fine -- but I think I'll change it to match on any llvm-gcc-4.2, regardless of darwin version. That should catch more of these cases in the future. Expect a pull request shortly which I'll ask you to test in your environment.

@astrofrog

Copy link
Copy Markdown
Member Author

By the way, this makes sense - darwin10 is in MacOS 10.6, and darwin11 is in MacOS 10.7, so maybe these are two only two default mac compilers we need to worry about?

@astrofrog

Copy link
Copy Markdown
Member Author

@mdboom - ok, thanks!

@jiffyclub

Copy link
Copy Markdown
Contributor

I haven't done any actual experimenting to this end but I've found that the compiler adjustment is highly dependent on the Python I'm using. With EPD or python.org binaries it was never caught and I'd have to set CC manually. Right now I have Python 2.7 and Python 3.2 built with the exact same llvm-gcc and under Python 2 the compiler gets automatically switched to clang, but under Python 3 I have to set CC manually to /usr/bin/clang.

I'll have to see if @mdboom's fix changes things and if not I'll actually try to track down the problem.

@jiffyclub

Copy link
Copy Markdown
Contributor

@mdboom, on a totally separate topic, how do you attach code to an open issue and turn it into a pull request?

@mdboom

mdboom commented Nov 30, 2011

Copy link
Copy Markdown
Contributor

@jiffyclub: I have a dorky little script that uses curl to call the github API here: http://develop.github.com/p/pulls.html

@jiffyclub

Copy link
Copy Markdown
Contributor

@mdboom I'm getting this error trying to test your branch on Python 3:

(python3)astropy 33 >:python setup.py test  
Traceback (most recent call last):
  File "setup.py", line 24, in <module>
    setup_helpers.adjust_compiler()
  File "/Users/jiffyclub/astropy/astropy/setup_helpers.py", line 368, in adjust_compiler
    if re.match(broken, version):
  File "/Users/jiffyclub/.virtualenvs/python3/lib/python3.2/re.py", line 153, in match
    return _compile(pattern, flags).match(string)
TypeError: can't use a string pattern on a bytes-like object

It looks like the version object is a bytes object.

@mdboom

mdboom commented Dec 1, 2011

Copy link
Copy Markdown
Contributor

@jiffyclub: I've pushed what I hope fixes that to this branch. Also rebased to get other Python 3 fixes made today.

@jiffyclub

Copy link
Copy Markdown
Contributor

It's not liking that either:

(python3)astropy 55 >:python setup.py test
Traceback (most recent call last):
  File "setup.py", line 24, in <module>
    setup_helpers.adjust_compiler()
  File "/Users/jiffyclub/astropy/astropy/setup_helpers.py", line 369, in adjust_compiler
    os.environ['CC'] = fixed
  File "/Users/jiffyclub/.virtualenvs/python3/lib/python3.2/os.py", line 455, in __setitem__
    value = self.encodevalue(value)
  File "/Users/jiffyclub/.virtualenvs/python3/lib/python3.2/os.py", line 517, in encode
    raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not bytes

I guess the good news is that it is actually trying to change the compiler.

@mdboom

mdboom commented Dec 1, 2011

Copy link
Copy Markdown
Contributor

If you remove the 'b' from b'clang' does it work?

@jiffyclub

Copy link
Copy Markdown
Contributor

Yes, works on Python 2.7 and 3.2.

One funny thing I just noticed is that the compiler gets switched to clang for compiling all the *.o files, but then /usr/bin/llvm-gcc is used to bundle them into _wcs.o. Maybe that's supposed to happen? Doesn't seem to have any negative side effects.

@astrofrog

Copy link
Copy Markdown
Member Author

After removing the b from b'clang', it works for me in MacOS 10.6 (darwin10) with 2.6, 2.7, 3.1, and 3.2.

mdboom added a commit that referenced this pull request Dec 1, 2011
Given the number of successful reports, merging.
@mdboom
mdboom merged commit 7e1f874 into astropy:master Dec 1, 2011
@eteq

eteq commented Dec 2, 2011

Copy link
Copy Markdown
Member

I know I'm a bit behind here, but because the topic came up and I just figured out how to do this... it's pretty easy to attach code to issues inside python via the github API w/ the requests package (http://docs.python-requests.org/en/latest/index.html). e.g. to attach my version-renumbering branch to issue 52:

import requests,json

jdata = json.dumps({'issue':'52','head':'eteq:version-renumbering','base':'master'})
res = requests.post('https://api.github.com/repos/astropy/astropy/pulls',data=jdata,auth=('eteq','12345'))
print res

And if it tells you the return code is 201, you were sucessful.

(And no, my password is not actually '12345'. That's the kind of combination an idiot would have on his luggage...)

@mdboom

mdboom commented Dec 2, 2011

Copy link
Copy Markdown
Contributor

@jiffyclub: wrt a different command used to link -- it's probably fine that it happens that way. gcc is designed to be run as either a compiler or a linker depending on what is passed on the commandline. When run as a linker, it merely punts along to the ld command. Most Python distros I've seen set both the compiler and linker to the same command, but the adjust_compiler stuff here only changes the compiler, since only the compiler is buggy and needs to be changed (at least that I've seen). I think we can ignore this as long as it's working.

keflavich pushed a commit to keflavich/astropy that referenced this pull request Oct 9, 2013
Given the number of successful reports, merging.
@mdboom
mdboom deleted the setup/adjust_compiler branch May 21, 2014 23:56
embray added a commit to embray/astropy that referenced this pull request Jan 23, 2015
embray added a commit to embray/astropy that referenced this pull request Jan 23, 2015
Bootstrap failures with Python 2
astrofrog referenced this pull request in astrofrog/astropy Nov 23, 2016
Added Python formatters for ScalarFormatterLocator
jeffjennings pushed a commit to jeffjennings/astropy that referenced this pull request Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants