我正在尝试从源代码(根据此处的说明)构建 mysql-connector-c 并静态链接到我的应用程序中的库。但是,我收到以下警告,我想知道是否有人对为什么会这样有任何想法:
/path/to/lib/libmysqlclient.a(mf_pack.c.o): In function `unpack_dirname':
mf_pack.c:(.text+0x90b): warning: Using 'getpwnam' in statically linked
applications requires at runtime the shared libraries from the glibc version
used for linking
/path/to/lib/libmysqlclient.a(libmysql.c.o): In function `read_user_name':
libmysql.c:(.text+0x2b06): warning: Using 'getpwuid' in statically linked
applications requires at runtime the shared libraries from the glibc version
used for linking
/path/to/lib/libmysqlclient.a(mf_pack.c.o): In function `unpack_dirname':
mf_pack.c:(.text+0x916): warning: Using 'endpwent' in statically linked
applications requires at runtime the shared libraries from the glibc version
used for linking
/path/to/lib/libmysqlclient.a(client.c.o): In function `mysql_real_connect':
client.c:(.text+0x305c): warning: Using 'getaddrinfo' in statically linked
applications requires at runtime the shared libraries from the glibc version
used for linking
/path/to/lib/libmysqlclient.a(libmysql.c.o): In function `mysql_server_init':
libmysql.c:(.text+0x2f9b): warning: Using 'getservbyname' in statically linked
applications requires at runtime the shared libraries from the glibc version
used for linking
以下是一些相关的参数/标志:
为了构建库,CMake 正在传递以下内容:
-G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/path/to/my/install/root -DCMAKE_C_FLAGS="-m64" -DCMAKE_CXX_FLAGS="-m64"
用于构建应用程序:
CFLAGS := $(CFLAGS) -Werror -Wall -ggdb -gdwarf-2
LDFLAGS := $(LDFLAGS) -static -ggdb -gdwarf-2