Sounds like they could use some help with their code. If you want to make your own version of a function like abs that behaves differently to the stdlib one, defining a macro with the same name is not the way to go about it. It's likely to misbehave regardless of which compiler you use, just because of the way C preprocessing works.

Have you tried just compiling with clang and seeing what happens?

- Josh

On 2016-4-2 18:04 , Mark Brethen wrote:
 From their installation guide:

For the compilation of cgx, therefore, the unmodified GCC 4.9 is
required because the modified (by Apple) GCC for several reasons is not
suitable for the compilation of cgx … The modified GCC includes the
individual compilers: gcc (GNU c compiler), g++ and clang. Because the
modified GCC has a problem with function overloading it is not suitable
for the 2compilation of cgx.

2In particular, the compilation of function: #define abs(x) ((x) >= 0 ?
(x) : -(x)) in the cgx-routine: “extUtil.h“ causes a compiler error. A
bug fix for the compiler was not available at the time the installation
of cgx was tested.


I have looked at that link but it doesn’t explain how, for example, to
set a default compiler. The compilers group gives more instruction, but
it’s not completely clear to me. I guess something like

compilers.choose    cc cxx cpp
configure.cc <http://configure.cc> macports-gcc-4.9


On Apr 1, 2016, at 11:59 PM, Ryan Schmidt <ryandes...@macports.org
<mailto:ryandes...@macports.org>> wrote:

On Apr 1, 2016, at 23:03, Mark Brethen <mark.bret...@gmail.com
<mailto:mark.bret...@gmail.com>> wrote:

I’ve run into a snag building calculix. glut and libSNL are libraries
that calculix uses. I set

"compiler.whitelist      macports-gcc-4.9”

per the developers instructions.

Why? We usually do not want to use FSF GCC.

However there isn’t a configure so I’m not sure what else needs to be
passed.

subport ${name}-cgx {
  revision                0
  master_sites http://www.dhondt.de/
  distname                cgx_${version}.all

  checksums               rmd160
 02302101f16c2b4cdd570e81986cc4d36c2110d8 \
      sha256
64810dab1c22152c7946282fac5763cc36b9e31e309f962c23b8bf8238537c7e

  depends_run-append      port:openbrowser

  worksrcdir              CalculiX
  build.dir               ${worksrcpath}/cgx_${version}/src
  build.target

  compiler.whitelist      macports-gcc-4.9

  patchfiles              patch-cgx-build.diff \
      patch-libSNL-build.diff
  patch.dir               ${workpath}

  post-patch {
      reinplace "s|@@PREFIX@@|${prefix}|g" \
          ${worksrcpath}/cgx_${version}/src/cgx.h
  }

  use_configure           no

livecheck.regex         {ccx_${version}.all}
}

When you set "use_configure no", you must add code to use the right
compiler and -arch flags and offer a universal variant. See:

https://trac.macports.org/wiki/UsingTheRightCompiler


_______________________________________________
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to