libmir / mir-glas

[Experimental] LLVM-accelerated Generic Linear Algebra Subprograms
Other
103 stars 10 forks source link

Link-Error when building gemm_report.d #21

Closed MigMuc closed 7 years ago

MigMuc commented 7 years ago

I updated mir-glas and mir-cpuid as explained in README. Then compiling gemm_report with dub build --compiler=ldmd2 -b release --single gemm_report.d gives an error:


Compiling ../../../../../.dub/packages/mir-algorithm-0.6.5/mir-algorithm/source/mir/ndslice/topology.d...
Compiling ../../../../../.dub/packages/mir-algorithm-0.6.5/mir-algorithm/source/mir/primitives.d...
Compiling ../../../../../.dub/packages/mir-algorithm-0.6.5/mir-algorithm/source/mir/timeseries.d...
Compiling ../../../../../.dub/packages/mir-algorithm-0.6.5/mir-algorithm/source/mir/utility.d...
Linking...
Linking...
.dub/build/application-release-linux.posix-x86_64-ldc_2072-6A7D442D6DF721FDCC6B5AF6994A4118/gemm_report.o: In function `_Dmain':
../../../../../.dub/packages/mir-algorithm-0.6.5/mir-algorithm/source/mir/utility.d:(.text._Dmain[_Dmain]+0x8d4): undefined reference to `cblas_sgemm'
/home/miguel/Dokumente/DLang/mir-glas-0.2.3/mir-glas//libmir-glas.a(home.miguel.Dokumente.DLang.mir-glas-0.2.3.mir-glas.source.glas.precompiled.context.d.o): In function `glas_init':
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x17): undefined reference to `cpuid_init'
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x1c): undefined reference to `cpuid_dCache'
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x27): undefined reference to `cpuid_uCache'
collect2: Fehler: ld gab 1 als Ende-Status zurück
Error: /usr/bin/gcc failed with status: 1
ldmd2 failed with exit code 1.`
9il commented 7 years ago

Please check the master branch. It is updated

MigMuc commented 7 years ago

I downloaded the master branch and get the following error:


The determined compiler type "ldc" doesn't match the expected type "dmd". This will probably result in build errors.
Fetching cblas 2.0.0 (getting selected version)...
Performing "release" build using ldmd2 for x86_64.
mir-cpuid 0.5.2: target for configuration "library" is up to date.
mir-random 0.2.5: target for configuration "library" is up to date.
gemm_report ~master: building configuration "application"...
Running pre-build commands...
The determined compiler type "ldc" doesn't match the expected type "dmd". This will probably result in build errors.
Performing "target-native" build using ldmd2 for x86_64.
mir-glas ~master: building configuration "static"...
Compiling ../source/glas/precompiled/context.d...
Compiling ../source/glas/precompiled/l1c.d...`
... (SOME OUTPUT)
Linking...
Linking...
.dub/build/application-release-linux.posix-x86_64-ldc_2072-CEDFBA70ADBE859C9A66D36208BFBBE1/gemm_report.o: In function `_Dmain':
../../../../.dub/packages/mir-algorithm-0.6.5/mir-algorithm/source/mir/utility.d:(.text._Dmain[_Dmain]+0x8d4): undefined reference to `cblas_sgemm'
/home/miguel/Dokumente/DLang/mir-glas-master//libmir-glas.a(home.miguel.Dokumente.DLang.mir-glas-master.source.glas.precompiled.context.d.o): In function `glas_init':
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x17): undefined reference to `cpuid_init'
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x1c): undefined reference to `cpuid_dCache'
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x27): undefined reference to `cpuid_uCache'
collect2: Fehler: ld gab 1 als Ende-Status zurück
Error: /usr/bin/gcc failed with status: 1
ldmd2 failed with exit code 1.
9il commented 7 years ago

Please specify OS, dub version. Also you may try to remove dub.selections.json, .dub and rebuild with --force

MigMuc commented 7 years ago

I managed to overcome the error by linking against openblas:


/+ dub.json:
{
     "name": "gemm_report",
     "libs": ["openblas"],
     "lflags": ["-L$MIR_GLAS_PACKAGE_DIR", "-L$MIR_CPUID_PACKAGE_DIR", "-L..", "-L/opt/OpenBLAS/lib"],        "dependencies": {
             "cblas": "~>1.0.0",
             "mir-glas":{ "path": "../" },
             "mir-cpuid": "~>0.4.2",
             "mir-random": "~>0.2.3"
     }
}
+/

Previously I linked against cblas which comes with arch linux but it failed as mentioned earlier.