Skip to content
This repository

LLVM 3.1: fix compilation of Ocaml bindings #14125

Closed
wants to merge 1 commit into from

4 participants

Mathieu Baudet Charlie Sharpsteen Mike McQuaid Adam Vandenberg
Mathieu Baudet

The problem is that generating the documentation (with ocamldoc) seems to require some object files (.cmi) to be already available. For a quick fix I patched the Makefile so that the global target 'docs' comes after 'bindings'.

I also patched 2 sub-Makefiles where I suspect that the target 'ocamldoc' was hiding the intended default target.

The resulting patch on LLVM is kinda huge unfortunately...

I tested this formula with "brew install --build-from-source llvm" on MAC OS Lion with Ocaml 4.00.

Charlie Sharpsteen
Owner

That is indeed a big patch. In these cases we like to see large changes pushed upstream before we start carrying them around as patches.

Mike McQuaid
Owner

Particularly just to fix ocaml bindings.

Mathieu Baudet

Sure, no worries. At least we now have a public patch to start the conversation with the LLVM team.

Mike McQuaid
Owner

Indeed, thanks @MathieuBt. Patches are great but they (like salmon) naturally want to go upstream.

Adam Vandenberg
Owner

Seems that we're passing on this; in any case the patch doesn't apply on the current LLVM formula. Please feel free to update if there is something we should check here.

Adam Vandenberg adamv closed this October 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 11, 2012
llvm: fix compilation of Ocaml bindings ce7dc7b
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 100 additions and 1 deletion. Show diff stats Hide diff stats

  1. 101  Library/Formula/llvm.rb
101  Library/Formula/llvm.rb
@@ -21,6 +21,11 @@ class Llvm < Formula
21 21
     sha1 '940aca37dafaf69a9b378ffd2a59b3c1cfe54ced' => :snowleopard
22 22
   end
23 23
 
  24
+  def patches
  25
+    # fix generation of ocaml bindings (essentially by switching the order of compilation between docs and bindings)
  26
+    DATA
  27
+  end
  28
+
24 29
   def options
25 30
     [['--with-clang', 'Build clang C/ObjC/C++ frontend'],
26 31
      ['--shared', 'Build llvm as shared library, and link tools against it'],
@@ -49,7 +54,8 @@ def install
49 54
       "--enable-optimized",
50 55
       # As of LLVM 3.1, attempting to build ocaml bindings with Homebrew's
51 56
       # OCaml 3.12.1 results in errors.
52  
-      "--disable-bindings",
  57
+      # *** This should be fixed now. See commented patch. ***
  58
+      # "--disable-bindings",
53 59
     ]
54 60
 
55 61
     if ARGV.include? '--all-targets'
@@ -89,3 +95,96 @@ def clang_dir
89 95
     buildpath/'tools/clang'
90 96
   end
91 97
 end
  98
+__END__
  99
+diff --git a/bindings/ocaml/Makefile b/bindings/ocaml/Makefile
  100
+index a89caef..b67840a 100644
  101
+--- a/bindings/ocaml/Makefile
  102
++++ b/bindings/ocaml/Makefile
  103
+@@ -11,9 +11,9 @@ LEVEL := ../..
  104
+ DIRS = llvm bitreader bitwriter analysis target executionengine transforms
  105
+ ExtraMakefiles = $(PROJ_OBJ_DIR)/Makefile.ocaml
  106
+ 
  107
+-ocamldoc:
  108
++include $(LEVEL)/Makefile.common
  109
++
  110
++ocamldoc:
  111
+ 	$(Verb) for i in $(DIRS) ; do \
  112
+ 		$(MAKE) -C $$i ocamldoc; \
  113
+ 	done
  114
+-
  115
+-include $(LEVEL)/Makefile.common
  116
+diff --git a/bindings/ocaml/transforms/Makefile b/bindings/ocaml/transforms/Makefile
  117
+index 05fcd90..3b6064b 100644
  118
+--- a/bindings/ocaml/transforms/Makefile
  119
++++ b/bindings/ocaml/transforms/Makefile
  120
+@@ -10,9 +10,9 @@
  121
+ LEVEL := ../../..
  122
+ DIRS = scalar ipo
  123
+ 
  124
+-ocamldoc:
  125
++include $(LEVEL)/Makefile.common
  126
++
  127
++ocamldoc:
  128
+ 	$(Verb) for i in $(DIRS) ; do \
  129
+ 		$(MAKE) -C $$i ocamldoc; \
  130
+ 	done
  131
+-
  132
+-include $(LEVEL)/Makefile.common
  133
+diff --git a/Makefile b/Makefile
  134
+index ec24862..a10e3c0 100644
  135
+--- a/Makefile
  136
++++ b/Makefile
  137
+@@ -31,8 +31,8 @@ ifeq ($(BUILD_DIRS_ONLY),1)
  138
+   OPTIONAL_DIRS := tools/clang/utils/TableGen
  139
+ else
  140
+   DIRS := lib/Support lib/TableGen utils lib/VMCore lib tools/llvm-shlib \
  141
+-          tools/llvm-config tools runtime docs unittests
  142
+-  OPTIONAL_DIRS := projects bindings
  143
++          tools/llvm-config tools runtime unittests
  144
++  OPTIONAL_DIRS := projects bindings docs
  145
+ endif
  146
+ 
  147
+ ifeq ($(BUILD_EXAMPLES),1)
  148
+@@ -48,21 +48,21 @@ ifneq ($(ENABLE_SHARED),1)
  149
+ endif
  150
+ 
  151
+ ifneq ($(ENABLE_DOCS),1)
  152
+-  DIRS := $(filter-out docs, $(DIRS))
  153
++  OPTIONAL_DIRS := $(filter-out docs, $(OPTIONAL_DIRS))
  154
+ endif
  155
+ 
  156
+ ifeq ($(MAKECMDGOALS),libs-only)
  157
+-  DIRS := $(filter-out tools runtime docs, $(DIRS))
  158
++  DIRS := $(filter-out tools runtime, $(DIRS))
  159
+   OPTIONAL_DIRS :=
  160
+ endif
  161
+ 
  162
+ ifeq ($(MAKECMDGOALS),install-libs)
  163
+-  DIRS := $(filter-out tools runtime docs, $(DIRS))
  164
+-  OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
  165
++  DIRS := $(filter-out tools runtime, $(DIRS))
  166
++  OPTIONAL_DIRS := $(filter bindings docs, $(OPTIONAL_DIRS))
  167
+ endif
  168
+ 
  169
+ ifeq ($(MAKECMDGOALS),tools-only)
  170
+-  DIRS := $(filter-out runtime docs, $(DIRS))
  171
++  DIRS := $(filter-out runtime, $(DIRS))
  172
+   OPTIONAL_DIRS :=
  173
+ endif
  174
+ 
  175
+@@ -77,13 +77,13 @@ ifeq ($(MAKECMDGOALS),install-clang)
  176
+ endif
  177
+ 
  178
+ ifeq ($(MAKECMDGOALS),clang-only)
  179
+-  DIRS := $(filter-out tools docs unittests, $(DIRS)) \
  180
++  DIRS := $(filter-out tools unittests, $(DIRS)) \
  181
+           tools/clang tools/lto
  182
+   OPTIONAL_DIRS :=
  183
+ endif
  184
+ 
  185
+ ifeq ($(MAKECMDGOALS),unittests)
  186
+-  DIRS := $(filter-out tools runtime docs, $(DIRS)) utils unittests
  187
++  DIRS := $(filter-out tools runtime, $(DIRS)) utils unittests
  188
+   OPTIONAL_DIRS :=
  189
+ endif
  190
+ 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.