Skip to content

Fix undefined symbol: lround in libxt_setset.so#5

Draft
Copilot wants to merge 4 commits into
masterfrom
copilot/fix-lround-error
Draft

Fix undefined symbol: lround in libxt_setset.so#5
Copilot wants to merge 4 commits into
masterfrom
copilot/fix-lround-error

Conversation

Copilot AI commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

The shared library fails to load with undefined symbol: lround because the math library isn't linked despite using lround() from <math.h>.

Changes

src/Makefile.in

  • Add -lm to link the math library
  • Add -Wl,--no-as-needed to force libm.so.6 into NEEDED dependencies (modern GCC's --as-needed was stripping it)

src/libxt_setset.c

  • Change void _init(void) to static void __attribute__((constructor)) _init(void) to avoid symbol conflict with system _init in modern GCC shared libraries
 %.so: %_sh.o
-	gcc -shared -lxtables -o $@ $<
+	gcc -shared -Wl,--no-as-needed -lxtables -lm -o $@ $<

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix lround error</issue_title>
<issue_description>Fix

/usr/lib/x86_64-linux-gnu/xtables/libxt_setset.so: /usr/lib/x86_64-linux-gnu/xtables/libxt_setset.so: undefined symbol: lround</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits November 4, 2025 07:19
- Add -lm flag to link with math library
- Add --no-as-needed to ensure libm is included in NEEDED dependencies
- Change _init() to use __attribute__((constructor)) to avoid conflicts with system _init

Co-authored-by: splitice <468579+splitice@users.noreply.github.com>
Co-authored-by: splitice <468579+splitice@users.noreply.github.com>
Co-authored-by: splitice <468579+splitice@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix lround error in libxt_setset Fix undefined symbol: lround in libxt_setset.so Nov 4, 2025
Copilot AI requested a review from splitice November 4, 2025 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix lround error

2 participants