Opened 11 years ago

Closed 11 years ago

#19747 closed defect (fixed)

ghc 6.10.3_1: can't locate file for: -lgmp on Tiger

Reported by: dmathers@… Owned by: gwright@…
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: Cc: marcin.zalewski@…, ryandesign (Ryan Schmidt), h8spawn@…, gale@…
Port: ghc

Description

When I try to upgrade ghc I get: ld: library not found for -lgmp

It looks like the culprit is: -L/opt/local/lib

My macports in installed in /ports

Change History (21)

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

Owner: changed from macports-tickets@… to gwright@…

comment:2 Changed 11 years ago by marcin.zalewski@…

I get the same problem with fresh build of the whole port tree.

comment:3 Changed 11 years ago by marcin.zalewski@…

Cc: marcin.zalewski@… added

Cc Me!

comment:4 Changed 11 years ago by marcin.zalewski@…

This fixed it for me (edit in Portfile):

199c199
< 		reinplace "s|XXPATH_TO_GMP_LIBRARYXX|${prefix}/lib|" ${worksrcpath}/compiler/ghc.cabal.in
---
> #		reinplace "s|XXPATH_TO_GMP_LIBRARYXX|${prefix}/lib|" ${worksrcpath}/compiler/ghc.cabal.in
203,204d202
< 		reinplace "s|/opt/local/lib|${prefix}/lib|g" ${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/package.conf
< 

I am not sure if the first edit is actually necessary, but I do not want to recompile my GHC anymore. :)

comment:5 Changed 11 years ago by ryandesign (Ryan Schmidt)

Cc: ryandesign@… added

comment:6 Changed 11 years ago by marcin.zalewski@…

BTW, I should have added that I had problems on PowerPC. It seems that the Intel version is using a different ghc to bootstrap.

comment:7 Changed 11 years ago by ryandesign (Ryan Schmidt)

I am seeing the issue as well on Intel.

comment:8 Changed 11 years ago by h8spawn@…

I'm having the same problem with a really fresh port installation. That is on Mac OS X 10.4, Intel with Xcode 2.5, after doing

sudo port -f uninstall installed
sudo rm -rf /Library/Tcl/macports1.0/ /Library/Receipts/MacPorts-1.* /opt
rm -r ~/.macports/

and reinstalling MacPorts,

sudo port install ghc

fails with:

Preprocessing library ghc-6.10.3...
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: can't locate file for: -lgmp
collect2: ld returned 1 exit status
linking dist-stage1/build/Fingerprint_hsc_make.o failed

By the way, a similar (identical?) bug for ghc 6.10.1 was reported as ticket #17321
and considered fixed a few months ago.

comment:9 Changed 11 years ago by h8spawn@…

Cc: h8spawn@… added

Cc Me!

comment:10 Changed 11 years ago by ryandesign (Ryan Schmidt)

Resolution: fixed
Status: newclosed

Fixed in r52187 (maintainer timeout). Thanks to Marcin Zalewski for identifying the problem.

comment:11 Changed 11 years ago by ryandesign (Ryan Schmidt)

Resolution: fixed
Status: closedreopened

The problem seems fixed when prefix is not /opt/local, but when it is, it still doesn't work.

comment:12 in reply to:  11 Changed 11 years ago by ryandesign (Ryan Schmidt)

Replying to ryandesign@…:

The problem seems fixed when prefix is not /opt/local, but when it is, it still doesn't work.

I'm still getting "can't locate file for: -lgmp" both when prefix is /opt/local and when it isn't, on two Intel Macs with Tiger. Stephan above is also using Tiger on Intel. But my fix from r52187 above fixed it for an Intel Mac with non-/opt/local prefix on Leopard.

comment:13 Changed 11 years ago by gale@…

On Mac OS X 10.4.11 Intel:

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: can't locate file for: -lgmp

It has now become quite clear that the prefix is not the problem here. Please change the summary of this ticket to:

ghc 6.10.3_1 can't locate file for: -lgmp

comment:14 Changed 11 years ago by gale@…

Cc: gale@… added

Cc Me!

comment:15 Changed 11 years ago by ryandesign (Ryan Schmidt)

Summary: ghc 6.10.3 using hard coded /opt/localghc 6.10.3_1: can't locate file for: -lgmp on Tiger

comment:16 Changed 11 years ago by gwright@…

It may be that build.mk needs to have SRC_CC_OPTS set to include -L${prefix}/lib. As noted earlier, Tiger/pcc and Tiger/intel use different bootstrap compilers. The ghc 6.6 bootstrap compiler needed a lot of help to ensure that the right libraries and header files were found.

I'll look back at the old versions to see if anything changed.

comment:17 Changed 11 years ago by gwright@…

OK, I have reports that ghc 6.10.3 revision 4 builds successfully on both Tiger/ppc and Tiger/intel. Revision 4 backs out one of the changes in r51205, putting back the patch originally added to work around this problem. There were changes introduced upstream to 6.10.3 which were supposed to make this patch unnecessary, but they were apparently not tested with different bootstrap compilers to see if they actually worked.

If people still have trouble, they should build with the new variant cabal_configure_debug as so:

    $ sudo port ghc clean
    $ sudo port -dv ghc build +cabal_configure_debug 2>&1 | tee build.log

and send the output. The new variant patches the Makefiles to provide useful output from cabal's configuration phase, which is otherwise completely silent.

Unless I get further reports on this problem I will close this in the next few days.

comment:18 in reply to:  17 Changed 11 years ago by gale@…

Replying to gwright@…:

That should be:

    $ sudo port ghc clean
    $ sudo port -dv build ghc +cabal_configure_debug 2>&1 | tee build.log

comment:19 in reply to:  17 ; Changed 11 years ago by h8spawn@…

The current revision builds fine for me on Tiger/Intel.

comment:20 in reply to:  19 Changed 11 years ago by gwright@…

Replying to h8spawn@…:

The current revision builds fine for me on Tiger/Intel.

Thanks for the information! It looks as if revision 4 (and later) fix the problem.

comment:21 Changed 11 years ago by gwright@…

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