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

Differences between architectures #13

Open
willox opened this issue Aug 7, 2018 · 9 comments
Open

Differences between architectures #13

willox opened this issue Aug 7, 2018 · 9 comments

Comments

@willox
Copy link

willox commented Aug 7, 2018

I'm not quite 100% on this, but it seems that the generated files are only valid for the architecture glibc is built for by the Python script. This seems like a reasonable limitation, but there's seemingly no way to generate headers that will work for i386 or i686 builds.

I tried changing the Python script to cross-build glibc, but failed. I then tried executing the script on an i686 system, but also failed (a successful build, but hitting the duplicate symbols exception this time.)

Any ideas on this? I'll attach an example of a program that fails to link with a header that has been generated from a x86-64 build of glibc.


Example Download

The example assumes you've got an install of gcc that'll default to 64-bit compilation, but allows for the -m32 flag.

If you execute compile_x64, it should succeed and build the binary. If you execute compile_x32, it should fail with undefined reference to 'puts@GLIBC_2.2.5'. I believe it should actually be using puts@GLIBC_2.0 here.

@SSE4
Copy link
Contributor

SSE4 commented Aug 30, 2018

@willox I was trying to do the same, and also run into duplicated symbols exception:

Exception: duplicate incompatible symbol versions found: [u'__finite@@GLIBC_2.1', u'__finitef@@GLIBC_2.1', u'__finitel@@GLIBC_2.1', u'pwrite64@@GLIBC_2.2', u'open64@@GLIBC_2.2', u'pread@@GLIBC_2.2', u'pwrite@@GLIBC_2.2', u'lseek64@@GLIBC_2.2', u'pread64@@GLIBC_2.2', u'__pwrite64@@GLIBC_2.2', u'__pread64@@GLIBC_2.2']

@wheybags any advice?

@willox
Copy link
Author

willox commented Aug 30, 2018

@SSE4 did you manage to get cross-compilations working? I'm willing to put in some more effort if I don't need to jump on an i386 machine to try it out.

@SSE4
Copy link
Contributor

SSE4 commented Aug 31, 2018

@willox unfortunately, no, running into various issues. will try tomorrow again and let you know.

@wheybags
Copy link
Owner

wheybags commented Sep 4, 2018

@SSE4 is that from modifying the build script to build glibc in 32 bit?
If so, my only advice would be to looks at what object files those multiple definitions are coming from, and try use mailing lists/git hostory to figure out why thery're there (eg like the pthreads funcs in libpthread.so and libc.so for magic lock removal when running single threaded).
As for 32 bit support in general, I never tried it, I will add it to the readme now.
If someone gets this working for 32 bit builds, I'd happily accept a PR.

@SSE4 SSE4 mentioned this issue Sep 14, 2018
@SSE4
Copy link
Contributor

SSE4 commented Sep 14, 2018

some update:

  1. create PR with my in progress work X86 cross compile #14
  2. create docker image I am using to cross-compiling:
    https://github.com/bincrafters/docker-glibc-builder
    https://hub.docker.com/r/bincrafters/docker-glibc-builder/
    please lemme know if I've missed something
    I'll post my results here later today

@SSE4
Copy link
Contributor

SSE4 commented Sep 15, 2018

for version 2.5 - 2.10.2 I am getting:

/tmp/cczxgbB4.s: Assembler messages:
/tmp/cczxgbB4.s: Error: open CFI at the end of file; missing .cfi_endproc directive
/tmp/cczxgbB4.s: Error: open CFI at the end of file; missing .cfi_endproc directive
make[2]: *** [/host/conan/glibc_version_header/builds/glibc-2.5/build/csu/crti.o] Error 1

for 2.11.3 I've got:

Exception: duplicate incompatible symbol versions found:
 {'pwrite': ('libpthread-2.11.3.so', 'libc-2.11.3.so'), 
'open64': ('libpthread-2.11.3.so', 'libc-2.11.3.so'), 
'__finite': ('libm-2.11.3.so', 'libc-2.11.3.so'), 
'__finitel': ('libm-2.11.3.so', 'libc-2.11.3.so'), 
'__pread64': ('libpthread-2.11.3.so', 'libc-2.11.3.so'), 
'pread64': ('libpthread-2.11.3.so', 'libc-2.11.3.so'), 
'pwrite64': ('libpthread-2.11.3.so', 'libc-2.11.3.so'), 
'pread': ('libpthread-2.11.3.so', 'libc-2.11.3.so'), 
'__finitef': ('libm-2.11.3.so', 'libc-2.11.3.so'), 
'lseek64': ('libpthread-2.11.3.so', 'libc-2.11.3.so'), 
'__pwrite64': ('libpthread-2.11.3.so', 'libc-2.11.3.so')}

for 2.25:

Exception: duplicate incompatible symbol versions found: 
{'pwrite': ('libpthread-2.25.so', 'libc-2.25.so'), 
'open64': ('libpthread-2.25.so', 'libc-2.25.so'), 
'__finite': ('libm-2.25.so', 'libc-2.25.so'), 
'__finitel': ('libm-2.25.so', 'libc-2.25.so'), 
'__pread64': ('libpthread-2.25.so', 'libc-2.25.so', 'librt.so', 'librt-2.25.so'), 
'pread64': ('libpthread-2.25.so', 'libc-2.25.so'), 
'pwrite64': ('libpthread-2.25.so', 'libc-2.25.so'), 
'pread': ('libpthread-2.25.so', 'libc-2.25.so'), 
'__finitef': ('libm-2.25.so', 'libc-2.25.so'), 
'lseek64': ('libpthread-2.25.so', 'libc-2.25.so'), 
'__pwrite64': ('libpthread-2.25.so', 'libc-2.25.so', 'librt.so', 'librt-2.25.so')}

for 2.26 and upper I am getting:

*** These critical programs are missing or too old: GNU ld compiler
*** Check the INSTALL file for required versions.

(for 2.26 I'll try to use newer versions of programs later)

@SSE4
Copy link
Contributor

SSE4 commented Sep 15, 2018

okay, I think I've solved a problem with cfi_endproc (found patch that fixes an issue), and got the same list of duplicated symbols

@SSE4
Copy link
Contributor

SSE4 commented Nov 6, 2018

@willox @wheybags I think I was finally able to make it working on x86, please review #14

@quocnhat
Copy link

Hello, Have you successfully built and compiled ".so" libs cross different systems ( .,i,e: different gcc version) ? I investigated hard on this but failed at all. Which a lot of errors like:
undefined reference to `VTT for std::__cxx11::basic_ostringstream<char, std::char_traits, std::allocator >@GLIBCXX_3.4.21'
This error comes from the incompatible gcc version. any advice is really appreciated. Thank you

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

No branches or pull requests

4 participants