在Linux上编译时未定义对mempcy@GLIBC_2.14的引用 [英] Undefined reference to mempcy@GLIBC_2.14 when compiling on Linux

查看:1122
本文介绍了在Linux上编译时未定义对mempcy@GLIBC_2.14的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将应用程序从Windows移植到驱动使用ftdi2332h芯片的设备到Linux.我已按照以下说明在此说明上安装了ubuntu 10.04系统上的libftd2xx库. .

I am trying to port an application to drive a device that uses an ftdi2332h chip from windows to linux. I installed the libftd2xx library on an ubuntu 10.04 system per these instructions.

当我尝试编译任何示例程序时,出现以下错误:

When I try to compile any of the sample programs I get the following error:

/usr/local/lib/libftd2xx.so: undefined reference to `memcpy@GLIBC_2.14'
collect2: ld returned 1 exit status

有关如何解决此问题的任何准则?

Any guidelines on how to fix this?

推荐答案

mempcy@GLIBC_2.14被称为版本化符号. Glibc使用它们,而其他运行时库(例如 musl不使用).

The mempcy@GLIBC_2.14 is called a versioned symbol. Glibc uses them while other runtime libraries like musl do not.

mempcy@GLIBC_2.14在Linux上编译时的重要性是由于Glibc在2012年更改了memcpy的工作方式.memcpy用于复制字节{begin→end}(低内存地址到高内存地址). Glibc 2.13提供了优化的memcpy,它在某些平台上复制了{end→begin}.我相信某些平台"包括带有SSE4.1的英特尔机器.然后,Glibc 2.14提供了一个memcpy来恢复{begin→end}行为.

The significance of mempcy@GLIBC_2.14 when compiling on Linux is due to Glibc changing the way memcpy worked back in 2012. memcpy used to copy bytes {begin → end} (low memory address to high memory address). Glibc 2.13 provided an optimized memcpy that copied {end → begin} on some platforms. I believe "some platforms" included Intel machines with SSE4.1. Then, Glibc 2.14 provided a memcpy that restored the {begin → end} behavior.

某些程序依赖于{begin→end}副本.当程序使用重叠缓冲区时,memcpy会产生未定义的行为.在这种情况下,程序应该使用memmove,但是由于{begin→end}发生了复制,因此无法通过.另请参见 mp3 Flash网站上的声音奇怪(由于Adobe Flash), Glibc更改暴露的错误(在LWN上),

Some programs depended upon the {begin → end} copy. When programs used overlapping buffers then memcpy produced undefined behavior. In this case a program should have used memmove, but they were getting by due to a copy that occurred {begin → end}. Also see Strange sound on mp3 flash website (due to Adobe Flash), Glibc change exposing bugs (on LWN), The memcpy vs memmove saga and friends.

要解决此问题,您可以将以下内容添加到源代码中:

To fix it it looks like you can add the following to your source code:

__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");

也许类似以下内容.然后在您的项目中包含额外的源文件.

Maybe something like the following. Then include the extra source file in your project.

$ cat version.c

__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");

这篇关于在Linux上编译时未定义对mempcy@GLIBC_2.14的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