Opened 9 years ago

Closed 8 years ago

#51359 closed defect (fixed)

qhull fails to build on 10.6.8

Reported by: dyne2meter Owned by: mamoll (Mark Moll)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: mojca (Mojca Miklavec), udbraumann, dliessi (Davide Liessi), michaeld@…
Port: qhull

Description (last modified by mf2k (Frank Schima))

Log reports

:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h: In member function ‘std::vector<T, std::allocator<_CharT> > orgQhull::QhullSet<T>::toStdVector() const’:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h:330: error: expected `;' before ‘i’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h:331: error: expected `;' before ‘e’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h:333: error: ‘i’ was not declared in this scope
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h:333: error: ‘e’ was not declared in this scope

Change History (18)

comment:1 Changed 9 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to mmoll@…
Port: qhull added

In the future, please use WikiFormatting, fill in the Port field and Cc the port maintainers (port info --maintainers qhull), if any.

comment:2 Changed 9 years ago by mf2k (Frank Schima)

Description: modified (diff)

comment:3 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:4 Changed 8 years ago by udbraumann

Cc: braumann@… added

Cc Me!

comment:5 in reply to:  description Changed 8 years ago by udbraumann

Same error in 10.5.8 PPC with Apple's gcc 4.2. Note that the previous version 2012.1_3 could be built, while 2015.2_0 cannot.

Here is the code where the error occurs in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h (line numbers added here, similar code may follow in this file):

326 template <typename T>
327 std::vector<T> QhullSet<T>::
328 toStdVector() const
329 {
330     QhullSet<T>::const_iterator i= begin();
331    QhullSet<T>::const_iterator e= end();
332    std::vector<T> vs;
333    while(i!=e){
334        vs.push_back(*i++);
335    }
336    return vs;
337 }//toStdVector

Any ideas how to fix this? Macports' gcc5 fails due to the missing -arch switch.

comment:6 Changed 8 years ago by dliessi (Davide Liessi)

Cc: davide.liessi@… added

Cc Me!

comment:7 Changed 8 years ago by josephsacco

This version of qhull does not build on a G4 based PPC running OS X 10.5.8 using Apple's gcc-4.2.1. It can be coerced to build using gcc5 by altering the configuration phase of the MacPorts build as shown:

diff -u Portfile- Portfile
--- Portfile-	2016-05-16 15:31:11.000000000 -0400
+++ Portfile	2016-05-16 17:44:32.000000000 -0400
@@ -43,6 +43,11 @@
     configure.optflags  -O3 -pipe -march=native
 }

+pre-configure {
+# Suppress -arch flag
+    configure.args-append -DCMAKE_OSX_ARCHITECTURES=""
+ }
+
 configure.args-append   -DDOC_INSTALL_DIR=share/doc/qhull -DMAN_INSTALL_DIR=share/man/man1

To understand why this "ham-fisted" approach works, examine lines 122-174 of:

/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/_resources/port1.0/group/cmake-1.0.tcl

The MacPorts implementation of cmake always sets the -arch flag for 'platform darwin' irrespective of the choice of compiler. Adding a pre-configure block to the Portfile overwrites what was done in cmake-1.0.tcl.

A better approach would be to modify that section of cmake-1.0.tcl to properly handle GNU compilers.

-Joseph

comment:8 Changed 8 years ago by mojca (Mojca Miklavec)

Joseph, see comment:29:ticket:37732.

Does this work with clang (say, clang 3.4)? Maybe we should just blacklist some compilers for qhull.

comment:9 in reply to:  8 Changed 8 years ago by udbraumann

Having made the changes in Portfile as proposed above, it was possible to build qhull @2015.2 with gcc5 (I guess, gcc48 or gcc49 would also do):

$ sudo port -s upgrade qhull configure.compile=macports-gcc-5

clang34 is presently no option on PPC, but gcc5 is.

comment:10 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: michaeld@… added
Version: 2.3.4

clang worked for me last time I tested (but that was back in March).

I believe that this change requires an action in cmake or at least the cmake PortGroup rather than in this port alone.

comment:11 in reply to:  10 Changed 8 years ago by udbraumann

Replying to mojca@…:

clang worked for me last time I tested (but that was back in March).

This is amazing, could you please try this one-liner on 10.5.8 PPC:

