So, pytorch builds some final shared objects that contain all the code. If you want to use pytorch as a C/++ library, you have to link against _C.so and libshm and libcaffe2
The problem I’ve run into on OSX is this:
ld: can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file

I need to add a target to pytorch to get it to build me a dylib file. I know that python can load it.
Following the response here:

  
      stackoverflow.com
  
  
      
    
  

  What are the g++ flags to build a true .so/MH_BUNDLE shared library on mac osx (not a dylib)? 3



  c++, macos, shared-libraries



  asked by
  
  
    marathon
  
  on 09:56PM - 01 Jul 14


  
  
    
    
  
  


I think I only need to change the command that produces the .so from using -bundle to -shared. I don’t know where that is, and I’m not familiar with python’s setup.py conventions.