You are not logged in.

#1 2017-06-21 18:39:15

mbrandalero
Member
Registered: 2016-05-03
Posts: 6

Problem cross-compiling statically for aarch64 (missing stdlibc++)

Hi all,

I'm not sure if this is the right place to post this question, so sorry in advance for any inconvenience.

I'm trying to cross-compile an application for an aarch64-linux-gnu target by using the cross-compiler from the official repositories (community/aarch64-linux-gnu-gcc 6.3.1-1).

My question is very straightforward: compilation works without -static flag, fails with -static flag. What should I do?

Linker error is as follows

/usr/lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: cannot find -lstdc++

Clearly libstdc++.a is missing somewhere (the dynamic version exists, though). Here's sample terminal output

[mbrandalero: aarch64-linux-gnu]$ pwd
/usr/aarch64-linux-gnu
[mbrandalero: aarch64-linux-gnu]$ find . -name "libstdc++.*"
./lib64/libstdc++.so
./lib64/libstdc++.so.6.0.22-gdb.py
./lib64/libstdc++.so.6
./lib64/libstdc++.so.6.0.22

Should I manually compile the library from scratch, or is it included in some other package, or am I'm missing something here?

Thanks in advance!

Last edited by mbrandalero (2017-06-21 18:39:43)

Offline

#2 2017-06-21 18:51:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,522
Website

Re: Problem cross-compiling statically for aarch64 (missing stdlibc++)

See `pacman -Fs libstdc++.a`

EDIT: oops, I suppose my command only confirms it is not available int the repos specifically for that cross compiler.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-06-22 15:35:35

mbrandalero
Member
Registered: 2016-05-03
Posts: 6

Re: Problem cross-compiling statically for aarch64 (missing stdlibc++)

Trilby wrote:

See `pacman -Fs libstdc++.a`

EDIT: oops, I suppose my command only confirms it is not available int the repos specifically for that cross compiler.


Thank you for your reply. Although it didn't solve the problem specifically, at least now I know how to search for a specific file in the repos with pacman :-)

I managed to solve the issue by manually downloading gcc-7.1.0 from here, compiling stdlibc++ using HOST=aarch64-linux-gnu and then copying it to the aarch64 library path.

Last edited by mbrandalero (2017-06-22 15:37:23)

Offline

#4 2017-07-03 22:07:15

The Infinity
Member
Registered: 2014-07-05
Posts: 91
Website

Re: Problem cross-compiling statically for aarch64 (missing stdlibc++)

You could file a bug that static libs in `aarch64-linux-gnu-gcc` are missing. Likely the static libs are even built but and just not packaged because the PKGBUILD option `staticlibs` is missing. Including static libs in accordance to native `gcc` package would make sense IMO.

Last edited by The Infinity (2017-07-03 22:08:41)

Offline

Board footer

Powered by FluxBB