public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: Steve Wise
	<swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>,
	ewg-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org,
	'Vladimir Sokolovsky'
	<vlad-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: OFED-4.8, rdma-core, and library paths
Date: Tue, 7 Feb 2017 22:14:28 +0200	[thread overview]
Message-ID: <20170207201428.GV6005@mtr-leonro.local> (raw)
In-Reply-To: <20170207194759.GU6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 4311 bytes --]

On Tue, Feb 07, 2017 at 09:47:59PM +0200, Leon Romanovsky wrote:
> On Tue, Feb 07, 2017 at 11:42:06AM -0700, Jason Gunthorpe wrote:
> > On Tue, Feb 07, 2017 at 08:35:38PM +0200, Leon Romanovsky wrote:
> > > I made it (rdma_shared_provider function), but have a very hard time
> > > to properly create ".." symlink, because during the build (in place too)
> > > the output is placed in build/lib in flat structure and symlinks need to
> > > be without "..". But during installation phase, these symlinks should
> > > be changed to ".." and it doesn't work for me in automatic way :(
> >
> > For symlinks build/ and installed are two different flows, they don't intermix
> >
> > Compile the library to build/lib/libibverbs-dv-mlx5.so.1.0.13
> > and setup a symlink build/lib/libmlx5-rdmav2.so -> libibverbs-dv-mlx5.so.1.0.13
>
> Just as a note, I'm calling it libmlx5 and not libibverbs-dv-mlx5.
>
> >
> > For install, use realpath like this:
> >
> >  execute_process(COMMAND "realpath --relative-to ${VERBS_PROVIDER_DIR} ${CMAKE_INSTALL_LIBDIR}/libmlx5.so.1.0.13" OUTPUT_VARIBALE LINK_PATH)
>
> It doesn't work for me :(
> -- verbs_provder_dir = /usr/lib64/libibverbs
> -- install_libdir = /usr/lib64
> -- link_path =
>
> lrwxrwxrwx 1 root root     18 Feb  7 21:43 /lib64/libibverbs/libmlx5-rdmav2.so -> /libmlx5.so.1.0.13
> lrwxrwxrwx 1 root root     10 Feb  7 21:43 /lib64/libmlx5-rdmav2.so -> libmlx5.so
> lrwxrwxrwx 1 root root     12 Feb  7 21:43 /lib64/libmlx5.so -> libmlx5.so.1
> lrwxrwxrwx 1 root root     17 Feb  7 21:43 /lib64/libmlx5.so.1 -> libmlx5.so.1.0.13
> -rwxr-xr-x 1 root root 666637 Feb  7 21:43 /lib64/libmlx5.so.1.0.13
> lrwxrwxrwx 1 root root     18 Feb  7 21:43 /usr/lib64/libibverbs/libmlx5-rdmav2.so -> /libmlx5.so.1.0.13
> lrwxrwxrwx 1 root root     10 Feb  7 21:43 /usr/lib64/libmlx5-rdmav2.so -> libmlx5.so
> lrwxrwxrwx 1 root root     12 Feb  7 21:43 /usr/lib64/libmlx5.so -> libmlx5.so.1
> lrwxrwxrwx 1 root root     17 Feb  7 21:43 /usr/lib64/libmlx5.so.1 -> libmlx5.so.1.0.13
> -rwxr-xr-x 1 root root 666637 Feb  7 21:43 /usr/lib64/libmlx5.so.1.0.13
>
>
> >  rdma_install_symlink("${LINK_PATH}/libibverbs-dv-mlx5.so.1.0.13" "${VERBS_PROVIDER_DIR}/libmlx5-rdmav2.so")
> >
> > The rdma_install_symlink helper takes care of the install step.
> >

At the end, my function looks as follow:

