Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[std/encodings] fix iconv headers on OpenBSD #17872

Merged
merged 5 commits into from
Apr 27, 2021
Merged

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Apr 27, 2021

@timotheecour
Copy link
Member

now this gives:
ld: error: undefined symbol: libiconv_open
instead of could not import: iconv_open

@ringabout
Copy link
Member Author

well, I will look into it soon

@timotheecour timotheecour self-requested a review April 27, 2021 07:15
lib/pure/encodings.nim Outdated Show resolved Hide resolved
lib/pure/encodings.nim Outdated Show resolved Hide resolved
@timotheecour
Copy link
Member

see https://hisham.hm/2016/02/24/first-time-playing-with-openbsd/

  • iconv is installed under /usr/local, and its library exports symbols with names such as libiconv_open instead of the usual iconv_open, which fools the typical AC_CHECK_LIB test in Autoconf. (In the source code, iconv_open works, so I guess iconv.h uses #define to translate the name. Added a hack to Dit to make it build cleanly out-of-the-box.

maybe the symbol name to dlopen is libiconv_open instead of iconv_open on openbsd?

@ringabout
Copy link
Member Author

yeah, it is a common problem for OpenBSD.

lib/pure/encodings.nim Outdated Show resolved Hide resolved
@timotheecour
Copy link
Member

i think the issue is (i'm guessing):
the symbol name is something (maybe libiconv_open); a macro in iconv.h defines iconv_open based on it, so in the end you need both the header and a passl:-liconv flag or similar

lib/pure/encodings.nim Outdated Show resolved Hide resolved
@ringabout
Copy link
Member Author

Well passing "/usr/local/lib/libiconv.a" works

lib/pure/encodings.nim Outdated Show resolved Hide resolved
@ringabout
Copy link
Member Author

so in the end you need both the header and a passl:-liconv flag or similar

Yes, now OpenBSD pass CI too.

Copy link
Member

@timotheecour timotheecour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@timotheecour timotheecour merged commit d881a05 into devel Apr 27, 2021
@timotheecour timotheecour deleted the xflywind-patch-1 branch April 27, 2021 17:14
PMunch pushed a commit to PMunch/Nim that referenced this pull request Mar 28, 2022
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.

aporia
2 participants