Search code examples
haskellgccghcffi

GCC called from GHC cannot find generated file


I have a project which uses the FFI to interact with some C++ code. I upgraded GHC to 7.10.3 and now the project doesn't compile anymore.

I have to use a quite old gcc (3.3.6) and it is called with this line:

ghc ${DEFINES}  ${INCLUDES} ${LIBDIRS} -pgmc /opt/gcc-3.3.6/bin/gcc MISCconfigTest.hs csrc/MISCconfig_c.cpp ${LIBRARIES}

Since the ghc upgrade, the following error is raised:

gcc: @/tmp/ghc19542_0/ghc_2.rsp: No such file or directory

Does anybody have an idea what's wrong?

EDIT:

This is the output of ghc -v3:

Hsc static flags: 
Created temporary directory: /tmp/ghc29748_0
*** C Compiler:
/opt/gcc-3.3.6/bin/gcc -D__OMNIORB4__ -D__x86__ -D__linux__ '-D__OSVERSION__=2' -DS2K_NAMESPACE -DUSE_NESTED_TEMPLATES -DIL_STD -D_REENTRANT -DS2K_LINUX -DUSE_STD_ALLOCATORS -DREDEFINE_STRING -DTCL_THREADS -x 'c++' csrc/MISCconfig_c.cpp -o /tmp/ghc29748_0/ghc_1.s -S '-D__GLASGOW_HASKELL__=710' -include /home/oswald/ghcs/ghc-7.10.3/lib/ghc-7.10.3/include/ghcversion.h -I/development/GECCOS_MUM/RELEASE3.1_W-03/core-stl-rep/include -I/development/GECCOS_MUM/RELEASE3.1_W-03/core-utilities-rep/include -I/development/GECCOS_MUM/RELEASE3.1_W-03/core-comm-rep/include -I/development/GECCOS_MUM/RELEASE3.1_W-03/model-cpd-rep/include -I/opt/omniORB-4.1.0/include/omniORB4 -I/opt/omniORB-4.1.0/include -I/development/GECCOS_MUM/RELEASE3.1_W-03/_generated -I/development/GECCOS_MUM/RELEASE3.1_W-03/../COTS/core-build-rep/include -I/home/oswald/ghcs/ghc-7.10.3/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/include -I/home/oswald/ghcs/ghc-7.10.3/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include -I/home/oswald/ghcs/ghc-7.10.3/lib/ghc-7.10.3/include
gcc: @/tmp/ghc29748_0/ghc_2.rsp: No such file or directory
gcc: no input files
*** Deleting temp files:
Deleting: /tmp/ghc29748_0/ghc_2.rsp /tmp/ghc29748_0/ghc_1.s
Warning: deleting non-existent /tmp/ghc29748_0/ghc_1.s
*** Deleting temp dirs:
Deleting: /tmp/ghc29748_0
make: *** [MISCconfig] Error 1

I don't know the structure of the intermediate files that ghc generates, but it looks like that gcc gets a temporary .s file and the .rsp file is referenced inside?


Solution

  • New ghcs use response files to work around windows limitations on path length. The at sign syntax is part of how response files work. However it appears (see the second link) that response file support was added to gcc subsequent to the old version of gcc you use. So while that pins down the source of the problem, I'm afraid no particularly great answer springs to mind on how to address it :-/.