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

FS#1748 - libgcc_pic.a not autoincluded when building c++ static #6710

Open
openwrt-bot opened this issue Aug 7, 2018 · 2 comments
Open
Labels
flyspray toolchain pull request/issue with toolchain related changes

Comments

@openwrt-bot
Copy link

bolvan:

I'm trying to build static C++ code using openwrt toolchain with gcc compiler 7.3.0 for x64 arch.
It works fine without "-static" , links against "libgcc_s.so.1"
But with "-static" compiler does not link against libgcc_pic.a.

#include <stdio.h>

class CTest
{
public:
CTest()
{
printf("Test\n");
}
~CTest()
{
printf("unTest\n");
}
};

void Test()
{
CTest c;
throw (int)1;
}

int main()
{
try
{
Test();
}
catch(int Test)
{
}
return 0;
}

/lib/../lib64/libstdc++.a(eh_alloc.o): In function __gnu_cxx::__scoped_lock::~__scoped_lock()': eh_alloc.cc:(.text._ZN9__gnu_cxx13__scoped_lockD2Ev[_ZN9__gnu_cxx13__scoped_lockD5Ev]+0x4b): undefined reference to _Unwind_Resume'
/tmp/ccedkPfo.o: In function Test()': unwind.cpp:(.text+0x4d): undefined reference to _Unwind_Resume'
/tmp/ccedkPfo.o: In function main': unwind.cpp:(.text+0x6f): undefined reference to _Unwind_Resume'
/lib/../lib64/libstdc++.a(eh_personality.o): In function base_of_encoded_value(unsigned char, _Unwind_Context*) [clone .part.3]': eh_personality.cc:(.text._ZL21base_of_encoded_valuehP15_Unwind_Context.part.3+0x26): undefined reference to _Unwind_GetDataRelBase'
eh_personality.cc:(.text._ZL21base_of_encoded_valuehP15_Unwind_Context.part.3+0x2c): undefined reference to _Unwind_GetTextRelBase' eh_personality.cc:(.text._ZL21base_of_encoded_valuehP15_Unwind_Context.part.3+0x32): undefined reference to _Unwind_GetRegionStart'

If I include "-lgcc_pic" it compiles OK
I think compiler should autoinclude gcc_pic as it does in dynamic build

@aparcar aparcar added the toolchain pull request/issue with toolchain related changes label Feb 22, 2022
@laoshaw
Copy link

laoshaw commented Jul 10, 2022

same problem with mips cross compile with release 22.03-beta, can not build static c++ programs for TP-Link C7V5

@ptpt52
Copy link
Contributor

ptpt52 commented May 5, 2023

mark!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray toolchain pull request/issue with toolchain related changes
Projects
None yet
Development

No branches or pull requests

4 participants