$ printf '#include<stdio.h> \n int main(void) {fprintf(stderr,"Hello, world\\n");}' | clang-mp-3.4 -arch ppc -mmacosx-version-min=10.5 -x c -o out.exe - && ./out.exe && rm -r out.exe

I obtain heaps of Non-aligned pointer being freed errors. So, while clang-3.4 can be built on PPC, there is still trouble. Unfortunately I find no time to look deeper into this issue, and as I was recommended, clang-3.7 would be the right version to start to tackle this PPC issues. Note that the command above works for cross compiling from a 10.6.8 Intel platform, and the resulting binary runs on 10.5.8 PPC, and also on 10.6.8 Intel using Rosetta.

I believe that this change requires an action in cmake or at least the cmake PortGroup rather than in this port alone.

This is beyond my expertise, what I would expect from a good solution is to not to block universal builds.

comment:12 in reply to:  description ; Changed 8 years ago by filippo.delillo@…

Same problem,

the solutions proposed are only for PPC, right?

Replying to dyne2meter@…:

Log reports

:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h: In member function ‘std::vector<T, std::allocator<_CharT> > orgQhull::QhullSet<T>::toStdVector() const’:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h:330: error: expected `;' before ‘i’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h:331: error: expected `;' before ‘e’
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h:333: error: ‘i’ was not declared in this scope
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_qhull/qhull/work/qhull-2015.2/src/libqhullcpp/QhullSet.h:333: error: ‘e’ was not declared in this scope

comment:13 in reply to:  12 ; Changed 8 years ago by udbraumann

Replying to filippo.delillo@…:

Same problem,

the solutions proposed are only for PPC, right?

Concerning the workaround proposed in comment:7 and comment:9 I would expect these also work on Intel platforms.

comment:14 in reply to:  13 ; Changed 8 years ago by dyne2meter

Replying to braumann@…:

Replying to filippo.delillo@…:

Same problem,

the solutions proposed are only for PPC, right?

Concerning the workaround proposed in comment:7 and comment:9 I would expect these also work on Intel platforms.

No, this does not work on the Intel platform, 10.6.8, with gcc5. Should I abandon gcc5 and go to gcc6? This is delaying upgrades of py##-matplotlib and octave. I have a Mavericks installation where the update of qhull proceeds normally.

comment:15 in reply to:  14 ; Changed 8 years ago by udbraumann

Replying to dyne2meter@…:

No, this does not work on the Intel platform, 10.6.8, with gcc5. Should I abandon gcc5 and go to gcc6? This is delaying upgrades of py##-matplotlib and octave. I have a Mavericks installation where the update of qhull proceeds normally.

Oh, I expected you to work on 10.5.8 Intel. However, if I remember right, on my 10.6.8 64 bit Intel machine qhull could be built without a Portfile change just by specifying sudo port -s upgrade qhull configure.compiler=macports-gcc-5 in the command line. To be honest, I was a bit surprised that no complaint came up concerning the -arch switch on that machine. Anyway, I do not think that gcc6 would solve your issue. What is the error being issued on your 10.6.8 machine?

comment:16 in reply to:  15 Changed 8 years ago by dyne2meter

Replying to braumann@…:

Replying to dyne2meter@…:

No, this does not work on the Intel platform, 10.6.8, with gcc5. Should I abandon gcc5 and go to gcc6? This is delaying upgrades of py##-matplotlib and octave. I have a Mavericks installation where the update of qhull proceeds normally.

Oh, I expected you to work on 10.5.8 Intel. However, if I remember right, on my 10.6.8 64 bit Intel machine qhull could be built without a Portfile change just by specifying sudo port -s upgrade qhull configure.compiler=macports-gcc-5 in the command line. To be honest, I was a bit surprised that no complaint came up concerning the -arch switch on that machine. Anyway, I do not think that gcc6 would solve your issue. What is the error being issued on your 10.6.8 machine?

The errors are the same as those in my initial report, even using the compiler=macports-gcc-5, as you recommended.

Last edited 8 years ago by dyne2meter (previous) (diff)

comment:17 Changed 8 years ago by dliessi (Davide Liessi)

r149135 (see #51486) fixes compilation for me on 10.6.8. (I didn't test it though, as it is installed on my system only because it is a dependency of octave, which currently does not build for me.)

comment:18 Changed 8 years ago by mamoll (Mark Moll)

Resolution: fixed
Status: newclosed

A proper fix was committed in r149962.

Note: See TracTickets for help on using tickets.