Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005247OCamlOCaml generalpublic2011-04-04 14:292012-04-10 18:26
Reporterjohnwhitington 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version3.12.0 
Target VersionFixed in Version 
Summary0005247: Building 64 bit for OS X 10.6 builds some libraries as 32 bit
DescriptionHi,

Have tried this with both ./configure and ./configure -cc "gcc -m64" -as "as -arch x86_64" -aspp "gcc -m64 -c". I'm using XCode 4.0

fresh:ocaml-3.12.0 john$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)

fresh:ocaml-3.12.0 john$ lipo -info /usr/local/lib/ocaml/*.a
Non-fat file: /usr/local/lib/ocaml/bigarray.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/camomile.a is architecture: i386
Non-fat file: /usr/local/lib/ocaml/dbm.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/dynlink.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/graphics.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libasmrun.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libasmrunp.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libbigarray.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libcamlrun.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libcamlstr.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libgraphics.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libmldbm.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libnums.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libstr.a is architecture: i386
Non-fat file: /usr/local/lib/ocaml/libthreads.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libthreadsnat.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/libunix.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/nums.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/stdlib.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/stdlib.p.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/str.a is architecture: x86_64
Non-fat file: /usr/local/lib/ocaml/unix.a is architecture: x86_64

As you can see, camomile.a and libstr.a are 32 bit here.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005861)
johnwhitington (reporter)
2011-04-04 15:26

Actually, it seems to not be possible to build any architecture of ocaml with Xcode 4 at the moment. The 32-bit version fails in make opt.opt with

../ocamlcompopt.sh -nostdlib unix.cmxa -g -I stdlib -I ../otherlibs/unix ocamlbuild/ocamlbuild_executor.cmx ocamlbuild/ocamlbuild_pack.cmx ocamlbuild/ocamlbuild_unix_plugin.cmx ocamlbuild/ocamlbuild.cmx -o ocamlbuild/ocamlbuild.native
ld: in ocamlbuild/ocamlbuild_pack.o, in section __DATA,__data reloc 1: sectionForAddress(0x4028458) address not in any section for architecture i386
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
Exit code 2 while executing this command:
  ../ocamlcompopt.sh -nostdlib unix.cmxa -g -I stdlib -I ../otherlibs/unix ocamlbuild/ocamlbuild_executor.cmx ocamlbuild/ocamlbuild_pack.cmx ocamlbuild/ocamlbuild_unix_plugin.cmx ocamlbuild/ocamlbuild.cmx -o ocamlbuild/ocamlbuild.native
make: *** [ocamlbuild.native] Error 2
(0005862)
johnwhitington (reporter)
2011-04-04 16:14

A second thought about the original bug content: I think camomile.a and libstr.a might just have been left over from the previous installation?

I'm afraid I'm in the midst of degrading to XCode 3 and earlier gcc so I can get back to work, so I can't find out what the timestamps on those files were.
(0005864)
johnwhitington (reporter)
2011-04-05 13:22

So, it turns out that even with XCode 3.2 under OS X 10.6, you need

sudo ln /usr/local/lib/ocaml/libcamlstr.a /usr/local/lib/ocaml/libstr.a

to get things working. So perhaps there have been changes to how gcc deals with things like -lstr, or changes to how ocaml detects what library names are needed on OS X.
(0005881)
doligez (administrator)
2011-05-03 11:48

I can't reproduce this problem with XCode 3.2.3 on Mac OS 10.6.
Can you give us a repro case? What do you mean by "to get things working"?
(0005882)
johnwhitington (reporter)
2011-05-09 17:28

Have just reinstalled the OS and XCode from scratch here, and can't reproduce either. So the bug is just XCode 4, as listed in the first comment.
(0005932)
Alan Schmitt (reporter)
2011-05-27 17:32

I'm seeing a similar problem: there is no "libstr.a" and any attempt to link with "-lstr" fail. Creating a link from libstr.a to libcamlstr.a solves the issue.

I'm using 10.6.7, Xcode 3.5.2, and ocaml 3.12.0 (compiled with godi).
(0006158)
johnwhitington (reporter)
2011-10-07 19:14

Note that this issue is still present in XCode 4.1, OS X 10.7 Lion, OCaml 3.12.1 64 bit.

(I built OCaml using mmottl's patch to 3.12.1 in bug 4863).

sudo ln /usr/local/lib/ocaml/libcamlstr.a /usr/local/lib/ocaml/libstr.a

still fixes it.
(0007316)
doligez (administrator)
2012-04-10 18:24

libstr.a was changed to libcamlstr.a to make OCaml compatible with a third-party library (commit 9318: "resolve name clash with ossp-str").

But this should be transparent to almost all OCaml users because you are not supposed to link with "-lstr". You should just link with str.cma, and the OCaml compiler pulls the right .a file (which happens to be libcamlstr.a).
If you want to link your program with gcc or ld, you'll need to track the change from libstr.a to libcamlstr.a.

So yes, the libstr.a file was a leftover from a previous build. I'm pretty sure the same is true of camomile.a since it's not part of the OCaml distribution.

- Issue History
Date Modified Username Field Change
2011-04-04 14:29 johnwhitington New Issue
2011-04-04 15:26 johnwhitington Note Added: 0005861
2011-04-04 16:14 johnwhitington Note Added: 0005862
2011-04-05 13:22 johnwhitington Note Added: 0005864
2011-05-03 11:48 doligez Note Added: 0005881
2011-05-03 11:48 doligez Status new => feedback
2011-05-09 17:28 johnwhitington Note Added: 0005882
2011-05-27 17:32 Alan Schmitt Note Added: 0005932
2011-10-07 19:14 johnwhitington Note Added: 0006158
2012-04-10 18:24 doligez Note Added: 0007316
2012-04-10 18:26 doligez Status feedback => resolved
2012-04-10 18:26 doligez Resolution open => no change required


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker