Opened 9 years ago

Closed 8 years ago

#50342 closed defect (fixed)

doxygen @1.8.10_2 does not build on PPC Tiger, Mac OS X 10.4.11, because of Python code error?

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: cssdev
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: doxygen

Description

:info:build [ 27%] Generating ../generated_src/ce_parse.h
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/generated_src && /opt/local/bin/bison -l -d -p ce_parsexpYY /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/src/constexp.y -o ce_parse.c
:info:build [ 28%] Generating /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/generated_src/resources.cpp
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/src && /opt/local/bin/python /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/src/res2cc_cmd.py /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/templates /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/generated_src/resources.cpp
:info:build   File "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/src/res2cc_cmd.py", line 40
:info:build     print("static const unsigned char %s_data[] = " % self.bareName,file=outputFile)
:info:build                                                                         ^
:info:build SyntaxError: invalid syntax
:info:build make[2]: *** [generated_src/resources.cpp] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10'
:info:build make[1]: *** [src/CMakeFiles/_doxygen.dir/all] Error 2
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10'
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10" && /usr/bin/make -w all VERBOSE=ON 
:info:build Exit code: 2
:error:build org.macports.build for port doxygen returned: command execution failed

Attachments (2)

main.log (69.6 KB) - added by ballapete (Peter "Pete" Dyballa) 9 years ago.
main.log
CMakeCache.txt (17.1 KB) - added by donniet@… 9 years ago.

Download all attachments as: .zip

Change History (16)

Changed 9 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

main.log

comment:1 Changed 9 years ago by neverpanic (Clemens Lang)

Probably needs a newer Python version, but I'd rather not add a python build dependency for everyone. Can you figure out which version of Python added this?

comment:2 in reply to:  1 Changed 9 years ago by ballapete (Peter "Pete" Dyballa)

Replying to cal@…:

Probably needs a newer Python version, but I'd rather not add a python build dependency for everyone.

I have installed, to satisfy dependencies:

  python27 @2.7.11_0+ucs4 (active)
  python34 @3.4.4_0 (active)

Can you figure out which version of Python added this?

No. I am merely a Python illiterate. I have no idea what's causing the fault why.

comment:3 Changed 9 years ago by neverpanic (Clemens Lang)

The file does from __future__ import print_function, which enables this usage of print but only works with Python >= 2.6. Additionally, it specifies a shebang of /usr/bin/python, which is probably too old on your system. Replacing the shebang of src/res2cc_cmd.py with #!/usr/bin/env python would probably fix this if you had python 2.7 installed.

I'm not planning to do this for all users as some people link their python interpreter to python 3.x, which could lead to problems.

comment:4 in reply to:  3 Changed 9 years ago by ballapete (Peter "Pete" Dyballa)

Replying to cal@…:

The file does from __future__ import print_function, which enables this usage of print but only works with Python >= 2.6. Additionally, it specifies a shebang of /usr/bin/python, which is probably too old on your system. Replacing the shebang of src/res2cc_cmd.py with #!/usr/bin/env python would probably fix this if you had python 2.7 installed.

Applying that patch leads to another error:

make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10'
[ 26%] Generating /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/generated_src/resources.cpp
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/src && /opt/local/bin/python /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/src/res2cc_cmd.py /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/templates /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/generated_src/resources.cpp
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_textproc_doxygen/doxygen/work/doxygen-1.8.10/src/res2cc_cmd.py", line 40
    print("static const unsigned char %s_data[] = " % self.bareName,file=outputFile)
                                                                        ^
SyntaxError: invalid syntax

What finally helped building doxygen is changing the setting of python from

Name       Selected     Options
====       ========     =======
clang      none         mp-clang-3.4 none
cython     cython27     cython27 none
db         none         db48 none
gcc        apple-gcc42  apple-gcc42 gcc33 gcc40 mp-gcc48 mp-gcc49 mp-gcc5 none
llvm       none         mp-llvm-3.3 mp-llvm-3.4 none
nosetests  none         nosetests27 none
python     python25     python23-apple python25 python27 python34 none
python2    python27     python23-apple python27 none
python3    python34     python34 none

to

python     python27     python23-apple python25 python27 python34 none

comment:5 Changed 9 years ago by neverpanic (Clemens Lang)

So the correct fix would be to add a dependency on Python 2.7 and patch the shebang of the file, but only on platforms where this is necessary.

Can you provide a patch that does this?

comment:6 in reply to:  5 Changed 9 years ago by ballapete (Peter "Pete" Dyballa)

Replying to cal@…:

So the correct fix would be to add a dependency on Python 2.7 and patch the shebang of the file, but only on platforms where this is necessary.

Can you provide a patch that does this?

To improve my earlier report: I re-started with clean sources, i.e., after invoking port clean doxygen. So the only patch necessary is that of the Portfile. IMO it already contains that dependancy, on line #44, doesn't it? It's somehow necessary to make port invoke port select --set python python27 or such.

comment:7 Changed 9 years ago by neverpanic (Clemens Lang)

Ports cannot depend on a certain selection state of port select, we would consider that a bug, because the selection mechanism is for users only.

Consequently, we cannot rely on /usr/bin/env python being our python after declaring a dependency on python27, and for this reason, we need the patch to the shebang explicitly uses our python.

Changed 9 years ago by donniet@…

Attachment: CMakeCache.txt added

comment:8 in reply to:  7 Changed 9 years ago by donniet@…

Replying to cal@…:

Ports cannot depend on a certain selection state of port select, we would consider that a bug, because the selection mechanism is for users only.

Consequently, we cannot rely on /usr/bin/env python being our python after declaring a dependency on python27, and for this reason, we need the patch to the shebang explicitly uses our python.

The only problem is that the CMakeCache.txt file points to the wrong version of Python. Python 2.7 does get installed as part of the Doxygen dependency resolution, but the CMakeCache.txt file still points to "/usr/bin/python", which is at version 2.5.

Anyway, I attached the corrected CMakeCache.txt file, which I've verified as working on two different G5 PowerMacs.

You're welcome!

comment:9 Changed 9 years ago by neverpanic (Clemens Lang)

We need a unified diff of a change in the Portfile that fixes this. Since the variable is PYTHON_EXECUTABLE, you could probably do something along the lines of

configure.args-append -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7

However, python 2.7 is not in the transitive dependency tree of cmake on my machine:

$ port rdeps --index cmake
The following ports are dependencies of cmake @3.4.3_0:
  curl
    lbzip2
    pkgconfig
      libiconv
        gperf
    zlib
      xz
        gettext
          expat
          ncurses
    openssl
    curl-ca-bundle
      perl5
        perl5.22
          gdbm
  bzip2
  libarchive
    libxml2
    lzo2

I'd like to keep it that way for all platforms where /usr/bin/python is sufficient. So you'll have to do this conditionally in a block that checks the version number:

platform darwin {
  if {${os.major} <= 9} {
    configure.args-append ...
    depends_build-append  port:python27
  }
}

where the version number still needs to be determined.

comment:10 Changed 8 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: mcalhoun@… added

Cc Me!

comment:11 Changed 8 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: css@… removed
Owner: changed from macports-tickets@… to css@…

comment:12 Changed 8 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Does r149412 fix the problem?

comment:13 in reply to:  12 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Replying to mcalhoun@…:

Does r149412 fix the problem?

Yes the problem is fixed, doxygen built fine.

comment:14 Changed 8 years ago by neverpanic (Clemens Lang)

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