[LLVMdev] Strange linker error with clang 3.2

Arno Onken asnelt at asnelt.org
Tue Mar 19 03:15:19 PDT 2013


Hi,

I get a strange linker error with the clang compiler version 3.2 on the
Debian build system: There is an "undefined reference" error even though
the function was previously defined in the same file. The code works
without any issues with the GNU toolchain.

Here is the error message:

rrep.o: In function `replace_string':
/«PKGBUILDDIR»/src/rrep.c:230: undefined reference to `write_replacement'
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[3]: *** [rrep] Error 1


rrep.c has the following layout:

inline int
write_replacement (FILE *fp, const char *start, const regmatch_t *match,
		   const replace_t *replacement, const char *file_name,
		   char **pos)
{
...
}

...
if (write_replacement (out, start, match, replacement, file_name,
    &pos) != SUCCESS)
  return FAILURE;
...


The full log is at

http://clang.debian.net/logs/2013-01-28/rrep_1.3.3-2_unstable_clang.log

Regards,
Arno



More information about the llvm-dev mailing list