From: Mauricio Fernandez Date: 2007-10-18T06:34:37+09:00 Subject: Re: rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml On Thu, Oct 18, 2007 at 05:17:02AM +0900, Daniel Berger wrote: > On Oct 17, 2:04 pm, Mauricio Fernandez wrote: > > On Thu, Oct 18, 2007 at 04:10:55AM +0900, Daniel Berger wrote: [...] > > > I grabbed the latest and greatest Ocaml tarball and installed it. > > > However, when I try to install rocaml I get this: > > > > > sh: camlp5: not found > > > *** extconf.rb failed *** > > > > > I have no camlp5 in /usr/local/bin. I have camlp4, however, and the > > > comments in rocaml_extconf.rb suggest that either should suffice. > > > > > What should I do? > > > > I see you solved this by installing camlp5, but I'd still like to fix the > > camlp* selection code. What does camlp4 -v return for you? [...] > > The code that detects camlp5 is > > > > have_camlp5 = ! `camlp5 -v 2>&1`["version"].empty? > > > > For some reason it didn't work properly but I can't see why. Any idea? > > If camlp5 isn't found, you'll end up with nil. Changing 'empty?' to > 'nil?' should do the trick, although people will still see a "sh: > camlp5: not found" echoed to stdout, which may be confusing. That's what 2>&1 is meant to prevent, but you're very right, it should be nil?. Now I wonder why you didn't get a NoMethodError. > Any ideas on the make failure? Yes, the native code compilers are missing, see my other message for a couple solutions. There was another bug in the code that detects whether they are present; I have pushed the fix to the repository at http://eigenclass.org/repos/rocaml/head/ and it will be in the next tarball, 0.6.1, to follow shortly. Wed Oct 17 23:29:10 CEST 2007 Mauricio Fernandez * rocaml_extconf.rb: fixed native compiler detection. Wed Oct 17 23:21:08 CEST 2007 Mauricio Fernandez * rocaml_extconf.rb: fix camlp[45] detection. diff -rN -u old-rocaml/rocaml_extconf.rb new-rocaml/rocaml_extconf.rb --- old-rocaml/rocaml_extconf.rb 2007-10-17 23:29:42.000000000 +0200 +++ new-rocaml/rocaml_extconf.rb 2007-10-17 23:29:42.000000000 +0200 @@ -43,7 +43,7 @@ exit end -maybe_opt = lambda{|x| opt = "#{x}.opt"; system(x) ? opt : x } +maybe_opt = lambda{|x| opt = "#{x}.opt"; system(opt) ? opt : x } if OCAML_PACKAGES.empty? then OCAMLC = maybe_opt["ocamlc"] @@ -91,9 +91,9 @@ # determine whether camlp4 (or camlp5) can be used: -have_camlp5 = ! `camlp5 -v 2>&1`["version"].empty? +have_camlp5 = ! `camlp5 -v 2>&1`["version"].nil? camlp4version = `camlp4 -v 2>&1`[/version\s+(\d.*)/, 1] -have_camlp4 = ! camlp4version.empty? +have_camlp4 = ! camlp4version.nil? pa_rocaml_revdeps = Dir["*.ml"].map do |f| "#{f.sub(/\.ml$/, ".cmx")}: pa_rocaml.cmo" -- Mauricio Fernandez - http://eigenclass.org - singular Ruby