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

4.00.0+beta2 fails to compile with llvm/clang 3.1 on OS X #5643

Closed
vicuna opened this issue Jun 9, 2012 · 13 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link

commented Jun 9, 2012

Original bug ID: 5643
Reporter: mww
Status: closed (set by @xavierleroy on 2015-12-11T18:07:02Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: Darwin/Intel
OS: Mac OS X
OS Version: 10.6.4
Version: 3.12.1
Fixed in version: 4.00.0+dev
Category: configure and build/install

Bug description

The 4.00.0+beta2 fails to compile with clang/llvm from XCode 4.3.2:

When building with the default compiler (clang) on OS X 10.7 with XCode 4.3.2, the build of ocaml fails.

Steps to reproduce

./configure -no-tk -cc cc -aspp 'cc -c'
make world.opt

OR more explicitely:

./configure -no-tk -cc /usr/bin/clang -aspp '/usr/bin/clang -c'
make world.opt

Additional information

'cc' points to '/usr/bin/clang' by default with the Apple developer tools on this platform/version;

a build log of the failed compilation can be found here:
http://build.macports.org/builders/buildports-lion-x86_64/builds/1562/steps/compile/logs/stdio

The error looks as follows:

../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g ./Compflags pervasives.cmx -c pervasives.ml
/tmp/camlasm1f3d36.s:636:Unknown pseudo-op: .cfi_startproc
/tmp/camlasm1f3d36.s:678:Unknown pseudo-op: .cfi_endproc
/tmp/camlasm1f3d36.s:684:Unknown pseudo-op: .cfi_startproc
/tmp/camlasm1f3d36.s:686:Unknown pseudo-op: .cfi_adjust_cfa_offset
/tmp/camlasm1f3d36.s:686:Rest of line ignored. 1st junk character valued 56 (8).

File attachments

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 9, 2012

Comment author: @protz

Does it help if you edit config/Makefile after the configure step and set ASM_CFI_SUPPORTED to false?

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 9, 2012

Comment author: mww

yes, that fixes it!

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 11, 2012

Comment author: @ygrek

Please, can you run configure with -verbose option?

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 12, 2012

Comment author: mww

log of
$> ./configure -no-tk -cc /usr/bin/clang -aspp '/usr/bin/clang -c' -verbose
is attached as configure-verbose.txt

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 12, 2012

Comment author: @ygrek

As far as I understand clang supports CFI and it was correctly detected. But looks like ocamlopt is not calling clang, can you run the failing command with -verbose switch? i.e. :

../boot/ocamlrun ../ocamlopt -verbose -warn-error A -nostdlib -g ./Compflags pervasives.cmx -c pervasives.ml

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 12, 2012

Comment author: @ygrek

Ah, indeed, configure sets assembler to 'as'. Try

./configure -cc cc -aspp 'cc -c' -as 'cc -c'

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 13, 2012

Comment author: mww

With
$> /configure -cc /usr/bin/clang -aspp '/usr/bin/clang -c' -as '/usr/bin/clang -c' -no-tk -verbose
the build fails with

...
../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g ./Compflags printexc.cmx -c printexc.ml
/var/folders/9s/m9j8wht52_sgdk9f9mrk7j5r0000gn/T/camlasm1a3812.s:826:9: error: line number less than one in '.loc' directive
.loc 2 0
^
/var/folders/9s/m9j8wht52_sgdk9f9mrk7j5r0000gn/T/camlasm1a3812.s:870:9: error: line number less than one in '.loc' directive
.loc 2 0
^

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 13, 2012

Comment author: mww

The full log of configure and build with
$> /configure -cc /usr/bin/clang -aspp '/usr/bin/clang -c' -as '/usr/bin/clang -c' -no-tk -verbose
are in the attached files configure-log.txt and build-log.txt.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 13, 2012

Comment author: @ygrek

Obvious fix attached, please test

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 13, 2012

Comment author: mww

compiles with 'loc-line-numbers.diff'

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 13, 2012

Comment author: @ygrek

Please disregard loc-line-numbers.diff as it hides the real problem.
Zero line numbers were emitted because physical comparison was used to detect dummy debuginfo. But Debuginfo.t values are stored in cmx files and after unmarshalling Debuginfo.is_none fails to detect all dummy values. Attached is a patch to use structural comparison for Debuginfo.t (debuginfo-is-none.diff)

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 13, 2012

Comment author: @ygrek

Prevent the original problem by checking that both $as and $aspp understand CFI directives (configure-cfi-detect.diff)

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 17, 2012

Comment author: @xavierleroy

Applied the last two patches (debuginfo-is-none and configure-cfi-detect) in 4.00 branch (r12610) and in trunk (r12611).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.