www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compilation Error when trying mir-optim BetterC

reply vladislavp <vladislavp outlook.com> writes:
Hello,
I am trying to create a 'boiler plate' project
that's essentially uses only betterC libraries
(and itself is betterC)

for my needs I would like to use mir-optim
(this is a linear optimization betterC lib)

However, I cannot seem to get passed compilation errors
when including mir-optim library.

I do not have any problem including mir-cpuid library.
So I am somewhat confused what I might be doing wrong.

Thank you in advance for any help.




On Linux Mint Tessa (based on Ubuntu 18)
--

LDC - the LLVM D compiler (1.8.0):
   based on DMD v2.078.3 and LLVM 5.0.1
   built with LDC - the LLVM D compiler (0.17.5)
   Default target: x86_64-pc-linux-gnu
   Host CPU: sandybridge

--

~/dlang/dmd-2.087.0/linux/bin64/dub   --compiler=ldc2 
--build=release

--

/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/ndsli
e/slice.d(1450,14): Error: function type 'pure nothrow  nogc  property return
 trusted float()' has 'return' bu
t does not return any indirections
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mi
/numeric.d(670,26): Error: template instance
mir.ndslice.slice.Slice!(FieldIterator!(LinspaceField!float), 1LU, cast(m
ir_slice_kind)2).mir_slice.front!0 error instantiating
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mi
/numeric.d(358,12):        instantiated from here: findRootImplGen!float
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/algorithm/i
eration.d(2170,54): Error: template instance
mir.algorithm.iteration.allImpl!(naryFun, Slice!(FieldIterat
or!(LinspaceField!float), 1LU, cast(mir_slice_kind)2), 
Slice!(FieldIterator!(LinspaceField!float), 1LU, 
cast(mir_slice_kind)2)) error instantiating
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/algorithm/i
eration.d(2424,24):        instantiated from here:
all!(Slice!(FieldIterator!(LinspaceField!float), 1LU,
cast(mir_slice_kind)2), 
Slice!(FieldIterator!(LinspaceField!float), 1LU, 
cast(mir_slice_kind)2))
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/ndsli
e/slice.d(1947,25):        instantiated from here:
equal!(Slice!(FieldIterator!(LinspaceField!float), 1LU, cast
(mir_slice_kind)2), Slice!(FieldIterator!(LinspaceField!float), 
1LU, cast(mir_slice_kind)2))
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/nds
ice/slice.d(385,1):        instantiated from here:
Slice!(FieldIterator!(LinspaceField!float), 1LU, cast(mir_slic
e_kind)2)
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/ndsl
ce/slice.d(398,24):        ... (2 instantiations, -v to show) ...
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mi
/numeric.d(640,26):        instantiated from here: linspace!(float, 1LU)
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mi
/numeric.d(358,12):        instantiated from here: findRootImplGen!float
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/ndsli
e/slice.d(1450,14): Error: function type 'pure nothrow  nogc  property return
 trusted double()' has 'return' b
ut does not return any indirections
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mi
/numeric.d(670,26): Error: template instance
mir.ndslice.slice.Slice!(FieldIterator!(LinspaceField!double), 1LU, cast(
mir_slice_kind)2).mir_slice.front!0 error instantiating
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mi
/numeric.d(376,12):        instantiated from here: findRootImplGen!double
/home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/algorithm/i
eration.d(2170,54): Error: template instance
mir.algorithm.iteration.allImpl!(naryFun, Slice!(FieldIterat
or!(LinspaceField!double), 1LU, cast(mir_slice_kind)2), 
Slice!(FieldIterator!(LinspaceField!double), 1LU, 
cast(mir_slice_kind)2)) error instantiating
ldc2 failed with exit code 1.
---
dub.json
{
   "authors": [
                 "test localhost"
         ],
         "copyright": "Copyright © 2019, test localhost",
         "dependencies": {
                 "mir-cpuid": "~>1.2.2",
                 "mir-optim": "~>1.4.5"
         },
         "dflags-ldc":["-mcpu=native", "-betterC"],
         "description": "user front end for Jitro controls",

}
Jul 18 2019
parent vladislavp <vladislavp outlook.com> writes:
On Thursday, 18 July 2019 at 21:09:53 UTC, vladislavp wrote:
 Hello,
 I am trying to create a 'boiler plate' project
 that's essentially uses only betterC libraries
 (and itself is betterC)

 for my needs I would like to use mir-optim
 (this is a linear optimization betterC lib)

 However, I cannot seem to get passed compilation errors
 when including mir-optim library.


 --

 ~/dlang/dmd-2.087.0/linux/bin64/dub   --compiler=ldc2 
 --build=release

 --

 /home/v/.dub/packages/mir-algorithm-3.4.19/mir-algorithm/source/mir/ndsli
e/slice.d(1450,14): Error: function type 'pure nothrow  nogc  property return
 trusted float()' has 'return' but does not return any indirections
 .....
Replying to my own question. I resolved previously reported ldc2 error. I removed distro (Ubuntu/Mint) version of ldc , and instead installed 1.16 from the release page ( https://github.com/ldc-developers/ldc/releases ). The compilation error is now gone. I also created the 'activate' script to setup paths (it was not avaialble in the LDC tar) in case is anyone interested it is attached below (just modify LDC2_ROOT variable) --- $ cat dlang/ldc2-1.16.0-linux-x86_64/activate deactivate() { export PATH="$_OLD_D_PATH" export LIBRARY_PATH="$_OLD_D_LIBRARY_PATH" export LD_LIBRARY_PATH="$_OLD_D_LD_LIBRARY_PATH" unset _OLD_D_LIBRARY_PATH unset _OLD_D_LD_LIBRARY_PATH unset DMD unset DC export PS1="$_OLD_D_PS1" unset _OLD_D_PATH unset _OLD_D_PS1 unset -f deactivate } _OLD_D_PATH="${PATH:-}" _OLD_D_LIBRARY_PATH="${LIBRARY_PATH:-}" _OLD_D_LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}" export LDC2_ROOT=~/dlang/ldc2-1.16.0-linux-x86_64 export LIBRARY_PATH="${LDC2_ROOT}/lib${LIBRARY_PATH:+:}${LIBRARY_PATH:-}" export LD_LIBRARY_PATH="${LDC2_ROOT}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH:-}" _OLD_D_PATH="${PATH:-}" _OLD_D_PS1="${PS1:-}" export PS1="(ldc2-1.16)${PS1:-}" export PATH="${LDC2_ROOT}/bin${PATH:+:}${PATH:-}" export DMD=ldmd2 export DC=ldc2 export DUB=dub
Jul 19 2019