# Create a special provider with exported symbols in it
function(rdma_shared_provider DEST VERSION_SCRIPT SOVERSION VERSION)
  # Installed driver file
  file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${DEST}.driver" "driver ${DEST}\n")
  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${DEST}.driver" DESTINATION "${CONFIG_DIR}")

  # Uninstalled driver file
  file(MAKE_DIRECTORY "${BUILD_ETC}/libibverbs.d/")
  file(WRITE "${BUILD_ETC}/libibverbs.d/${DEST}.driver" "driver ${BUILD_LIB}/lib${DEST}\n")

  # Create a static provider library
  if (ENABLE_STATIC)
    add_library(${DEST} STATIC ${ARGN})
    set_target_properties(${DEST} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
    install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")

    list(APPEND RDMA_STATIC_LIBS ${DEST}-rdmav2 ${DEST})
    set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
  endif()

  # Create the plugin shared library
  add_library(${DEST} SHARED ${ARGN})
  # Even though these are modules we still want to use Wl,--no-undefined
  set_target_properties(${DEST} PROPERTIES LINK_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
  rdma_set_library_map(${DEST} ${VERSION_SCRIPT})

  target_link_libraries(${DEST} LINK_PRIVATE ${COMMON_LIBS_PIC})
  target_link_libraries(${DEST} LINK_PRIVATE ibverbs)
  target_link_libraries(${DEST} LINK_PRIVATE ${CMAKE_THREAD_LIBS_INIT})
  set_target_properties(${DEST} PROPERTIES
  	SOVERSION ${SOVERSION}
  	VERSION ${VERSION}
  	LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
  add_custom_target(share_link ALL DEPENDS "${DEST}"  COMMAND ${CMAKE_COMMAND} -E create_symlink "lib${DEST}.so.${VERSION}"
	  "${BUILD_LIB}/lib${DEST}-rdmav2.so")
  add_dependencies(share_link ${DEST})

  install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
  install(FILES "${BUILD_LIB}/lib${DEST}-rdmav2.so" DESTINATION "${CMAKE_INSTALL_LIBDIR}")
  rdma_install_symlink("${CMAKE_INSTALL_LIBDIR}/lib${DEST}.so.${VERSION}" "${VERBS_PROVIDER_DIR}/libmlx5-rdmav2.so")
endfunction()

> > Jason



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2017-02-07 20:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 15:07 OFED-4.8, rdma-core, and library paths Steve Wise
2017-02-07 14:18 ` Vladimir Sokolovsky
     [not found]   ` <5899D735.3060503-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-02-07 15:37     ` Steve Wise
2017-02-07 17:11 ` Jason Gunthorpe
     [not found]   ` <20170207171145.GB1077-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-07 17:19     ` Steve Wise
2017-02-07 17:27       ` Jason Gunthorpe
     [not found]         ` <20170207172752.GA12315-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-07 18:06           ` Leon Romanovsky
     [not found]             ` <20170207180642.GQ6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-02-07 18:18               ` Jason Gunthorpe
     [not found]                 ` <20170207181814.GA13368-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-07 18:35                   ` Leon Romanovsky
     [not found]                     ` <20170207183538.GT6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-02-07 18:42                       ` Jason Gunthorpe
     [not found]                         ` <20170207184206.GA14102-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-07 19:47                           ` Leon Romanovsky
     [not found]                             ` <20170207194759.GU6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-02-07 20:14                               ` Leon Romanovsky [this message]
     [not found]                                 ` <20170207201428.GV6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-02-07 20:59                                   ` Jason Gunthorpe
     [not found]                                     ` <20170207205930.GA28922-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-08  6:37                                       ` Leon Romanovsky
     [not found]                                         ` <20170208063758.GZ6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-02-08  8:09                                           ` Leon Romanovsky
2017-02-08 17:33                                           ` Jason Gunthorpe
     [not found]                                             ` <20170208173335.GB30720-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-08 18:01                                               ` Leon Romanovsky
     [not found]                                                 ` <20170208180104.GG6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-02-08 18:18                                                   ` Jason Gunthorpe
     [not found]                                                     ` <20170208181820.GA31664-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-08 18:54                                                       ` Leon Romanovsky
     [not found]                                                         ` <20170208185446.GH6005-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-02-08 20:56                                                           ` Jason Gunthorpe
     [not found]                                                             ` <20170208205622.GA32427-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-09  5:31                                                               ` Leon Romanovsky
2017-02-09  9:53                                                               ` Benjamin Drung
     [not found]                                                                 ` <1486634006.3632.5.camel-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2017-02-09 12:32                                                                   ` Leon Romanovsky
2017-02-08 19:39                                                       ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170207201428.GV6005@mtr-leonro.local \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=ewg-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org \
    --cc=vlad-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox