Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#48224 closed defect (fixed)

ghc @7.8.3_2: setting compiler.cpath and compiler.library_path is potential no-op

Reported by: howarth.at.macports@… Owned by: neverpanic (Clemens Lang)
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: kitchen.andy@…
Port: ghc

Description (last modified by larryv (Lawrence Velázquez))

While adapting the MacPorts ghc-bootstrap/ghc to create matching fink packages to build ghc from source for adding rootless support to 7.8.3, I noticed what appears to be a thinko in the current ghc Portfile. Specially, the section...

# OK so because the bootstrap binary has been prebuilt for libraries
# in /usr/lib we search these before macports stuff to prevent
# link errors, ghc _should_ actually compile itself in stage2
# using paths from the command line arguments
compiler.cpath /usr/include
compiler.library_path /usr/lib

seems to be a pointless no-op since it adds those directories to the search list *after* the -I and -L entries are processed.
In the fink packaging, it was desired to mimic the upstream ghc binaries as closely as possible so...

--with-iconv-includes=/usr/include \
--with-iconv-libraries=/usr/lib \

was used in concert with

NoSetCPPFLAGS: true
NoSetLDFLAGS: true

Interestingly this still required a BuildConflicts on the fink libiconv-dev to prevent a build issue with ghc-pandoc-types...

[57 of 57] Compiling Text.Pandoc      ( src/Text/Pandoc.hs, dist/build/Text/Pandoc.o )
In-place registering pandoc-1.12.4.2...
Preprocessing executable 'pandoc' for pandoc-1.12.4.2...
[1 of 1] Compiling Main             ( pandoc.hs, dist/build/pandoc/pandoc-tmp/Main.o )
Linking dist/build/pandoc/pandoc ...
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _hs_iconv in libHSbase-4.7.0.1.a(iconv.o)
  "_libiconv_close", referenced from:
      _hs_iconv_close in libHSbase-4.7.0.1.a(iconv.o)
  "_libiconv_open", referenced from:
      _hs_iconv_open in libHSbase-4.7.0.1.a(iconv.o)
ld: symbol(s) not found for architecture x86_64

In the MacPorts case, since you using...

--with-iconv-includes=${prefix}/include \
--with-iconv-libraries=${prefix}/lib    \

and are leaving -I${prefix}/include on configure.cppflags and -L${prefix}/lib on configure.ldflags, the use of...

compiler.cpath /usr/include
compiler.library_path /usr/lib

is pointless dead code in the Portfile

Change History (6)

comment:1 Changed 9 years ago by howarth.at.macports@…

One other potential enhancement to the current Portfile. If you use...

        --with-ffi-includes=${prefix}/include \
        --with-ffi-libraries=${prefix}p/lib \
        --with-system-libffi \

and include

port:libffi

in the depends_lib, it should suppress the build of the bundled libffi sources in ghc and build/link against the MacPorts libffi instead.

comment:2 Changed 9 years ago by larryv (Lawrence Velázquez)

Description: modified (diff)
Owner: changed from macports-tickets@… to cal@…
Summary: potential thinko in ghc Portfileghc @7.8.3_2: setting compiler.cpath and compiler.library_path is potential no-op

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

Status: newassigned

Thanks for the heads up, I'll look into it.

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

Resolution: fixed
Status: assignedclosed

r138532. Turns out the compiler.cpath and compiler.library_path settings are necessary because the wouldn't find the _iconv symbol without them in the first bootstrapping phase. The comment was wrong, though; these settings are only needed as a fallback. I fixed the comment and switched to our copy of libffi.

Thanks.

comment:5 Changed 9 years ago by gnw3

ghc-bootstrap is providing old-time-1.1.0.1 where old-time-1.1.0.2 is required

Attempting to upgrade on OS X Mavericks, I get

:info:build Reading package info from "libraries/old-time/dist-install/inplace-pkg-con
fig" ... done.
:info:build old-time-1.1.0.2: Warning: haddock-interfaces: /opt/local/var/macports/bui
ld/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_ghc/ghc/work/ghc
-7.8.3/libraries/old-time/dist-install/doc/html/old-time/old-time.haddock doesn't exis
t or isn't a file
:info:build old-time-1.1.0.2: cannot find any of ["System/Time.hi","System/Time.p_hi",
"System/Time.dyn_hi"] (ignoring)
:info:build old-time-1.1.0.2: cannot find any of ["libHSold-
$  port contents ghc-bootstrap | grep old-time
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/old-time-1.1.0.1/HSold-time-1.1.0.1.o
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/old-time-1.1.0.1/System/Time.dyn_hi
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/old-time-1.1.0.1/System/Time.hi
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/old-time-1.1.0.1/System/Time.p_hi
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/old-time-1.1.0.1/include/HsTime.h
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/old-time-1.1.0.1/include/HsTimeConfig.h
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/old-time-1.1.0.1/libHSold-time-1.1.0.1.a
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/old-time-1.1.0.1/libHSold-time-1.1.0.1_p.a
  /opt/local/share/ghc-bootstrap/lib/ghc-7.6.2/package.conf.d/old-time-1.1.0.1-a8b2b6623213196eb6b9e75bd68c8c42.conf
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/LICENSE
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/haddock-util.js
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/hslogo-16.png
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/minus.gif
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/ocean.css
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/old-time.haddock
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/old-time.haddock.t
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/old-time.txt
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/plus.gif
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/src/hscolour.css
  /opt/local/share/ghc-bootstrap/share/doc/ghc/html/libraries/old-time-1.1.0.1/synopsis.png

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

How did you determine that you need a newer copy of old-time? Can you attach the complete main.log (possibly compressed)? What's the output of ghc-pkg list and ghc-pkg check?

The build worked fine on our Mavericks buildbot and on my machine (which is Yosemite, though), so I'm inclined to think that the version of old-time isn't the problem.

Note: See TracTickets for help on using tickets.