Menu

#4 compilation problems

1.0
open
nobody
None
2016-12-13
2016-11-02
No

I tried to compile user-union on ubuntu-16.04
and got a lot of errors like this:

user-union.c:325:15: error: redefinition of ‘strcpy’
C_WRP(char , strcpy, (char s1, const char *s2), (s1, s2))
^
user-union.c:281:52: note: in definition of macro ‘C_WRP’
inline attribute((visibility("hidden"))) RTYPE SYM DEF_ARGS \ ^
In file included from /usr/include/features.h:367:0,
from /usr/include/stdio.h:27,
from user-union.c:127:
/usr/include/x86_64-linux-gnu/bits/string3.h:108:1: note: previous definition of ‘strcpy’ was here
NTH (strcpy (char *restrict dest, const char *restrict __src))

Seems like glibc changed the definitions of all functions,
so redefining them is now more difficult.

Additionally there are warnings:

user-union.c:374:9: warning: ‘wrp_vfprintf’ is static but used in inline function ‘fprintf’ which is not static
ret = wrp_vfprintf(stream, format, ap);

These are probably easy to fix.

Discussion

  • David A. Wheeler

    Good point, thanks for the report.

    I suspect there's a gcc/clang option to address this.

     
  • Stas Sergeev

    Stas Sergeev - 2016-11-02

    Function redefinitions? Perhaps not
    when the prototypes are different.
    And since glibc added "restrict" and
    other things, gcc treats them as different.
    But I've found this is only related to the
    private namespace stuff.
    Perhaps it have to be re-done with the
    linker magic (like --wrap option)

     
  • Stas Sergeev

    Stas Sergeev - 2016-12-13

    Hello David, please pull the fix from here:

    https://github.com/stsp/user-union/commits/master

     

Log in to post a comment.