Opened 7 years ago

Closed 7 years ago

#13313 closed defect (fixed)

Fix gcc error in pyzmq-2.1.11.p0.spkg

Reported by: slabbe Owned by: tbd
Priority: major Milestone: sage-5.7
Component: packages: optional Keywords:
Cc: Merged in:
Authors: Sébastien Labbé Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by slabbe)

Here is the new proposed spkg:

http://sage.math.washington.edu/home/slabbe/pyzmq-2.1.11.p1.spkg

As reported on sage-devel here, there is an error when installing the optional package pyzmq #12843 (after its dependency zeromq of course!) on OSX 10.5.8 :

gcc version 4.6.3 (GCC)
****************************************************
running configure
******************************************
Configure: Autodetecting ZMQ settings...
    Custom ZMQ dir:       /Users/slabbe/Applications/sage-5.2.rc0/local
gcc -fno-strict-aliasing -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -I/Users/slabbe/Applications/sage-5.2.rc0/local/include -Izmq/utils -Izmq/core -Izmq/devices -c detect/vers.c -o detect/vers.o
gcc: erreur: i386: No such file or directory
gcc: erreur: unrecognized option ‘-arch’
Fatal:
    Failed to compile ZMQ test program.  Please check to make sure:

    * You have a C compiler installed
    * A development version of Python is installed (including header files)
    * A development version of ZMQ >= 2.1.4 is installed (including header files)
    * If ZMQ is not in a default location, supply the argument --zmq=<path>
    * If you did recently install ZMQ to a default location,
      try rebuilding the ld cache with `sudo ldconfig`
      or specify zmq's location with `--zmq=/usr/local`
   
error: command 'gcc' failed with exit status 1
******************************************

The reason to this is that Sage's gcc spkg does not build a compiler which understands the option -arch of Apple's clone of gcc.

The following patch applied on the spkg fixes the problem :

  • buildutils.py

    pyzmq-2.1.11.p1/patches $ cat buildutils.patch
    old new  
    111111   
    112112    cpreargs = lpreargs = None
    113113    if sys.platform == 'darwin':
    114         # use appropriate arch for comiler
    115         if platform.architecture()[0]=='32bit':
    116             cpreargs = ['-arch','i386']
    117             lpreargs = ['-arch', 'i386', '-undefined', 'dynamic_lookup']
    118         else:
    119             # allow for missing UB arch, since it will still work:
    120             lpreargs = ['-undefined', 'dynamic_lookup']
     114        lpreargs = ['-undefined', 'dynamic_lookup']
    121115
    122116    objs = cc.compile([cfile],extra_preargs=cpreargs)
    123117    cc.link_executable(objs, efile, extra_preargs=lpreargs)

Attachments (1)

buildutils.patch (736 bytes) - added by slabbe 7 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 Changed 7 years ago by dimpase

  • Component changed from packages to optional packages
  • Description modified (diff)

Could you create a proper patch and upload it as an attachment?

Changed 7 years ago by slabbe

comment:2 follow-up: Changed 7 years ago by slabbe

The patch I just attached should go in pyzmq-2.1.11.p?/patches. I never patch/created a package before. If I am doing something wrong, just tell me.

Sébastien

comment:3 in reply to: ↑ 2 Changed 7 years ago by dimpase

Replying to slabbe:

The patch I just attached should go in pyzmq-2.1.11.p?/patches. I never patch/created a package before. If I am doing something wrong, just tell me.

in a nutshell:

  • rename the package directory pyzmq-2.1.11.p2
  • put the patch in pyzmq-2.1.11.p2/patches
  • adjust spkg-install so that this patch is applied (assuming your patch is not a change to Sage's patches to the upstream, but a change of the upstream)
  • create pyzmq-2.1.11.p2.spkg by running sage -spkg pyzmq-2.1.11.p2/ in the corresponding directory i.e. SAGEROOT/spkg/optional
  • test it.
  • upload it somewhere and put a link to it into the ticket description.
  • mark the ticket as needing review

(I know, sounds like a lot of work :-))

comment:4 Changed 7 years ago by slabbe

Ok thanks for the cheering. I also read Patching a spkg in the Developper Guide. Here is my first patch to a package (p0 was the most recent version) :

http://sage.math.washington.edu/home/slabbe/pyzmq-2.1.11.p1.spkg

Needs review!

Last edited 7 years ago by slabbe (previous) (diff)

comment:5 Changed 7 years ago by slabbe

  • Status changed from new to needs_review

comment:6 follow-up: Changed 7 years ago by vbraun

Dima, you reported on the mailinglist that installing pyzmq works if you install zmq first. Can you clarify on that? zmq is a requirement, you can't build pyzmq without. I just want tbo be clear that we aren't patching dead code here.

The patch looks good to me, fwiw.

comment:7 in reply to: ↑ 6 Changed 7 years ago by dimpase

Replying to vbraun:

