Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native code compiler for 32-bit OS X #6900

Closed
vicuna opened this issue Jun 10, 2015 · 7 comments
Closed

Native code compiler for 32-bit OS X #6900

vicuna opened this issue Jun 10, 2015 · 7 comments

Comments

@vicuna
Copy link

vicuna commented Jun 10, 2015

Original bug ID: 6900
Reporter: mansourmoufid
Assigned to: @shindere
Status: assigned (set by @shindere on 2016-12-13T09:06:57Z)
Resolution: open
Priority: normal
Severity: minor
Platform: x86_64
OS: OS X
OS Version: 10.9
Version: 4.02.1
Category: configure and build/install
Tags: patch
Related to: #4863 #4867 #5012 #5105
Monitored by: gerd

Bug description

I would like to build OCaml with native code compiler for i386 on OS X x86_64.

./configure -cc "clang -arch i386" -aspp "clang -arch i386 -c" -as "as -arch i386"
make world
make bootstrap
make opt

I get the linker error:

ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in _caml_program from /.../camlstartup9cd257.o.

I modified the configure script to set natdynlink to true for i[3456]86--darwin, add the "-fPIC" compiler flag, and add the "-read_only_relocs suppress" option for the linker.

The native code compiler builds find now.

File attachments

@vicuna
Copy link
Author

vicuna commented Jun 11, 2015

Comment author: @damiendoligez

This patch looks good except for the "-read_only_relocs suppress" part. This option has caused a fair amount of trouble in the past: see #4863, #4867, #5012.

My guess is that we'll have to determine which versions of MacOS don't like this option, and if they are old enough, explicitly drop support for them.

@vicuna
Copy link
Author

vicuna commented Jun 11, 2015

Comment author: @damiendoligez

Also, out of curiosity why do you need to compile 32-bit MacOS programs?

@vicuna
Copy link
Author

vicuna commented Jun 16, 2015

Comment author: mansourmoufid

Sorry, I was confusing two separate issues.

The first was the warning about PIE.

The second is an "illegal text-relocation" error when building the native code compiler:

ld: illegal text-relocation to '_caml_curry7_1_app' in unix.cmxs.startup.o from '_caml_curry7' in unix.cmxs.startup.o for architecture i386

The "-read_only_relocs suppress" options stops this error, but you are right that it is not good for x86_64.

I tried using the same build options as for i[3456]86--darwin[89]. and everything works fine now:

./configure -host "i386-apple-darwin13.4.0" -cc "clang -arch i386" -aspp "clang -arch i386 -c" -as "as -arch i386" && make world && make bootstrap && make opt

I do still see the PIE warning but that's not a big deal.

My original reason for compiling for i386 is that I am using pkgsrc on OS X and some other packages only work with the 32-bit ABI.

@vicuna
Copy link
Author

vicuna commented Jun 23, 2015

Comment author: gerd

I just also ran into the "illegal text-relocation" issue, for ocaml-4.02.2 on OSX 10.10. Fortunately, I do not need shared library support for my application (building a cross-compiler for armv7), so -no-shared-libs is an applicable workaround.

@vicuna
Copy link
Author

vicuna commented Mar 15, 2017

Comment author: @damiendoligez

See also MP#692 ( #692 )

@ejgallego
Copy link

I am very far from being an expert on the platform, but some users of the 32bit compiler in OSX did report that support for 32 binaries is deprecated in newer OSX developer tools.

Does that mean that 32bit OSX support is going to disappear [forced by upstream]?

@nojb
Copy link
Contributor

nojb commented Mar 15, 2019

Does that mean that 32bit OSX support is going to disappear [forced by upstream]?

Yes. Support for this architecture has already been removed from trunk: #2278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants