IronPdf.LinuxARM:无法在静态 TLS 块中分配内存
在使用LinuxARM版本的IronPDF时,当试图在Linux ARM上动态加载libcef.so时出现异常消息。 接下来会出现以下异常消息。
IronSoftware.Exceptions.IronSoftwareDeploymentException: Error while deploying IronPdf Chrome renderer: '/irontest/testIronPdfOnLinuxArm/bin/Debug/net8.0/runtimes/linux-arm64/native/libcef.so: cannot allocate memory in static TLS block'. To learn more about making an engineering support request please visit: . To learn how to solve this issue please read https://ironpdf.com/troubleshooting/error-while-deploying-chrome-dependencies/ [Issue Code IRONPDF-CHROME-DEPLOYMENT-ERROR-LINUX]
问题
在Linux ARM上动态加载libcef.so时,您可能会遇到一个错误,指出:"无法在静态TLS块中分配内存。"这个错误是与Chromium嵌入式框架(CEF)相关的已知问题。 此问题出现是因为较新版本的CEF所需的线程本地存储(TLS)空间超过Linux动态链接器默认分配的空间。 此问题记录详尽,影响Linux ARM处理器和Linux ARM x64系统,二者都因缺少足够的线程本地存储(TLS)而无法支持较新版本的CEF。 您可以在这里找到关于该问题的更多信息和讨论。
解决方案
解决此异常的方法是在运行应用程序之前手动设置它,如下所示。
export LD_PRELOAD=/path/to/libcef.so
通过在C#进程之前手动设置LD_PRELOAD,我们强制链接器优先加载libcef.so,以确保有足够的TLS内存分配。 这种方法已被证明非常有效,可以解决问题并防止出现TLS allocation错误。 您可以确信该解决方案是有效的。
LD_PRELOAD方法是其他用户,包括CEF论坛推荐的最有效和最简便的方法。
这目前是一个权宜之计,直到CEF最终为ARM解决这个问题,就像他们通过减少libxml2中的TLS使用解决了x64版本的问题。但没有明确的时间表说明CEF何时会解决这个问题。

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.