haskell - Cabal selects wrong linker -


i working on haskell program linked old c++ code. created c interface , got working ghc only. tried convert used makefile cabal project , cabal on last step selects wrong linker.

because of dependencies have use quite old ghc , gcc. doing calling cabal (1.24.0.0.) this:

cabal install --with-ghc=ghc-7.6.3 --with-gcc=/opt/gcc-3.3.6/bin/gcc  --with-ld=/opt/gcc-3.3.6/bin/gcc 

for compile- , intermediate configure linking ok, -v3 following lines:

using gcc version 3.3.6 given user at: /opt/gcc-3.3.6/bin/gcc using ghc version 7.6.3 given user at: /home/oswald/ghcs/bin/ghc-7.6.3 ... using ld given user at: /opt/gcc-3.3.6/bin/gcc 

all works fine until final linking step:

linking dist/dist-sandbox-c45ed4c7/build/miscconfig/miscconfig ... *** c compiler: '/opt/gcc-3.3.6/bin/gcc' '-c' '/tmp/ghc28340_0/ghc28340_0.c' '-o' ...                *** c compiler: '/opt/gcc-3.3.6/bin/gcc' '-c' '/tmp/ghc28340_0/ghc28340_0.s' '-o' ...     *** linker: '/usr/bin/gcc' '-fno-stack-protector' '-wl,--hash-size=31' '-w 

so last line specifies /usr/bin/gcc linker, system 1 , therefore link errors should /opt/gcc-3.3.6/bin/gcc (have use pre-3.4.0 gcc because of link compatibility 1 of used c++ libraries , gcc 3.3.6 latest old abi).

so doing wrong? cabal says selects linker old gcc uses newer 1 system?

when use ghc -pgmc /opt/gcc-3.3.6/bin/gcc switch in makefile works prefer cabal sandbox working...

this apparently had nothing cabal, not instruct ghc use c compiler specified cabal option --with-gcc.

use -pgml select linker documented on ghc man page.

(one point may cause confusion others , worth mentioning. ghc uses c compiler final link step. means -pgml must refer gcc, not ld. consequently flags intended consumed ld such -rpath must prefixed -wl, before being fed -optl.)


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -