Jump to page: 1 2
Thread overview
port to NetBSD
Jan 06, 2016
Nikolay
Jan 06, 2016
David Nadlinger
Jan 07, 2016
Joakim
Jan 07, 2016
Kai Nacke
Jan 08, 2016
Nikolay
Jan 08, 2016
Joakim
Jan 09, 2016
Nikolay
Jan 09, 2016
Nikolay
Jan 09, 2016
Nikolay
Jan 09, 2016
Nikolay
Jan 08, 2016
David Nadlinger
Jan 09, 2016
Nikolay
Jan 09, 2016
Kai Nacke
Jan 09, 2016
Kai Nacke
Jan 11, 2016
Nikolay
Jan 12, 2016
Nikolay
January 06, 2016
I am trying compile ldc (git master) on NetBSD 7.0 Currently I stuck on link error for ldc2:

/usr/pkg/bin/cmake -E cmake_link_script CMakeFiles/ldc2.dir/link.txt --verbose=1
/usr/bin/c++     CMakeFiles/ldc2.dir/driver/cl_options.cpp.o CMakeFiles/ldc2.dir/driver/codegenerator.cpp.o CMakeFiles/ldc2.dir/driver/configfile.cpp.o CMakeFiles/ldc2.dir/driver/exe_path.cpp.o CMakeFiles/ldc2.dir/driver/targetmachine.cpp.o CMakeFiles/ldc2.dir/driver/toobj.cpp.o CMakeFiles/ldc2.dir/driver/tool.cpp.o CMakeFiles/ldc2.dir/driver/linker.cpp.o CMakeFiles/ldc2.dir/driver/main.cpp.o CMakeFiles/ldc2.dir/driver/ldc-version.cpp.o  -o bin/ldc2  lib/libldc.a /usr/pkg/lib/libconfig.so -lpthread -lterminfo -lLLVMOption -lLLVMLTO -lLLVMObjCARCOpts -lLLVMLinker -lLLVMIRReader -lLLVMInstrumentation -lLLVMBitWriter -lLLVMAsmParser -lLLVMR600CodeGen -lLLVMipo -lLLVMVectorize -lLLVMR600AsmParser -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMX86Desc -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMMC -lLLVMX86Utils -lLLVMCore -lLLVMSupport -L/usr/pkg/lib -lz -lpthread -ledit -lterminfo -lm -lpthread -lterminfo -Wl,-rpath,/usr/pkg/lib:
CMakeFiles/ldc2.dir/driver/main.cpp.o: In function `main':
main.cpp:(.text.startup.main+0x146b): undefined reference to `Port::stricmp(char const*, char const*)'
main.cpp:(.text.startup.main+0x1c5b): undefined reference to `Port::stricmp(char const*, char const*)'
lib/libldc.a(builtin.c.o): In function `eval_sqrt(Loc, FuncDeclaration*, Array<Expression*>*)':


It looks like problem with dmd2/root/port.c CMakeFiles/LDCShared.dir/dmd2/root/port.c.o is not included into CMakeFiles/ldc2.dir/link.txt

Also I can not find any symbols inside port.c.o file

Can somebody give advice how to resolve this problem?




January 06, 2016
Dear Nikolay,

On 6 Jan 2016, at 19:18, Nikolay via digitalmars-d-ldc wrote:
> It looks like problem with dmd2/root/port.c CMakeFiles/LDCShared.dir/dmd2/root/port.c.o is not included into CMakeFiles/ldc2.dir/link.txt

port.c is part of libldc.a, so this is not the issue. Instead, as you noted (absence of any symbols) port.c currently does not have an implementation for NetBSD.

The file is designed to encapsulate all the functions used within the front-end that are not portable between operating systems. You'll need to implement it for NetBSD, although I suspect you can probably re-use most of the __FreeBSD__ and __OpenBSD__ code.

Best,
David
January 07, 2016
On Wednesday, 6 January 2016 at 18:36:10 UTC, David Nadlinger wrote:
> Dear Nikolay,
>
> On 6 Jan 2016, at 19:18, Nikolay via digitalmars-d-ldc wrote:
>> It looks like problem with dmd2/root/port.c CMakeFiles/LDCShared.dir/dmd2/root/port.c.o is not included into CMakeFiles/ldc2.dir/link.txt
>
> port.c is part of libldc.a, so this is not the issue. Instead, as you noted (absence of any symbols) port.c currently does not have an implementation for NetBSD.
>
> The file is designed to encapsulate all the functions used within the front-end that are not portable between operating systems. You'll need to implement it for NetBSD, although I suspect you can probably re-use most of the __FreeBSD__ and __OpenBSD__ code.

