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

symbols are not included when building with optimization #109

Closed
moham96 opened this issue May 23, 2019 · 4 comments · Fixed by #110
Closed

symbols are not included when building with optimization #109

moham96 opened this issue May 23, 2019 · 4 comments · Fixed by #110

Comments

@moham96
Copy link

moham96 commented May 23, 2019

Hi,
I am trying to build this perl module which uses fribidi Text-Bidi under Archlinux, unfortunately it fails to build due to missing symbols of the library that is shipped with archlinux.
undefined symbol: fribidi_unicode_version
after some digging it turns out that there are some problems with the package that is shipped with Archlinux(by looking at the PKGBUILD):

  • because the Archlinux build system (ABS) automatically strips the symtab table from the elf binary some symbols that are in this table are removed so I instructed ABS to not run the elf binaries through strip by disabling the strip option

options=(!strip)

  • because the package is built with some optimization options (default on archlinux and derivatives) specifically these :

CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"

this causes the resulting .so file to lack symbols including fribidi_unicode_version
disabling these flags result in an elf binary that has these symbols but the build system complains about disabling optimizations, I get a lot of these:

# warning _FORTIFY_SOURCE requires compiling with optimization (-O)

so a couple of questions i have:

  • is this package supposed to be built with optimizations or not?
  • is removing the fribidi_unicode_version symbol from the optimized version intentional ? or a bug?

I have opened similar bug reports on the relevant projects here:

@dov
Copy link
Contributor

dov commented May 24, 2019

is this package supposed to be built with optimizations or not?

Of course! Why wouldn'it be. The faster the better.

is removing the fribidi_unicode_version symbol from the optimized version intentional ? or a bug?

The debug and the optimized versions are supposed to support the same API. If they do not, it's a bug.

Feel free to submit a pull request or just point out where the problem is.

@moham96
Copy link
Author

moham96 commented May 24, 2019

Feel free to submit a pull request or just point out where the problem is.

I don't know much about meson build system so I couldn't really track down the problem, that's why i opened the issue hoping someone with more experience can have a look.
keep in mind that if i build using the usual ./autogen.sh and make then i get no problem, so the issue is in the meson route of building

@khaledhosny
Copy link
Collaborator

CC @tp-m, @nirbheek, @CoffeeFlux who contributed/worked on the meson build before.

@CoffeeFlux
Copy link
Contributor

I'm on OSX at the moment and so I can't actually test the autotools system to compare, but at a glance meson's behavior seems correct. It sets -fvisibility=hidden by default (which ensures *nix builds are consistent with MSVC ones) and then will export any symbols marked with FRIBIDI_ENTRY, which does not include fribidi_unicode_version. That seems like it was intended to be public, so I'll make a PR adding it to fribidi.h.

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 a pull request may close this issue.

4 participants