Dima, you reported on the mailinglist that installing pyzmq works if you install zmq first. Can you clarify on that? zmq is a requirement, you can't build pyzmq without. I just want tbo be clear that we aren't patching dead code here.

Hi Volker,

well, it was a (brain)dead response by me, the code is alive. Later I was able to reproduce the bug on another installation.

comment:8 follow-up: Changed 7 years ago by jtremblay

The patch worked for me.

comment:9 in reply to: ↑ 8 Changed 7 years ago by slabbe

Replying to jtremblay:

The patch worked for me.

The patch or the spkg ? On which machine ?

comment:10 follow-up: Changed 7 years ago by jtremblay

The spkg, on OSX 10.7.3 with Sage 5.2 binaries.

comment:11 in reply to: ↑ 10 Changed 7 years ago by slabbe

Replying to jtremblay:

The spkg, on OSX 10.7.3 with Sage 5.2 binaries.

And were you obtaining the same problem as me while installing pyzmq-2.1.11.p0.spkg ?

comment:12 follow-up: Changed 7 years ago by jtremblay

Apparently not, zmq was not installed when I tried installing pyzmq :

Extracting package /Library/sage/spkg/optional/pyzmq-2.1.11.p0.spkg
-rw-r--r--  1 tremblayj  wheel  464755  2 Aug 10:02 /Library/sage/spkg/optional/pyzmq-2.1.11.p0.spkg
Finished extraction
****************************************************
Host system:
Darwin jerometremblayportable.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
****************************************************
C compiler: gcc
C compiler version:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/Library/sage/local/bin/../libexec/gcc/x86_64-apple-darwin10.8.0/4.6.3/lto-wrapper
Target: x86_64-apple-darwin10.8.0
Configured with: ../src/configure --prefix=/Users/buildbot/build/sage/bsd-1/bsd_64_binary/build/sage-5.2/local --with-local-prefix=/Users/buildbot/build/sage/bsd-1/bsd_64_binary/build/sage-5.2/local --with-gmp=/Users/buildbot/build/sage/bsd-1/bsd_64_binary/build/sage-5.2/local --with-mpfr=/Users/buildbot/build/sage/bsd-1/bsd_64_binary/build/sage-5.2/local --with-mpc=/Users/buildbot/build/sage/bsd-1/bsd_64_binary/build/sage-5.2/local --with-system-zlib --disable-multilib  
Thread model: posix
gcc version 4.6.3 (GCC) 
****************************************************
running configure
******************************************
Configure: Autodetecting ZMQ settings...
    Custom ZMQ dir:       /Library/sage/local
gcc -fno-strict-aliasing -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/sage/local/include -Izmq/utils -Izmq/core -Izmq/devices -c detect/vers.c -o detect/vers.o
detect/vers.c:3:17: fatal error: zmq.h: No such file or directory
compilation terminated.
Fatal: 
    Failed to compile ZMQ test program.  Please check to make sure:

    * You have a C compiler installed
    * A development version of Python is installed (including header files)
    * A development version of ZMQ >= 2.1.4 is installed (including header files)
    * If ZMQ is not in a default location, supply the argument --zmq=<path>
    * If you did recently install ZMQ to a default location, 
      try rebuilding the ld cache with `sudo ldconfig`
      or specify zmq's location with `--zmq=/usr/local`
    
error: command 'gcc' failed with exit status 1

comment:13 in reply to: ↑ 12 Changed 7 years ago by slabbe

Replying to jtremblay:

Apparently not, zmq was not installed when I tried installing pyzmq :

Yes, but this was not my question: zeromq needs to be installed before pyzmq.

To summarize:

  • The pyzmq-2.1.11.p0.spkg is broken on OSX 10.5.8.
  • The pyzmq-2.1.11.p1.spkg fixes the bug at least for OSX 10.5.8.
  • The pyzmq-2.1.11.p1.spkg also work on OSX 10.7.3.
  • And we do not know if pyzmq-2.1.11.p0.spkg was broken on OSX 10.7.3 also (which was my previous question).

#12719 will be merged soon, so it would be nice if this ticket could be reviewed, no?

Last edited 7 years ago by slabbe (previous) (diff)

comment:14 Changed 7 years ago by slabbe

  • Description modified (diff)
  • Summary changed from gcc error while installing optionnal package pyzmq-2.1.11.p0 to Fix gcc error in pyzmq-2.1.11.p0.spkg

comment:15 Changed 7 years ago by slabbe

  • Description modified (diff)

comment:16 Changed 7 years ago by vbraun

  • Authors set to Sebastien Labbe
  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

Looks good to me.

comment:17 Changed 7 years ago by schilly

spkg is on its way to the servers!

comment:18 Changed 7 years ago by slabbe

  • Authors changed from Sebastien Labbe to Sébastien Labbé

comment:19 Changed 7 years ago by jdemeyer

  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.