Hatena::Groupocaml-nagoya

Happy OCaml!!

2009-09-02

SnowLeopardでOCamlは動くよ。しかも64bitで

| はてなブックマーク - SnowLeopardでOCamlは動くよ。しかも64bitで - Happy OCaml!!

生協にジュースを買いに行ったら、なぜかSnowLeopardを買ってしまいました。

とりあえず最新のMacPortsを入れてport install ocamlをしたら、あっさりocamlがインストールできました。

しかも64bitでビルドされていました。

$ ocaml
        Objective Caml version 3.11.1

# Sys.word_size;;
- : int = 64

f:id:mzp:20090902203631p:image

これで、31bitのintに苦しめられることもありません。やったね!

MafrapaMafrapa2012/04/15 00:41I spupsoe that sounds and smells just about right.

jfbmokdjewjfbmokdjew2012/04/16 20:16XHXo3s , [url=http://nnqycehppvhh.com/]nnqycehppvhh[/url], [link=http://gglviieziarp.com/]gglviieziarp[/link], http://gfpfgeltcirt.com/

2009-08-02

Macでxml-lightを使おう

| はてなブックマーク - Macでxml-lightを使おう - Happy OCaml!!

xml-light便利ですよね。厳密なスキーマのチェックとかが要らなくて、とりあえずXMLを扱いたいときとかにぴったり。

でもMacPortsxml-lightをインストールしても、ocamlfindから見えなくて結構不便です。

なんとかしましょう。

何が問題なの?

# xml-lightをインストールした!
$ sudo port install xml-light
....
# でもocamlfindからは見えない><
$ ocamlfind list | grep xml-light

なぜocamlfindから見えないかというと、xml-lightのMakefileがocamlfindに対応していないからです。

ここで解決方法は2つあります。

  1. 自分でxml-lightをビルドする
  2. ボクの作ったPortfileを使う

方法1:自分でxml-lightをビルドする

普通にビルドする。うっかりmake installしちゃわないように注意してください。

$ wget http://tech.motion-twin.com/zip/xml-light-2.2.zip
$ unzip xml-light-2.2.zip
$ cd xml-light
$ make all
$ make opt

適当にMETAファイルを作ってやる。ボクは以下の内容をMETAというファイルに保存して使ってます。

name="xml-light"
version="2.2"
description="minimal XML parser & printer"
requires=""
archive(byte) = "xml-light.cma"
archive(native) = "xml-light.cmxa"

ocamlfindを使ってインストールする。

$ vi META
# 上記の内容を保存する
....

$ ocamlfind install xml-light META xml-light.a xml-light.cma xml-light.cmxa *.cmo *.cmi *.cmx *.cmx"

これでocamlfindから使えるようになりました。

$ ocamlfind list | grep xml-light
xml-light           (version: 2.2)

方法2: ボクの作ったPortfileを使う

上で書いた内容をやってくれるPortfileを作りました。

port installするだけでxml-lightをインストールできます。

$ wget http://howdyworld.org/patches/Portfile
$ sudo port install
$ ocamlfind list | grep xml-light
xml-light           (version: 2.2)
Portfile

念のためPortfileの中身をここにも貼っておきますね。META.zipは、上記のMETAファイルをzipで圧縮しただけのファイルです。

# $Id: $
PortSystem        1.0
name              caml-xml-light
version           2.2
categories        devel,ml
maintainers       mzpppp@gmail.com
description       Objective Caml interface for XML parsing and printing with ocamlfind
long_description  XML Light is a minimal XML parser & printer for OCaml. \
		  It provide functions to parse an XML document into an \
		  OCaml data structure, work with it, and print it back \
		  to an XML document.
homepage          http://tech.motion-twin.com/xmllight/
distfiles	  xml-light-${version}.zip:master META.zip:patch
master_sites      http://tech.motion-twin.com/zip/:master \
		  http://howdyworld.org/patches/:patch

checksums         xml-light-${version}.zip md5 7658985cfdaeeb94b579b932eeaa3e00 \
		  META.zip  md5  7d48a50a3918d7de1d772d83b6700d9d
use_zip		  yes
use_configure	  no
worksrcdir	  xml-light
build.target	  all opt

depends_lib         port:ocaml \
                    port:caml-findlib

destroot.cmd	    ocamlfind
destroot.target	    install

pre-destroot {
    set ocaml_site_path [exec ocamlfind printconf destdir]
}

destroot {
    set ocaml_site_path [exec ocamlfind printconf destdir]
    file mkdir ${destroot}/${ocaml_site_path}
    system "cd ${worksrcpath} && ocamlfind install -destdir ${destroot}/${ocaml_site_path} xml-light META xml-light.a xml-light.cma xml-light.cmxa *.cmo *.cmi *.cmx *.cmx"
}

propellapropella2009/08/08 08:32書いてある通りにしたら上手く行きました。ありがとうございます!

2009-07-05

omakeをインストールしよう

| はてなブックマーク - omakeをインストールしよう - Happy OCaml!!

MacPortsomakeをインストールしようとすると、 omakeがインストールできない - そんな話はいつでもできるって怒られてしまいます。

OCaml3.11でomakeをビルドすると、発生するらしいです。

そんなときは慌てず騒がず、/opt/local/src/exec/omake_exec.mlからsyncをコメントアウトしましょう。

(* external sync : unit -> unit = "caml_sync" *)

パッチが、もうでてるんで、そのうち直るでしょう。

LenLen2012/04/15 03:12Articles like this just make me want to visit your wesbite even more.

xkfedqyptxkfedqypt2012/04/15 13:00Q7HOHE <a href="http://bnqleelrubpe.com/">bnqleelrubpe</a>

AagibpaggiptAagibpaggipt2018/04/09 18:00 This condition is very limited by the reproductive system and can have several causes like a result of injury or abnormal blood circulation within the testicles. He is content, along with the the complete opposite of what we think old age has in store for us.
https://www.cialissansordonnancefr24.com/sildenafil-et-cialis/

AHauhsoychoabsAHauhsoychoabs2018/06/30 23:30Pression arterielle est comment calleux votre sang pousse contre les parois de vos arteres lorsque votre coeur essence pompe le sang. Arteres sont les tubes qui transportent perseverent b gerer offre sang loin de votre coeur. Chaque temps votre coeur bat, il pompe le sang tout au long vos arteres a la flanerie de votre corps.
https://www.cialispascherfr24.com/cialis-douleurs-jambes/

AlbertSoomoAlbertSoomo2018/09/07 20:28The prostate is an essential part of a male's reproductive system. It secretes fluids that assist the transportation and activation of sperm. The prostate can be found just as you're watching rectum, below the bladder and around the urethra. When there is prostate problem, it will always be very uncomfortable and inconvenient for your patient as his urinary product is directly affected.

The common prostate health problems are prostate infection, enlarged prostate and cancer of prostate.



Prostate infection, also referred to as prostatitis, is easily the most common prostate-related problem in men younger than 55 yrs . old. Infections with the prostate gland are classified into four types - acute bacterial prostatitis, chronic bacterial prostatitis, chronic abacterial prostatitis and prosttodynia.

Acute bacterial prostatitis may be the least common of forms of prostate infection. It is due to bacteria located in the large intestines or urinary tract. Patients may experience fever, chills, body aches, back pains and urination problems. This condition is treated by using antibiotics or non-steroid anti-inflammatory drugs (NSAIDs) to ease the swelling.

Chronic bacterial prostatitis is often a condition associated with a particular defect within the gland along with the persistence presence of bacteria within the urinary tract. It can be caused by trauma towards the urinary tract or by infections via other areas from the body. A patient may experience testicular pain, small of the back pains and urination problems. Although it is uncommon, it may be treated by removal of the prostate defect as well as the utilization antibiotics and NSAIDs to treat the soreness.

Non-bacterial prostatitis is the reason for approximately 90% of all prostatitis cases; however, researchers have not even to ascertain the causes of these conditions. Some researchers believe that chronic non-bacterial prostatitis occur because of unknown infectious agents while other think that intensive exercise and heavy lifting may cause these infections.

Maintaining a Healthy Prostate

To prevent prostate diseases, an effective diet is important. These are some of the actions you can take to keep your prostate healthy.

1. Drink sufficient water. Proper hydration is necessary for health and wellness and will also also keep your urinary track clean.

2. Some studies claim that a few ejaculations each week will prevent cancer of the prostate.

3. Eat steak without excess. It has been shown that consuming a lot more than four meals of beef every week will heighten the probability of prostate diseases and cancer.

4. Maintain a proper diet with cereals, vegetable and fruits to make certain sufficient intake of nutrients essential for prostate health.

The most significant measure to take to ensure a proper prostate is always to opt for regular prostate health screening. If you are forty years of age and above, you need to go for prostate examination one or more times 12 months.

2009-03-11

ocamloptでユニバーサルバイナリが作りたい

| はてなブックマーク - ocamloptでユニバーサルバイナリが作りたい - Happy OCaml!!

何が問題なの?

ocamloptで実行ファイルを作っても、単一のアーキテクチャでしか動かない><。

$ ocamlopt hello.ml -o hello
$ file hello
hello-i386: Mach-O executable i386

"-ccopt"で-archを複数指定してやればいいと思いきや、それでもうまく動かない><。

$ ocamlopt -ccopt "-arch i386 -arch ppc" hello.ml
ld warning: in /var/folders/ER/ERpTAvKHGAeST-apMbQus++++TI/-Tmp-/camlstartup73a88f.o, file is not of required architecture
ld warning: in /opt/manual/ocaml-spot/lib/ocaml/std_exit.o, file is not of required architecture
ld warning: in hello.o, file is not of required architecture
ld warning: in /opt/manual/ocaml-spot/lib/ocaml/stdlib.a, file is not of required architecture
ld warning: in /opt/manual/ocaml-spot/lib/ocaml/libasmrun.a, file is not of required architecture
Undefined symbols for architecture ppc:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found for architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/ER/ERpTAvKHGAeST-apMbQus++++TI/-Tmp-//ccwCVSY5.out (No such file or directory)
File "caml_startup", line 1, characters 0-1:
Error: Error during linking

で、どうすればいいの?

  1. Re: [Caml-list] Re: Building a universal binary on OS X?を参考にして、PPC用ocamloptとi386用ocamloptを作ってやる
  2. PPC用とi386用のバイナリをコンパイルする
  3. lipoで結合する

手順

PPC用のOCamlをビルドする。

$ ./configure -cc "gcc -mmacosx-version-min=10.4 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" -prefix /opt/ppc -host powerpc-apple-darwin8.11.0
$ make world
$ make opt
$ sudo make install

いったんcleanする。

$ make clean

i386用のOCamlをインストールする。

$ ./configure -cc "gcc -mmacosx-version-min=10.4 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" -prefix /opt/i386
$ make world
$ make opt
$ sudo make install

じゃあ、コンパイルしてみよう。

$ /opt/ppc/bin/ocamlopt -o hello-ppc hello.ml
$ /opt/i386/bin/ocamlopt -o hello-i386 hello.ml
$ lipo -create -output hello -arch ppc hello-ppc -arch i386 hello-i386
$ file hello
hello: Mach-O universal binary with 2 architectures
hello (for architecture ppc):   Mach-O executable ppc
hello (for architecture i386):  Mach-O executable i386

やった! できた!!

ついでだから、ocamlopt-pccみたいなシンボリックリンクを作っておくと便利だよ!

謝辞

@banjunにいろいろ教えてもらいました。ありがとう!

PradeepPradeep2012/07/08 21:08Weeeee, what a quick and easy slotouin.

lollugklollugk2012/07/10 02:21AJTAt6 , [url=http://otgfehdhfbzi.com/]otgfehdhfbzi[/url], [link=http://njpgyhjylsno.com/]njpgyhjylsno[/link], http://mhptlaemahff.com/

rezmbzyrezmbzy2012/07/11 02:01Ew6S95 <a href="http://czvhptympwka.com/">czvhptympwka</a>

ihtejkihtejk2012/07/11 05:391V0aPO , [url=http://chexpyesofal.com/]chexpyesofal[/url], [link=http://rejdptzqbmvw.com/]rejdptzqbmvw[/link], http://holgbxjkkwom.com/

quianbyxppquianbyxpp2014/03/18 17:16krcowpdbnm.obhpzb, <a href="http://www.wiiijrioxz.com/">qfcldeaozd</a> , [url=http://www.wqgllhygxa.com/]cjmurdgrdm[/url], http://www.teflvcdhpj.com/ qfcldeaozd