| Anonymous | Login | Signup for a new account | 2013-06-19 21:56 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0004877 | OCaml | OCaml general | public | 2009-09-30 20:46 | 2012-09-17 17:34 | ||||||
| Reporter | kiyoshi | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 3.11.1 | ||||||||||
| Target Version | 4.01.0+dev | Fixed in Version | |||||||||
| Summary | 0004877: Definition of uint64 in caml/config.h conflicts. (MacOSX Snow Leopard, X86_64) | ||||||||||
| Description | Conflict of the uint64 definition prevents to define external functions using Cocoa API. $ cat test.m #include <caml/config.h> #import <Cocoa/Cocoa.h> $ cc -I /opt/local/lib/ocaml test.m In file included from /System/Library/Frameworks/Security.framework/Headers/Security.h:24, from /System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:14, from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:79, from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12, from test.m:2: /System/Library/Frameworks/Security.framework/Headers/cssmconfig.h:53: error: conflicting types for ‘uint64’ /opt/local/lib/ocaml/caml/config.h:128: error: previous declaration of ‘uint64’ was here $ sed -n 53p < /System/Library/Frameworks/Security.framework/Headers/cssmconfig.h typedef uint64_t uint64; $ grep "typedef.*uint64_t;" /usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h typedef unsigned long long uint64_t; $ sed -n 128p < /opt/local/lib/ocaml/caml/config.h typedef ARCH_UINT64_TYPE uint64; $ grep "#define.*ARCH_UINT64_TYPE" /opt/local/lib/ocaml/caml/config.h #define ARCH_UINT64_TYPE unsigned long $ A patch attached to this report will resolve this problem. I guess ppc64 architecture also has same problem and this patch resolve it. | ||||||||||
| Additional Information | $ uname -v Darwin Kernel Version 10.0.0: Fri Jul 31 22:47:34 PDT 2009; root:xnu-1456.1.25~1/RELEASE_I386 $ sw_vers ProductName: Mac OS X ProductVersion: 10.6.1 BuildVersion: 10B504 $ port version Version: 1.8.1 $ port list installed | grep ocaml ocaml @3.11.1 lang/ocaml $ cc -verson i686-apple-darwin10-gcc-4.2.1: no input files $ | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Relationships |
|||||||||||
|
|||||||||||
Notes |
|
|
(0005232) monipol (reporter) 2010-01-22 04:00 |
Hello, kiyoshi. Does your patch prevent uint64 from being defined on Mac OS X? What if <caml/config.h> is being used by a non-Cocoa, non-Carbon program that's supposed to build on Mac OS X — wouldn't uint64 need to be defined by OCaml then? One alternative solution would be config.h to consider a new macro that would determine whether config.h should define those types or not. For what it's worth, this issue also affects Mac OS 10.5 (Leopard) when building 64-bit programs that use both Cocoa and OCaml. |
|
(0005234) kiyoshi (reporter) 2010-01-28 12:33 |
Hi, monipol. > Does your patch prevent uint64 from being defined on Mac OS X? No. My patch only affects lines on "m.h" generated by config script. Please look at the config file affected by my patch: --- echo "#define SIZEOF_PTR $3" >> m.h echo "#define SIZEOF_SHORT $4" >> m.h -if test $2 = 8; then +if test $2 = 8 && $system != macosx; then echo "#define ARCH_INT64_TYPE long" >> m.h echo "#define ARCH_UINT64_TYPE unsigned long" >> m.h echo '#define ARCH_INT64_PRINTF_FORMAT "l"' >> m.h int64_native=true else sh ./runtest longlong.c case $? in 0) echo "64-bit \"long long\" integer type found (printf with \"%ll\")." echo "#define ARCH_INT64_TYPE long long" >> m.h echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h echo '#define ARCH_INT64_PRINTF_FORMAT "ll"' >> m.h int64_native=true;; --- Execution of original configure script on 64-bit Mac OS X processes 'then' part, so uint64 is defined as "long". This type is not equals to "long long", the type of uint64 defined in /System/Library/Frameworks/Security.framework/Headers/cssmconfig.h. In the case of the script my patch applied, "else" pat is executed. Execution of "runtiest longlong.c" returns 0, so uint64 is defined as "long long", and the result is no type conflict errors. I think that you can select 64/32-bit binary with C-compiler options so that "runtest sizes.c" returns the expected value: --- echo "Checking the sizes of integers and pointers..." set `sh ./runtest sizes.c` case "$2,$3" in 4,4) echo "OK, this is a regular 32 bit architecture." echo "#undef ARCH_SIXTYFOUR" >> m.h arch64=false;; *,8) echo "Wow! A 64 bit architecture!" echo "#define ARCH_SIXTYFOUR" >> m.h arch64=true;; *,*) echo "This architecture seems to be neither 32 bits nor 64 bits." echo "Objective Caml won't run on this architecture." exit 2;; *) echo "Unable to compile the test program." echo "Make sure the C compiler $cc is properly installed." exit 2;; --- For example, 'configure -cc "cc -arch x86_64"; make world' on Mac OS X 10.5 will generate 64-bit binaries. |
|
(0008096) doligez (manager) 2012-09-17 17:34 |
Watch out, there is a bug in the patch. This problem should be properly solved when we fix PR#4164. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2009-09-30 20:46 | kiyoshi | New Issue | |
| 2009-09-30 20:46 | kiyoshi | File Added: patch-configure.diff | |
| 2010-01-22 04:00 | monipol | Note Added: 0005232 | |
| 2010-01-28 12:33 | kiyoshi | Note Added: 0005234 | |
| 2011-05-31 16:51 | doligez | Status | new => acknowledged |
| 2012-07-11 14:50 | doligez | Target Version | => 4.01.0+dev |
| 2012-07-31 13:36 | doligez | Target Version | 4.01.0+dev => 4.00.1+dev |
| 2012-09-17 17:34 | doligez | Note Added: 0008096 | |
| 2012-09-17 17:34 | doligez | Target Version | 4.00.1+dev => 4.01.0+dev |
| 2012-09-17 17:34 | doligez | Relationship added | related to 0001956 |
| 2012-09-17 17:34 | doligez | Relationship added | related to 0004164 |
| Copyright © 2000 - 2011 MantisBT Group |