This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Cross compiling for Linux on Windows (ld linker output file won't run as executable on linux and has undefined symbols)
- From: pinskia at gmail dot com
- To: Nicholas Clifton <nickc at redhat dot com>
- Cc: Kim <soldoutseashell at gmail dot com>, Binutils Development <binutils at sourceware dot org>
- Date: Wed, 23 Apr 2014 02:33:43 -0700
- Subject: Re: Cross compiling for Linux on Windows (ld linker output file won't run as executable on linux and has undefined symbols)
- Authentication-results: sourceware.org; auth=none
- References: <5357470A dot 2010105 at gmail dot com> <535787B6 dot 4070309 at redhat dot com>
> On Apr 23, 2014, at 2:28 AM, Nicholas Clifton <nickc@redhat.com> wrote:
>
> Hi Kim,
>
>> The problem is, the output file is slightly different
>> than the one produced on linux and it won't run as an executable. I
>> noticed, for example, that in the version linked on windows there is the
>> undefined symbol "printf" which appears to have become "puts" instead in
>> the linux version.
>
> I suspect that the printf/puts variance may be a red herring.
>
>> Anyway I'm wondering if anyone knows what is happening here.
>
>> k@system:/shared$ ./Test
>> bash: ./Test: No such file or dire
>
> What happens if you run "file ./Test" ?
> What happens if you run "ldd ./Test" ?
Also make sure the file has its executable bit set. I bet this is the problem.
Thanks,
Andrew
>
>
> Also it appears that you are linking against different math's libraries:
>
>> Linking on Windows:
>> attempt to open I:\Linux\libs\lib\x86_64-linux-gnu\libm-2.17.so succeeded
>
>> Linking on linux:
>> attempt to open /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.so succeeded
>
>
> And that as a result you are pulling in the wrong C library:
>
> > Linking on Windows:
>> ld-linux-x86-64.so.2 needed by I:/Linux/libs/lib/x86_64-linux-gnu/libc-2.17.so
>
>
> Also - which version of the linker are you using ? If it is an old version then that may be causing you problems.
>
> Cheers
> Nick
>