GHC 6.2.1 compilation fails when compiling FFI code with -prof or -O2

Bayley, Alistair Alistair_Bayley at ldn.invesco.com
Wed Apr 21 12:03:09 EDT 2004


I have an FFI program which compiles fine with GHC 6.2.1 under standard
compilation options (i.e. no optimisation etc), but not with -O2 or -prof.
With -prof/-O2 GHC compiles via C, and this seems to be causing the problem.

With -prof I get these error messages:

Compiling Database.Oracle.OCIFunctions ( ./Database/Oracle/OCIFunctions.lhs,
./Database/Oracle/OCIFunctions.o )
C:/TEMP/ghc202.hc:5:17: oci.h: No such file or directory
C:/TEMP/ghc202.hc: In function `r2Zg_entry':
C:/TEMP/ghc202.hc:133: warning: implicit declaration of function
`OCIStmtFetch'
C:/TEMP/ghc202.hc: In function `r2Zi_entry':
C:/TEMP/ghc202.hc:337: warning: implicit declaration of function
`OCIStmtExecute'
...etc...


With -O2 I get these:

Compiling Database.Oracle.OCIFunctions ( ./Database/Oracle/OCIFunctions.lhs,
./Database/Oracle/OCIFunctions.o )
C:/TEMP/ghc311.hc:5:17: oci.h: No such file or directory
C:/TEMP/ghc311.hc: In function
`DatabaseziOracleziOCIFunctions_zdwccall_entry':
C:/TEMP/ghc311.hc:1295: warning: implicit declaration of function
`OCIStmtFetch'
C:/TEMP/ghc311.hc: In function
`DatabaseziOracleziOCIFunctions_zdwccall1_entry':
C:/TEMP/ghc311.hc:1480: warning: implicit declaration of function
`OCIStmtExecute'
...etc...


I've used these command line options for normal (no -prof or -O)
compilation:
 -Lc:\orant817\bin -loci

The "oci.h" file in question is located in c:\orant817\oci\include, and
oci.dll is located in c:\orant817\bin. When I compiled with -prof I tried
adding -#include c:\orant817\oci\include\oci.h, but this produces the output
below, where files included by oci.h can't be found. The oci.h file is at
the root of quite a large .h include tree; do I have to specify every .h
file in this tree with -#include?

My ghc command:
  ghc -v -Wall  -ddump-hi -prof  -Lc:\orant817\bin -loci -#include
c:\orant817\oci\include\oci.h -fasm -o ociffi --make Main.lhs 

Output:

<snipped>
*** CodeOutput:
*** C Compiler
c:\ghc\ghc-6.2.1\gcc -Bc:\ghc\ghc-6.2.1\gcc-lib/ -x c C:\TEMP\ghc319.hc -o
C:\TEMP\ghc319.raw_s -DDONT_WANT_WIN32_DLL_SUPPORT -fno-defer-pop
-mno-omit-leaf-frame-pointer -fomit-frame-pointer -fno-builtin
-DSTOLEN_X86_REGS=4 -v -S -Wimplicit -O -D__GLASGOW_HASKELL__=602
-DPROFILING -ffloat-store -I . -I c:/ghc/ghc-6.2.1/include -I
c:/ghc/ghc-6.2.1/include/mingw
Reading specs from c:/ghc/ghc-6.2.1/gcc-lib/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as
--host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads
--disable-nls --enable-languages=f77,c++,objc,ada --disable-win32-registry
--disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)
 c:\ghc\ghc-6.2.1\gcc-lib\cc1.exe -lang-c -v -I . -I
c:/ghc/ghc-6.2.1/include -I c:/ghc/ghc-6.2.1/include/mingw -iprefix
c:\ghc\ghc-6.2.1\../lib/gcc-lib/mingw32/3.2/ -isystem
c:/ghc/ghc-6.2.1/gcc-lib/include -D__GNUC__=3 -D__GNUC_MINOR__=2
-D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D_WIN32 -D__WIN32
-D__WIN32__ -DWIN32 -D__MINGW32__ -D__MSVCRT__ -DWINNT -D_X86_=1 -D_WIN32
-D__WIN32 -D__WIN32__ -D__WIN32__ -D__MINGW32__ -D__MSVCRT__ -D__WINNT__
-D_X86_=1 -D__WIN32 -D__WINNT -Asystem=winnt -D__OPTIMIZE__
-D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__
-D__tune_i586__ -D__tune_pentium__ -D__stdcall=__attribute__((__stdcall__))
-D__cdecl=__attribute__((__cdecl__))
-D__fastcall=__attribute__((__fastcall__))
-D_stdcall=__attribute__((__stdcall__)) -D_cdecl=__attribute__((__cdecl__))
-D_fastcall=__attribute__((__fastcall__)) -D__declspec(x)=__attribute__((x))
-DDONT_WANT_WIN32_DLL_SUPPORT -DSTOLEN_X86_REGS=4 -D__GLASGOW_HASKELL__=602
-DPROFILING C:\TEMP\ghc319.hc -quiet -dumpbase ghc319.hc
-mno-omit-leaf-frame-pointer -O -Wimplicit -version -fno-defer-pop
-fomit-frame-pointer -fno-builtin -ffloat-store -o C:\TEMP\ghc319.raw_s
GNU CPP version 3.2 (mingw special 20020817-1) (cpplib) (80386, BSD syntax)
GNU C version 3.2 (mingw special 20020817-1) (mingw32)
	compiled by GNU C version 3.2.
