[KinoSearch] Compile 0.30_07 on FreeBSD 7
Peter Karman
peter at peknet.com
Fri Nov 13 23:30:16 PST 2009
Peter Karman wrote on 11/14/09 12:49 AM:
> Marvin Humphrey wrote on 11/13/09 2:43 PM:
>
>> There should be a source file, _charm_try.c in your distro directory. It
>> should contain the following source code:
>>
>> int main() { return 0; }
>>
>> For some reason, that's not compiling. Instead, we get this message:
>>
>> Syntax error: "(" unexpected
>>
>> Confirm that that file is there, and that it contains the source code it
>> should.
>
> I have a freebsd 7.2 install available and was able to reproduce. The problem
> seems to be that the include path generated for compiling the _charm_try.c file
> is a single '( ' and so bash croaks when trying to execute the cc command. If
> you try and compile with just a simple:
>
> cc _charm_try.c
>
> it works with no problem.
>
> I threw some fprintf to stderr in the (generated?)
>
> charmonizer/gen/Charmonizer/Core/Compiler.c
>
> file around lines 110-122 and got this output:
>
> Creating os object...
> Trying to find a bit-bucket a la /dev/null...
> Trying to find a supported compiler...
> Creating compiler object...
> Trying to compile a small test file...
> inc_dir: (
> exe: cc _charm_try.c -o _charm_try -I (
> -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK
> -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include
> Syntax error: "(" unexpected
>
> I assume the inc_dir values come from Perl Config, but I gave up trying to dig
> backwards from here.
>
> Hope that helps you some Marvin.
>
More info. The problem seems to come in the call to add_inc_dir(".") at line 58
in Compiler.c. If I comment that out, everything compiles and tests out just fine.
I threw some more debugging in add_inc_dir() to see what was going on. strdup()
returns a copy of "." as expected, but the assignment to self->inc_dirs breaks
somehow.
Creating compiler object...
copy of dir = '.' at [0]
[0] == ' ('
passed in '.', num_dirs=1, last=' ('
strdup '.' == '.'
Trying to compile a small test file...
inc_dir: ' (.'
Failed to write charmony.h at buildlib/Lucy/Build.pm line 196.
The code:
static void
add_inc_dir(Compiler *self, const char *dir)
{
size_t num_dirs = 0;
char **dirs = self->inc_dirs;
char *copy;
/* count up the present number of dirs, reallocate */
while (*dirs++ != NULL) { num_dirs++; }
num_dirs += 1; /* passed-in dir */
self->inc_dirs = realloc(self->inc_dirs, num_dirs + 1);
/* put the passed-in dir at the end of the list */
copy = strdup(dir);
fprintf(stderr, "copy of dir = '%s' at [%d]\n", copy, num_dirs - 1);
self->inc_dirs[num_dirs - 1] = copy; // strdup(dir);
fprintf(stderr, "[%d] == '%s'\n", num_dirs-1, self->inc_dirs[num_dirs-1]);
self->inc_dirs[num_dirs] = NULL;
fprintf(stderr, "passed in '%s', num_dirs=%d, last='%s'\n", dir, num_dirs,
self->inc_dirs[num_dirs -1 ]);
fprintf(stderr, "strdup '%s' == '%s'\n", dir, strdup(dir));
}
I'm running:
FreeBSD freebsd.peknet.com 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May 1
08:49:13 UTC 2009 root at walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
under VirtualBox on a 64-bit macbook pro.
--
Peter Karman . http://peknet.com/ . peter at peknet.com
More information about the kinosearch
mailing list