Documentation on how to build 32bit applications on amd64?
Yuri
yuri at rawbw.com
Fri Aug 13 17:47:26 UTC 2010
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 <regex.h>
#include <stdio.h>
#include <string.h>
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
More information about the freebsd-questions
mailing list