digitalmars.D.ldc - Cross compiling from windows targetting linux armel arm9
- Sai (9/9) Dec 11 2016 As mentioned in the subject, I am trying to compile from windows
- kink (10/11) Dec 12 2016 The Windows binaries are available, and cross-compilation works
- Sai (8/19) Dec 12 2016 Oh, I guess I remembered incorrectly. But I am positive it worked
- kinke (8/10) Dec 12 2016 Visual Studio is exactly what you don't need, since you don't
- Sai (27/37) Dec 24 2016 I finally managed to install virtualbox and lubuntu.
- Nicholas Wilson (3/24) Dec 24 2016 try the `-relocation-model` flag (look at the help)
As mentioned in the subject, I am trying to compile from windows os targetting linux arm9 (armel) arch. There used to be a link to the binary ldc2 compiler to do this, but now I am unable to find that link. Is it not supported anymore? or the link just moved to a new place and I am unable to find it? Any help would be appreciated. I am using windows os as it's a work PC and cannot install linux. Thanks Sai
Dec 11 2016
On Monday, 12 December 2016 at 04:49:33 UTC, Sai wrote:There used to be a link to the binary ldc2 compiler to do thisThe Windows binaries are available, and cross-compilation works as usual with `-mtriple=...`. This will allow you to generate object files. You'll need to figure out how to build druntime-ldc and phobos2-ldc for your target and then how to link your cross-compiled objects against those libs and the C runtime (e.g., building LDC yourself for armel and using that for native linking?). I don't think there ever was an LDC binary automating some of this, please correct me if I'm wrong.
Dec 12 2016
On Monday, 12 December 2016 at 09:34:42 UTC, kink wrote:On Monday, 12 December 2016 at 04:49:33 UTC, Sai wrote:Oh, I guess I remembered incorrectly. But I am positive it worked out of the box in linux though, using the default ldc2 that gets installed by apt-get. I tested that using another computer. But I wish it also worked out of the box in windows. This is mainly for programming the EV3 lego mindstorm brick. Don't know if I can/want to build druntime now, I also don't have visual studio, etc.There used to be a link to the binary ldc2 compiler to do thisThe Windows binaries are available, and cross-compilation works as usual with `-mtriple=...`. This will allow you to generate object files. You'll need to figure out how to build druntime-ldc and phobos2-ldc for your target and then how to link your cross-compiled objects against those libs and the C runtime (e.g., building LDC yourself for armel and using that for native linking?). I don't think there ever was an LDC binary automating some of this, please correct me if I'm wrong.
Dec 12 2016
On Monday, 12 December 2016 at 16:57:36 UTC, Sai wrote:Don't know if I can/want to build druntime now, I also don't have visual studio, etc.Visual Studio is exactly what you don't need, since you don't target Windows. You need a linker (in your case most likely a Windows executable) able to target your ARM platform, and the libs. A matching GCC+binutils cross-compilation package (http://gnutoolchains.com/arm-eabi/ maybe) should work. You can then cross-compile the druntime objects and archive them manually to a static lib if need be.
Dec 12 2016
On Monday, 12 December 2016 at 22:54:43 UTC, kinke wrote:On Monday, 12 December 2016 at 16:57:36 UTC, Sai wrote:I finally managed to install virtualbox and lubuntu. Now I get the following errors. Please help? $ cat t.d import std.stdio; int main(string[] args) { writefln("Hello world!"); return 0; } $ ldc2 t.d /usr/bin/ld: t.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 $ gdc t.d /usr/include/d/core/stdc/stdarg.d:48:23: error: undefined identifier '__va_list_tag' alias __va_list = __va_list_tag; ^ $ ldc2 -no-pie t.d ldc2: Unknown command line argument '-no-pie'. Try: 'ldc2 -help' ldc2: Did you mean '-noasm'? $ gdc -no-pie t.d /usr/include/d/core/stdc/stdarg.d:48:23: error: undefined identifier '__va_list_tag' alias __va_list = __va_list_tag;Don't know if I can/want to build druntime now, I also don't have visual studio, etc.Visual Studio is exactly what you don't need, since you don't target Windows. You need a linker (in your case most likely a Windows executable) able to target your ARM platform, and the libs. A matching GCC+binutils cross-compilation package (http://gnutoolchains.com/arm-eabi/ maybe) should work. You can then cross-compile the druntime objects and archive them manually to a static lib if need be.
Dec 24 2016
On Sunday, 25 December 2016 at 01:25:12 UTC, Sai wrote:$ ldc2 t.d /usr/bin/ld: t.o: relocation R_X86_64_32 againstAre you still trying to target arm? why is R_X86_64_32 appearing.`.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 $ gdc t.d /usr/include/d/core/stdc/stdarg.d:48:23: error: undefined identifier '__va_list_tag' alias __va_list = __va_list_tag; ^ $ ldc2 -no-pie t.d ldc2: Unknown command line argument '-no-pie'. Try: 'ldc2 -help' ldc2: Did you mean '-noasm'?try the `-relocation-model` flag (look at the help)$ gdc -no-pie t.d /usr/include/d/core/stdc/stdarg.d:48:23: error: undefined identifier '__va_list_tag' alias __va_list = __va_list_tag;
Dec 24 2016
On Sunday, 25 December 2016 at 05:35:05 UTC, Nicholas Wilson wrote:On Sunday, 25 December 2016 at 01:25:12 UTC, Sai wrote:Yes, I am still targeting ARM, but for initial development I will be compiling to x86_64 just to simplify coding and testing of the logic, I will be using sw simulators to emulate the robot. Thanks for the tip, I will try that flag shortly.$ ldc2 t.d /usr/bin/ld: t.o: relocation R_X86_64_32 againstAre you still trying to target arm? why is R_X86_64_32 appearing.`.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 $ gdc t.d /usr/include/d/core/stdc/stdarg.d:48:23: error: undefined identifier '__va_list_tag' alias __va_list = __va_list_tag; ^ $ ldc2 -no-pie t.d ldc2: Unknown command line argument '-no-pie'. Try: 'ldc2 -help' ldc2: Did you mean '-noasm'?try the `-relocation-model` flag (look at the help)$ gdc -no-pie t.d /usr/include/d/core/stdc/stdarg.d:48:23: error: undefined identifier '__va_list_tag' alias __va_list = __va_list_tag;
Dec 25 2016
This used to work, but after updating to LDC 1.1.0, it stopped working, now I get this error: sai saivb:~/tmp$ ldc2 t.d /usr/bin/ld: /home/sai/Programs/ldc2-1.1.0-linux-x86_64/bin/../lib/libdrunti e-ldc.a(errno.c.o): relocation R_X86_64_PC32 against symbol `__errno_location GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 sai saivb:~/tmp$ ldc2 -relocation-model=dynamic-no-pic t.d /usr/bin/ld: /home/sai/Programs/ldc2-1.1.0-linux-x86_64/bin/../lib/libdrunti e-ldc.a(errno.c.o): relocation R_X86_64_PC32 against symbol `__errno_location GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 Any help is appreciated. Testing on Ubuntu 16.10 with all updates installed.try the `-relocation-model` flag (look at the help)
Feb 16 2017
On Thursday, 16 February 2017 at 16:57:56 UTC, Sai wrote:Any help is appreciated. Testing on Ubuntu 16.10 with all updates installed.-relocation-model=pic ?
Feb 16 2017
On Thursday, 16 February 2017 at 17:47:28 UTC, kinke wrote:On Thursday, 16 February 2017 at 16:57:56 UTC, Sai wrote:I tried that too, but no luck :-( sai saivb:~/tmp$ ldc2 -relocation-model=pic t.d /usr/bin/ld: /home/sai/Programs/ldc2-1.1.0-linux-x86_64/bin/../lib/libdrunti e-ldc.a(errno.c.o): relocation R_X86_64_PC32 against symbol `__errno_location GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 BTW: sai saivb:~/tmp$ cat t.d import std.stdio; int main(string[] args) { writefln("Hello world!"); return 0; }Any help is appreciated. Testing on Ubuntu 16.10 with all updates installed.-relocation-model=pic ?
Feb 16 2017
On Friday, 17 February 2017 at 02:10:41 UTC, Sai wrote:On Thursday, 16 February 2017 at 17:47:28 UTC, kinke wrote:Your linker complains about druntime not having been compiled with `-relocation-model=pic`. If PIC is mandatory for Ubuntu 16.10, even for executables and not just shared objects, then you'd need to recompile druntime/Phobos yourself. But I'd first look into your command-line flags/config file, as the error message is rather strange, you probably want an executable and not a DLL.On Thursday, 16 February 2017 at 16:57:56 UTC, Sai wrote:I tried that too, but no luck :-( sai saivb:~/tmp$ ldc2 -relocation-model=pic t.d /usr/bin/ld: /home/sai/Programs/ldc2-1.1.0-linux-x86_64/bin/../lib/libdrunti e-ldc.a(errno.c.o): relocation R_X86_64_PC32 against symbol `__errno_location GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 BTW: sai saivb:~/tmp$ cat t.d import std.stdio; int main(string[] args) { writefln("Hello world!"); return 0; }Any help is appreciated. Testing on Ubuntu 16.10 with all updates installed.-relocation-model=pic ?
Feb 17 2017
On Friday, 17 February 2017 at 09:12:36 UTC, kinke wrote:On Friday, 17 February 2017 at 02:10:41 UTC, Sai wrote:I am getting the feeling that LDC is not ready for newbies/hobbyists. I am thinking may be I should stick with previous version for now. I guess I can always fall back to C++ if this does not work.On Thursday, 16 February 2017 at 17:47:28 UTC, kinke wrote:Your linker complains about druntime not having been compiled with `-relocation-model=pic`. If PIC is mandatory for Ubuntu 16.10, even for executables and not just shared objects, then you'd need to recompile druntime/Phobos yourself. But I'd first look into your command-line flags/config file, as the error message is rather strange, you probably want an executable and not a DLL.On Thursday, 16 February 2017 at 16:57:56 UTC, Sai wrote:I tried that too, but no luck :-( sai saivb:~/tmp$ ldc2 -relocation-model=pic t.d /usr/bin/ld: /home/sai/Programs/ldc2-1.1.0-linux-x86_64/bin/../lib/libdrunti e-ldc.a(errno.c.o): relocation R_X86_64_PC32 against symbol `__errno_location GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 BTW: sai saivb:~/tmp$ cat t.d import std.stdio; int main(string[] args) { writefln("Hello world!"); return 0; }Any help is appreciated. Testing on Ubuntu 16.10 with all updates installed.-relocation-model=pic ?
Feb 17 2017