In addition, I see 14 more files which reference FreeBSD somewhere, so you will have to look at each of those and make sure you make the necessary changes for NetBSD.  In most cases, all that should be necessary is adding the equivalent NetBSD check to the list of Posix-like OS's.
January 07, 2016
On Thursday, 7 January 2016 at 03:14:48 UTC, Joakim wrote:
> On Wednesday, 6 January 2016 at 18:36:10 UTC, David Nadlinger wrote:
>> Dear Nikolay,
>>
>> On 6 Jan 2016, at 19:18, Nikolay via digitalmars-d-ldc wrote:
>>> It looks like problem with dmd2/root/port.c CMakeFiles/LDCShared.dir/dmd2/root/port.c.o is not included into CMakeFiles/ldc2.dir/link.txt
>>
>> port.c is part of libldc.a, so this is not the issue. Instead, as you noted (absence of any symbols) port.c currently does not have an implementation for NetBSD.
>>
>> The file is designed to encapsulate all the functions used within the front-end that are not portable between operating systems. You'll need to implement it for NetBSD, although I suspect you can probably re-use most of the __FreeBSD__ and __OpenBSD__ code.
>
> In addition, I see 14 more files which reference FreeBSD somewhere, so you will have to look at each of those and make sure you make the necessary changes for NetBSD.  In most cases, all that should be necessary is adding the equivalent NetBSD check to the list of Posix-like OS's.

After porting the compiler you also need to enhance druntime. In most cases you can simple duplicate the FreeBSD code I guess.

I am happy to accept PR's for ldc code. druntime PR's should go upstream first. I will then cherry-pick them if necessary.

Regards,
Kai
January 08, 2016
On Thursday, 7 January 2016 at 23:22:45 UTC, Kai Nacke wrote:
>
> After porting the compiler you also need to enhance druntime. In most cases you can simple duplicate the FreeBSD code I guess.
>

Life is not so simple. Currently I have following troubles with druntime:

   - For some reason static ctor std.stdiobase is not called. So I have to call std_stdio_static_this() manually.
   - I have troubles with floating point methods like llroundl, remainderl, ... As I can understand they are builtin in C compiler and there is no library for them. Also I have one failed assert in phobos std.internal.math.gammafunction.logmdigammaInverse :  static assert(maxY > 0 && maxY <= real.max); My be it is related to the previous problem.

> I am happy to accept PR's for ldc code. druntime PR's should go upstream first. I will then cherry-pick them if necessary.
>
> Regards,
> Kai

https://github.com/ldc-developers/ldc/pull/1247

My github:
https://github.com/nrTQgc/ldc
https://github.com/nrTQgc/druntime.git
https://github.com/nrTQgc/phobos.git
January 08, 2016
On Friday, 8 January 2016 at 18:08:38 UTC, Nikolay wrote:
> On Thursday, 7 January 2016 at 23:22:45 UTC, Kai Nacke wrote:
>>
>> After porting the compiler you also need to enhance druntime. In most cases you can simple duplicate the FreeBSD code I guess.
>>
>
> Life is not so simple. Currently I have following troubles with druntime:
>
>    - For some reason static ctor std.stdiobase is not called. So I have to call std_stdio_static_this() manually.
>    - I have troubles with floating point methods like llroundl, remainderl, ... As I can understand they are builtin in C compiler and there is no library for them. Also I have one failed assert in phobos std.internal.math.gammafunction.logmdigammaInverse :  static assert(maxY > 0 && maxY <= real.max); My be it is related to the previous problem.

Looks like you got pretty far, as most of those are problems in phobos, not druntime.  For the last one, try turning maxY into a runtime variable, ie replace enum with real, and change that static assert to regular assert, ie remove static.  That fixed the issue for me on ARM, which was due to CTFE.  Are you cross-compiling or compiling on NetBSD itself?

>> I am happy to accept PR's for ldc code. druntime PR's should go upstream first. I will then cherry-pick them if necessary.
>>
>> Regards,
>> Kai
>
> https://github.com/ldc-developers/ldc/pull/1247
>
> My github:
> https://github.com/nrTQgc/ldc
> https://github.com/nrTQgc/druntime.git
> https://github.com/nrTQgc/phobos.git

I'll take a look.
January 08, 2016
On 8 Jan 2016, at 19:08, Nikolay via digitalmars-d-ldc wrote:
> - For some reason static ctor std.stdiobase is not called. So I have to call std_stdio_static_this() manually.

Are the other (shared) static constructors being called? Which ones?

 — David
January 09, 2016
On Friday, 8 January 2016 at 19:18:56 UTC, David Nadlinger wrote:
> On 8 Jan 2016, at 19:08, Nikolay via digitalmars-d-ldc wrote:
>> - For some reason static ctor std.stdiobase is not called. So I have to call std_stdio_static_this() manually.
>
> Are the other (shared) static constructors being called? Which ones?
>
>  — David

No
As I can undertand rt.sections_elf_shared._d_dso_registry is not called for all modules
January 09, 2016
On Friday, 8 January 2016 at 19:09:09 UTC, Joakim wrote:
For the last one, try turning maxY into
> a runtime variable, ie replace enum with real, and change that static assert to regular assert, ie remove static.  That fixed the issue for me on ARM, which was due to CTFE.

Thanks It resolves problem

> Are you cross-compiling or compiling on NetBSD itself?
>
I installed NetBSD to VirtualBox and do not use cross-compiling

January 09, 2016
On Saturday, 9 January 2016 at 05:49:39 UTC, Nikolay wrote:
> On Friday, 8 January 2016 at 19:09:09 UTC, Joakim wrote:
> For the last one, try turning maxY into
>> a runtime variable, ie replace enum with real, and change that static assert to regular assert, ie remove static.  That fixed the issue for me on ARM, which was due to CTFE.
>
> Thanks It resolves problem
>

Ops I was wrong. It just move problem from compile-time to later. The source is  undefined reference to symbols like llroundl, remainderl, ...

« First   ‹ Prev
1 2