From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id A83367F7AF for ; Thu, 8 Oct 2015 18:42:53 +0200 (CEST) IronPort-PHdr: 9a23:foN/cBXDpieV0rb2h+Ft8Th0GEjV8LGtZVwlr6E/grcLSJyIuqrYZxSOt8tkgFKBZ4jH8fUM07OQ6PC8HzNdqs/Z7DgrS99laVwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfTR8Kum9IIPOlcP/j7n0oM2PJVoVz2PlPftbF1afk0b4joEum4xsK6I8mFPig0BjXKBo/15uPk+ZhB3m5829r9ZJ+iVUvO89pYYbCf2pN4xxd7FTDSwnPmYp/4Wr8ECbFUrc0EABSX0bmQZkBA3M7ReyHsug83iyiu0okg+bNsryRKt8fjav464jYhbywm9TMXg+8myRgMVqpK1eqROl4Rd4xtiHTpuSMa80Ua7HcZshWW1FRsNYUSoLSte9aYUIJ+UMJ+odtJX6o0MLpB24QwWhUrC8ggRUj2P7iPVpm98qFhvLiUl9Rt8= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.131; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.131; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.126.131; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AbBAAsnBZWlIN+49REGhaCZYEAbgaqC4IKkxUXCoJyggp/AoFMOxEBAQEBAQEBARABAQEBBwsLCR8wgh+CBwEBAQMBVRkLBQsFBhgNIUUSBhMJCAEJh34DCgkDAQg7vUADhSIBAQEBAQEEAQEBAQEBHIV4hHOBBoRaMweCLk+BMQWFfwyBLY5SAX4CHYN6iVhIg3KCfY58gjWBOjeCPRYHgVZvAYdrAQEB X-IPAS-Result: A0AbBAAsnBZWlIN+49REGhaCZYEAbgaqC4IKkxUXCoJyggp/AoFMOxEBAQEBAQEBARABAQEBBwsLCR8wgh+CBwEBAQMBVRkLBQsFBhgNIUUSBhMJCAEJh34DCgkDAQg7vUADhSIBAQEBAQEEAQEBAQEBHIV4hHOBBoRaMweCLk+BMQWFfwyBLY5SAX4CHYN6iVhIg3KCfY58gjWBOjeCPRYHgVZvAYdrAQEB X-IronPort-AV: E=Sophos;i="5.17,655,1437429600"; d="scan'208";a="181810109" Received: from mout.kundenserver.de ([212.227.126.131]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2015 18:42:52 +0200 Received: from office1.lan.sumadev.de ([88.69.138.237]) by mrelayeu.kundenserver.de (mreue001) with ESMTPSA (Nemesis) id 0M0Y1e-1abUt31Ity-00umyw; Thu, 08 Oct 2015 18:42:51 +0200 Received: from gps.dynxs.de (localhost [IPv6:::1]) by office1.lan.sumadev.de (Postfix) with ESMTP id 7D960DC05D; Thu, 8 Oct 2015 18:42:50 +0200 (CEST) Received: from 88.198.178.4 (SquirrelMail authenticated user gerd) by gps.dynxs.de with HTTP; Thu, 8 Oct 2015 18:42:50 +0200 Message-ID: In-Reply-To: References: Date: Thu, 8 Oct 2015 18:42:50 +0200 From: "Gerd Stolpmann" To: "Nicolas Ojeda Bar" Cc: "Stefan Hellermann" , caml-list@inria.fr User-Agent: SquirrelMail/1.4.23 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 (Normal) Importance: Normal Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:aUHbpOWiqtqjhXKk2M4a1f/JzUh8E0nTVzBdaNgWqHpQe7EHFss ShQe/EX40U2ydiPatEyk1q/qNzo0+RHbuyzHw2fx0vV0AeElDI6fr8uHjwMi4l+Uaxg8Hz/ COXsZo5/GC/sqnwQZcU+bgAEB6OewNsUuQ2/7286IfuorBUeyKj15SJwltq/NebxvXHGQrU yPU5Gcgn/+PnOAnx+8Zcg== X-UI-Out-Filterresults: notjunk:1;V01:K0:Ns0nEjKA08M=:we1cpzgbNFv5TNwRd7AJGt /Fz4MeUuc+Z08vEIdbL/ANC7DVYq075DfrlGAg6IOhlKF6IKRcj1gfEQO+OwCEb6j/bPaf7Qo 0nEsdrSCJpw11rxBMF3CnOYqhl5AUYmTgliBieIfe562BDlBuSJIF83/yBp7ZmoBMxpVFTp0v g9bvUVCrxVwMsAy5dgaZkmcWBddRuPxqB87KfuopQNC6ww9sUd/W7C8I4aM5q9l7ElaJIc5JW JrH7UGHjggEDrLm3rAQ5KEovvZq1ixbbY9x/2Or8dcbHF0mhsImpDLAmOXMyFy1OMWUMHbRoR jjO81PBEgVREcHem0cE2WD5wJWwhlzsdmu89lWNagTG4IXUXQURhAcNMCy4e9c+MGe5vLU9Cc FVny4acHg9seWop250mAZvEOPm2lzUpvvIopdPxpcc7+YX550ADqCR+EqSYXym2CEdbx0PXPT iJAYE3Pj69CloEF+ks27rTk+A7/d/1zZC3A46pToWG0dRE/NibNaGKdspdEhaouMjkXgTTC7J cDVLm9mA/pkeIF6c2al4c7C9SjpSj/1P6EdBUdhKKPVzPI94ElpRP1F+iORBu/abqTLK9CxAb TPWsT8p3JrOi3WjwfA4BHA2HKNSUQ4I/Ns36e6Bo3AgMwSYNKkr01asUPS5aX3+vfzTiBjeZe gH3RCFuMI1nVQ97DVmfkM/VRZf91+/mCsj/tQLHiK6ghwg+ccUoqk7WdjQckfOd6AwP2gw0ys 4L+R3mkjkCRW5JOh Subject: Re: [Caml-list] Broken 32 bit cross-compiler on 64bit host Correct, it's unsupported. Unfortunately, there is no check in the configure script whether the word sizes match (it only checks for the OCaml version). It's not only the value marshaller that can fail, but I've also seen illegal assembler code. The core of the problem is that the generic parts of the native-code backend use nativeint for integer calculations, and the code emitters for 32 bit platforms then just assume nativeint has only 32 bits. I guess the solution would be to introduce a new integer type targetint into the compiler that is either int32 or int64, depending on what the cross-compile target is. Gerd > Dear Stefan, > > I believe it is currently impossible to build a working cross-compiler > between different word sizes, as the compiler does not differentiate > between the host and the target's native integers. > > Best wishes, > Nicolas > > > On Thu, Oct 8, 2015 at 11:43 AM, Stefan Hellermann > wrote: > >> Hello, >> >> currently I'm trying to add OCaml to the openwrt router distribution [1] >> [2]. This would mean you could run your favorite OCaml applications on >> your >> router. I would like to run unison [3] on my router. >> >> So I first build native OCaml 4.02.3 on my x86_64 linux host, and then >> build a OCaml cross-compiler for the 32 bit target, e.g. >> mips-openwrt-linux. Building OCaml went fine after adding a small patch >> to >> manually set Endianness and Bitness in configure script, please have a >> look >> at attached patch. >> >> host OCaml configure line: >> ./configure -prefix somepath -no-pthread -no-debugger -no-ocamldoc >> -no-graph -no-cfi >> cross OCaml configure line: >> ./configure -prefix someotherpath -target-bindir /usr/bin -host >> x86_64-unknown-linux-gnu -target mips-openwrt-linux-musl -cc >> "mips-openwrt-linux-musl-gcc some target cflags" -as >> "mips-openwrt-linux-musl-as some target as flags" -no-pthread >> -no-shared-libs -no-debugger -no-ocamldoc -no-graph -no-cfi -big-endian >> >> >> Now the bug: When running OCaml applicantions (build with -custom), they >> crash on startup on the target: >> >> Fatal error: exception Failure("input_value: integer too large") >> >> >> This is similar to OCaml Bug #5977 [4] >> >> There is a workaround: >> Build the host OCaml as 32 bit OCaml, then build the cross compiler with >> this 32 bit host OCaml. The resulting binaries work on the target. >> This is what I did for openwrt [2], but it fails on 64 bit hosts where >> no >> 32 bit development tools are installed. It only catches the case when >> building on x86_64 hosts, it will break when building on say powerpc64 >> or >> 64 bit arm. It's also problematic for openwrt, as only the cross >> compiler >> but not the host tools are recompiled if the target arch changes, e.g. >> from >> 64 bit arm to 32 bit mips. >> >> Now my questions: >> - Is building a 32 bit cross compiler on a 64 bit host supposed to work? >> - Is my patch to configure ok, or is there a better way to configure the >> cross-compiler? >> - Should I run some test suite on the target and post the results? >> >> [WARNING] Something went wrong while checking native division and >> modulus >> please report it at http://http://caml.inria.fr/mantis/ >> Do I have to care? >> I tried defining and undefining NONSTANDARD_DIV_MOD in m.h. without any >> visible difference. Running the test-prog divmod.c on a few targets >> always >> returns 0. >> >> [1] https://openwrt.org/ >> [2] https://patchwork.ozlabs.org/patch/518982/ >> [3] https://www.cis.upenn.edu/~bcpierce/unison/ >> [4] http://caml.inria.fr/mantis/view.php?id=3D5977 >> >> >> > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------