From owner-freebsd-questions@FreeBSD.ORG Fri Aug 13 17:47:26 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4221B106566B for ; Fri, 13 Aug 2010 17:47:26 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell0.rawbw.com (shell0.rawbw.com [198.144.192.45]) by mx1.freebsd.org (Postfix) with ESMTP id 2D7FD8FC15 for ; Fri, 13 Aug 2010 17:47:25 +0000 (UTC) Received: from eagle.syrec.org (stunnel@localhost [127.0.0.1]) (authenticated bits=0) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id o7DHlNRU071043; Fri, 13 Aug 2010 10:47:23 -0700 (PDT) (envelope-from yuri@rawbw.com) Message-ID: <4C65852B.807@rawbw.com> Date: Fri, 13 Aug 2010 10:47:23 -0700 From: Yuri User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.10) Gecko/20100630 Thunderbird/3.0.5 MIME-Version: 1.0 To: Dan Nelson References: <4C656E8F.8090105@rawbw.com> <20100813162429.GE18896@dan.emsphone.com> In-Reply-To: <20100813162429.GE18896@dan.emsphone.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Documentation on how to build 32bit applications on amd64? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 17:47:26 -0000 On 08/13/2010 09:24, Dan Nelson wrote: > Try adding -B/usr/lib32 to your first gcc line. The specs file should be > modified to add this automatically when you pass -m32, imho. > Thank you Dan, this flag worked. But I found a strange discrepancy between 32bit and 64bit. When I compile the program below in 64 bit, I get the correct result. With 32 bit executable compiled on 64 bit system like you suggested there is another (wrong) result. On 32 bit system result is also correct, the same as with 64 executable. This is a very strange discrepancy. rm_eo field is zero in the match result which is wrong. I can't think of any explanation for it. FreeBSD-8.1-STABLE Yuri --- program m.c --- #include #include #include void replace_all(char *str, char *pattern, char *replacement) { int res; int off = 0; regex_t re; regmatch_t match; res = regcomp(&re, pattern, REG_EXTENDED); while (off < (int)strlen(str) && regexec(&re, str+off, 1, &match, 0)==0) { printf("match: off=%i so=%i eo=%i\n", off, (int)match.rm_so, (int)match.rm_eo); off += match.rm_eo; } } main() { replace_all("abc-def-fghijkl", "-", "_"); return 0; } --- output of 64 bit executable (gcc -o m m.c) --- match: off=0 so=3 eo=4 match: off=4 so=3 eo=4 --- output of 32 bit executable built on 64 bit system with flags (gcc -B/usr/lib32 -m32 -o m m.c) --- match: off=0 so=3 eo=0