Linker error during arm-gcc cross compile

View: New views
6 Messages — Rating Filter:   Alert me  

Linker error during arm-gcc cross compile

by Christian Auby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Compiling from windows to gcc-arm linux using codesourcery toolchain,
version (Sourcery G++ Lite 2009q1-203) 4.3.3.

Command: bjam toolset=gcc-arm target-os=linux threadapi=pthread

Output:

d:/dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld.exe:
cannot open output file
bin\gcc-arm\debug\target-os-linux\threadapi-pthread\threading-multi\server:
Permission denied
collect2: ld returned 1 exit status

Everything compiles up to this point, but the final linking fails. Am I
doing something wrong?

Regards,

Christian
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Linker error during arm-gcc cross compile

by Vladimir Prus-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christian Auby wrote:

> Compiling from windows to gcc-arm linux using codesourcery toolchain,
> version (Sourcery G++ Lite 2009q1-203) 4.3.3.
>
> Command: bjam toolset=gcc-arm target-os=linux threadapi=pthread
>
> Output:
>
>
d:/dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld.exe:
> cannot open output file
> bin\gcc-arm\debug\target-os-linux\threadapi-pthread\threading-multi\server:
> Permission denied
> collect2: ld returned 1 exit status
>
> Everything compiles up to this point, but the final linking fails. Am I
> doing something wrong?

Christian,

what is the full command that fails? What happens if you run:

        echo test > bin\gcc-arm\debug\target-os-linux\threadapi-pthread\threading-multi\server

?

- Volodya


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Linker error during arm-gcc cross compile

by Christian Auby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have figured out why it happens:

when using toolset=gcc-arm it still tries to link with winsock (ws2_32),
which the arm-gcc linker can't find. There is no error message displayed
from ld. Shouldn't boost.build display this? Or maybe all ld is giving
is the cryptic one.

Anyway: I haven't found a way to only link a library if I'm on a
particular OS. The current rule is as follows:

lib winsock
  :
  : <name>ws2_32
  ;

lib myLib
  : glob [ source/*.cpp ]
    winsock
  : <link>static
  ;

Is there some way for myLib to only link with winsock if target-os is
"windows"?

Regards,

Christian

Vladimir Prus wrote:

> Christian Auby wrote:
>
>> Compiling from windows to gcc-arm linux using codesourcery toolchain,
>> version (Sourcery G++ Lite 2009q1-203) 4.3.3.
>>
>> Command: bjam toolset=gcc-arm target-os=linux threadapi=pthread
>>
>> Output:
>>
>>
> d:/dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld.exe:
>> cannot open output file
>> bin\gcc-arm\debug\target-os-linux\threadapi-pthread\threading-multi\server:
>> Permission denied
>> collect2: ld returned 1 exit status
>>
>> Everything compiles up to this point, but the final linking fails. Am I
>> doing something wrong?
>
> Christian,
>
> what is the full command that fails? What happens if you run:
>
>         echo test > bin\gcc-arm\debug\target-os-linux\threadapi-pthread\threading-multi\server
>
> ?
>
> - Volodya
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
>
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Linker error during arm-gcc cross compile

by Vladimir Prus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 30 September 2009 Christian Auby wrote:

> I have figured out why it happens:
>
> when using toolset=gcc-arm it still tries to link with winsock (ws2_32),
> which the arm-gcc linker can't find. There is no error message displayed
> from ld. Shouldn't boost.build display this? Or maybe all ld is giving
> is the cryptic one.

Christian,

I don't think boost.build intentionally hides any error messages.
Is an error message produced if you run the link command manually?
 

> Anyway: I haven't found a way to only link a library if I'm on a
> particular OS. The current rule is as follows:
>
> lib winsock
>   :
>   : <name>ws2_32
>   ;
>
> lib myLib
>   : glob [ source/*.cpp ]
>     winsock
>   : <link>static
>   ;
>
> Is there some way for myLib to only link with winsock if target-os is
> "windows"?

The following should work:

 lib myLib
   : glob [ source/*.cpp ]
   : <link>static <target-os>windows:<library>winsock
   ;

Does this help?

- Volodya
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Linker error during arm-gcc cross compile

by Christian Auby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You are correct, the same error happens if I just call the gcc linker
line by myself.

I tried the echo test, and it says "no access". (well, in norwegian)
Could the path be too long?

The linker tip is exactly what I wanted, thanks for that!

Christian

Vladimir Prus wrote:

> On Wednesday 30 September 2009 Christian Auby wrote:
>
>> I have figured out why it happens:
>>
>> when using toolset=gcc-arm it still tries to link with winsock (ws2_32),
>> which the arm-gcc linker can't find. There is no error message displayed
>> from ld. Shouldn't boost.build display this? Or maybe all ld is giving
>> is the cryptic one.
>
> Christian,
>
> I don't think boost.build intentionally hides any error messages.
> Is an error message produced if you run the link command manually?
>  
>> Anyway: I haven't found a way to only link a library if I'm on a
>> particular OS. The current rule is as follows:
>>
>> lib winsock
>>   :
>>   : <name>ws2_32
>>   ;
>>
>> lib myLib
>>   : glob [ source/*.cpp ]
>>     winsock
>>   : <link>static
>>   ;
>>
>> Is there some way for myLib to only link with winsock if target-os is
>> "windows"?
>
> The following should work:
>
>  lib myLib
>    : glob [ source/*.cpp ]
>    : <link>static <target-os>windows:<library>winsock
>    ;
>
> Does this help?
>
> - Volodya
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
>
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Linker error during arm-gcc cross compile

by Christian Auby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Scratch that previous suggestion of the path being too long.

The reason is: The target folder has a folder called "server", so it
gets all confused and doesn't want to create a file called "server" as
well. If I use the exact same command but change "server" to
"server.bin" it links perfectly.

Now, how on earth would I prevent / work around this :P

Christian

Vladimir Prus wrote:

> On Wednesday 30 September 2009 Christian Auby wrote:
>
>> I have figured out why it happens:
>>
>> when using toolset=gcc-arm it still tries to link with winsock (ws2_32),
>> which the arm-gcc linker can't find. There is no error message displayed
>> from ld. Shouldn't boost.build display this? Or maybe all ld is giving
>> is the cryptic one.
>
> Christian,
>
> I don't think boost.build intentionally hides any error messages.
> Is an error message produced if you run the link command manually?
>  
>> Anyway: I haven't found a way to only link a library if I'm on a
>> particular OS. The current rule is as follows:
>>
>> lib winsock
>>   :
>>   : <name>ws2_32
>>   ;
>>
>> lib myLib
>>   : glob [ source/*.cpp ]
>>     winsock
>>   : <link>static
>>   ;
>>
>> Is there some way for myLib to only link with winsock if target-os is
>> "windows"?
>
> The following should work:
>
>  lib myLib
>    : glob [ source/*.cpp ]
>    : <link>static <target-os>windows:<library>winsock
>    ;
>
> Does this help?
>
> - Volodya
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
>
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build