kohr-h commented on issue #13096: [Scala] `make scalapkg` fails if MKL-DNN is 
used
URL: 
https://github.com/apache/incubator-mxnet/issues/13096#issuecomment-435520719
 
 
   Actually, while writing up this report, I kept fiddling around and managed 
to solve the problem. At least temporarily for myself. Here's what works:
   
   1. Make the `Makefile` use environment `LDFLAGS`:
      ```bash
      $ git diff Makefile
      diff --git a/Makefile b/Makefile
      index b12311736..bc29c8705 100644
      --- a/Makefile
      +++ b/Makefile
      @@ -90,7 +90,7 @@ else
              CFLAGS += -O3 -DNDEBUG=1
       endif
       CFLAGS += -I$(TPARTYDIR)/mshadow/ -I$(TPARTYDIR)/dmlc-core/include -fPIC 
-I$(NNVM_PATH)/include -I$(DLPACK_PATH)/include -I$(TPARTYDIR)/tvm/include 
-Iinclude $(MSHADOW_CFLAGS)
      -LDFLAGS = -pthread $(MSHADOW_LDFLAGS) $(DMLC_LDFLAGS)
      +LDFLAGS += -pthread $(MSHADOW_LDFLAGS) $(DMLC_LDFLAGS)
    
       ifeq ($(ENABLE_TESTCOVERAGE), 1)
               CFLAGS += --coverage
      ```
      I assume that the original version was intentional, maybe to be able to 
start from scratch. So the above patch may not be acceptable.
   2. Set `LDFLAGS="-L$PWD/lib -lmkldnn" in the environment.
   
      At this stage, the error message changes. Instead of `undefined symbol`, 
we get
      ```
      java.lang.UnsatisfiedLinkError: 
/home/hkohr/git/mxnet/scala-package/init-native/linux-x86_64/target/libmxnet-init-scala-linux-x86_64.so:
 libmkldnn.so.0: cannot open shared object file: No such file or directory
      ```
      So we made it past the compilation phase but fail during linking because 
the linker doesn't find the shared library.
   3. Adding also `LD_LIBRARY_PATH=$PWD/lib` finally makes the build succeed.
   
   Now I'm not sure if amending `LD_LIBRARY_PATH` is really a sustainable 
solution. The other dependencies get linked statically, so they don't have this 
issue. Maybe there's a way to also build a static version of MKL-DNN? Because 
then one could simply amend `LIB_DEP`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to