user1970105
user1970105

Reputation: 11

synology cross compile gcc -std=c++0x

I'm willing to compile a program that needs -std=c++0x option of gcc to make it execute Synology x86 NAS system (Intel Atom). I'm using the cross-compiling toolchain (synoroot directory).

$cat tst.cpp
tst.cpp:
    int main() {
    return 0;
}

$ gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2

$gcc tst.cpp -std=c++0x --sysroot=/usr/local/synoroot -nodefaultlibs /usr/local/synoroot/lib/libc.so /usr/local/synoroot/lib/ld-linux.so.2 /usr/local/synoroot/usr/lib/libstdc++.so /usr/local/synoroot/lib/libm.so -o tst

$./tst && echo $?
0

On synology:

$./tst
Floating point exception (core dumped)

If I use the toolchain gcc (i686-linux-gnu-gcc (GCC) 4.2.1), ./tst executes correctly on synology but the -std=c++0x is not supported.

So how can I have successful execution and C++0x support ?

Cheers

Upvotes: 1

Views: 2543

Answers (2)

tenhow
tenhow

Reputation: 1

If you just like to run or compile and run on your synology, you can choose Debian Chroot your DSM.With this, you can do everything you want on your synology.

Here is my Debian-Chroot.pkg for DSM6.x repo, you can install with it. https://github.com/OKit-Scripts-Projects/DSM.Customizations/blob/master/App.Debian-Chroot.md

Any problem, feel free to comment or open a issue.

Upvotes: 0

Bart van Ingen Schenau
Bart van Ingen Schenau

Reputation: 15768

If you target system (Synology) differs sufficiently from your host system(Ubuntu) to need a cross-compiler, then you only have two options:

  1. Get a newer cross-compilation toolchain that supports the new language/library features that you need (possibly building it yourself from source)
  2. Rewrite the application such that it does not need the C++0x features.

Upvotes: 1

Related Questions