How to create binaries for older versions of Linux using C ++ 11?

We started using the tundra2 cross-platform build tool to create application binary files on different platforms. It works very well.

However, now we need to configure Ubuntu 10.04. Unfortunately, compiling tundra2 on Ubuntu 10.04 is not possible without a significant alteration of the source code, as it uses a number of C ++ 11 functions that are not available in gcc 4.4. I can upgrade to a new gcc, but not one that can compile the code.

So, I thought that I would try to build tundra2 on a newer platform and copy the tundra2 binary on 10.04. Unfortunately, I get the following errors:

(lucid_amd64)matt@blaze:~/dev/OTOY2/extern/tundra2/build$ ./tundra2 
./tundra2: /lib/libc.so.6: version `GLIBC_2.14' not found (required by ./tundra2)
./tundra2: /lib/libc.so.6: version `GLIBC_2.15' not found (required by ./tundra2)

I tried the g ++ static link with the -static-libstdC ++ and -static-libgcc options, but the error persists.

What causes the question. How do you target older platforms with newer compiler features? Should I try to compile GCC 4.8 on Ubuntu 10.04?


After some reading and learning more about gnu c linker than I thought, I would need to know. It seems that the function causing the dependency is called __fdelt_chk, introduced in 2.15. Something to do with range checking. I am going to try to disable this or implement a dummy for it. Memcpy also wants 2.14, which is not available in Ubuntu 10.04.


EDIT. It would seem that in 2.14 and 2.15 there are two general changes. In 2.14, I read that memcpy has been updated to be an internal memmove call. Checks of memory boundaries were introduced in 2.15 (which is what __fdelt_chk is).

Appart , ++ , , 10.04 Centos 5.5.

, ? memcpy, - . 2.14. -fno-stack-protector -U_FORTIFY_SOURCE . , pthreads, , , .

, , . , gcc 4.8 10.04 , .

+4
1

tundra2 Ubuntu 10.04

gcc .

+1

Source: https://habr.com/ru/post/1523458/


All Articles