Cross-compile on Linux for Solaris x86
Paul Lucas
plucas@splunk.com
Thu May 12 23:32:58 GMT 2022
> On May 12, 2022, at 1:37 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, May 12, 2022 at 12:14 PM Paul Lucas via Binutils
> <binutils@sourceware.org> wrote:
>>
>> Hello -
>>
>> I’m building a cross-compiled gcc and binutils on Linux x86_64 for Solaris x86_64. The problem is that the executables produced hard-code the wrong path for the dynamic linker and get killed immediately upon launch. In elfxx-x86.c, the path for ELF64_DYNAMIC_INTERPRETER is defined as "/lib/ld64.so.1", but should be "/lib/amd64/ld.so.1" on a Solaris x86_64 system.
>>
>> I came across this exact problem here:
>>
>> https://binutils.sourceware.narkive.com/hNh1UFx2/building-a-cross-for-solaris-x86-target#post2
>>
>> That thread is 15 years (!) old and implies this issue has beed addressed in the binutils 2.17/2.18 timeframe. I’m building binutils 2.32 and still hitting this same problem.
>>
>> What’s the fix?
>
> 1. Please get binutils 2.38.
OK, I did. Same result.
> 2. Configure binutils 2.38 to target Solaris/x86-64.
Specifically, I did:
configure --enable-gold=default --disable-ld --enable-lto --prefix=/solaris-x86_64 --disable-multilib --disable-nls --target=x86_64-sunos-solaris2.11 --with-sysroot=/solaris-x86_64 --disable-werror --enable-plugins
which is what I’ve been doing.
Assuming that you didn’t make a typo when you typed "x86-64” (with a dash, not an underscore), I also tried:
--target=x86-64-sunos-solaris2.11
but then the target triple parser presumably gets confused and complains:
Kernel `sunos' not known to work with OS `solaris2.11’
Looking at the binutils source code, the literal string "/lib/ld64.so.1” still occurs and the literal string "/lib/amd64/ld.so.1” still doesn’t.
- Paul
More information about the Binutils
mailing list