ignoring nonexistent directory
"c:/ghc/lib/gcc-lib/mingw32/3.2/../../../../include"
ignoring nonexistent directory "c:/ghc/lib/gcc-lib/mingw32/3.2/include"
ignoring nonexistent directory
"c:/ghc/lib/gcc-lib/mingw32/3.2/../../../../mingw32/include"
ignoring nonexistent directory
"/mingw/lib/gcc-lib/mingw32/3.2/../../../../include"
ignoring nonexistent directory "/mingw/include"
ignoring nonexistent directory "/mingw/lib/gcc-lib/mingw32/3.2/include"
ignoring nonexistent directory
"/mingw/lib/gcc-lib/mingw32/3.2/../../../../mingw32/include"
ignoring nonexistent directory "/usr/local/mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 c:/ghc/ghc-6.2.1/include
 c:/ghc/ghc-6.2.1/include/mingw
 c:/ghc/ghc-6.2.1/gcc-lib/include
End of search list.
In file included from C:/TEMP/ghc319.hc:5:
c:/orant817/oci/include/oci.h:261:23: oratypes.h: No such file or directory
c:/orant817/oci/include/oci.h:265:20: ocidfn.h: No such file or directory
In file included from C:/TEMP/ghc319.hc:5:
c:/orant817/oci/include/oci.h:1419: parse error before "OCILobOffset"
c:/orant817/oci/include/oci.h:1419: warning: type defaults to `int' in
declaration of `OCILobOffset'
c:/orant817/oci/include/oci.h:1419: warning: data definition has no type or
storage class
c:/orant817/oci/include/oci.h:1429: parse error before "OCILobLength"
c:/orant817/oci/include/oci.h:1429: warning: type defaults to `int' in
declaration of `OCILobLength'
c:/orant817/oci/include/oci.h:1429: warning: data definition has no type or
storage class
c:/orant817/oci/include/oci.h:1539: parse error before
"OCIPicklerTdsElement"
c:/orant817/oci/include/oci.h:1539: warning: type defaults to `int' in
declaration of `OCIPicklerTdsElement'
c:/orant817/oci/include/oci.h:1539: warning: data definition has no type or
storage class
c:/orant817/oci/include/oci.h:1620: parse error before "OCIWchar"
c:/orant817/oci/include/oci.h:1620: warning: type defaults to `int' in
declaration of `OCIWchar'
c:/orant817/oci/include/oci.h:1620: warning: data definition has no type or
storage class
c:/orant817/oci/include/oci.h:1648:18: oci1.h: No such file or directory
c:/orant817/oci/include/oci.h:1652:17: oro.h: No such file or directory
c:/orant817/oci/include/oci.h:1656:17: ori.h: No such file or directory
c:/orant817/oci/include/oci.h:1660:17: orl.h: No such file or directory
c:/orant817/oci/include/oci.h:1664:17: ort.h: No such file or directory
c:/orant817/oci/include/oci.h:1668:21: ociextp.h: No such file or directory
c:/orant817/oci/include/oci.h:1672:20: ociapr.h: No such file or directory
c:/orant817/oci/include/oci.h:1673:19: ociap.h: No such file or directory
c:/orant817/oci/include/oci.h:1680:80: oci8dp.h: No such file or directory
c:/orant817/oci/include/oci.h:1684:21: ociextp.h: No such file or directory
C:/TEMP/ghc319.hc:6:17: oci.h: No such file or directory
C:/TEMP/ghc319.hc: In function `r2Zg_entry':
C:/TEMP/ghc319.hc:64: warning: implicit declaration of function
`OCIStmtFetch'
<snipped>


Alistair.

-----------------------------------------
*****************************************************************
Confidentiality Note: The information contained in this 
message, and any attachments, may contain confidential 
and/or privileged material. It is intended solely for the 
person(s) or entity to which it is addressed. Any review, 
retransmission, dissemination, or taking of any action in 
reliance upon this information by persons or entities other 
than the intended recipient(s) is prohibited. If you received
this in error, please contact the sender and delete the 
material from any computer.
*****************************************************************



More information about the Glasgow-haskell-users mailing list