devel/llvm,-python: symlink problem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

devel/llvm,-python: symlink problem

Sebastien Marie-3
Hi,

While testing lang/rust testsuite with lldb, I noted several failure due
to not properly packaged devel/llvm,-python.

devel/llvm,-python provides a lldb python module. The module used a
_lldb.so module, which is in fact a symlink to liblldb.so (installed in
/usr/local/lib).

the library is provided by devel/llvm, but its name isn't liblldb.so
but liblldb.so.0.0. The symlink is wrong, so the python module fails to
load.

$ python2.7 -c 'import lldb'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/lldb/__init__.py", line 39, in <module>
    import _lldb
ImportError: No module named _lldb
       

$ pkg_locate _lldb.so
py-llvm-6.0.1p2:devel/llvm,-python:/usr/local/lib/python2.7/site-packages/lldb/_lldb.so

$ ls -l /usr/local/lib/python2.7/site-packages/lldb/_lldb.so
lrwxr-xr-x  1 root  wheel  26 Dec  5 13:06 /usr/local/lib/python2.7/site-packages/lldb/_lldb.so@ -> ../../../../lib/liblldb.so

(it is /usr/local/lib/liblldb.so)

$ pkg_locate liblldb.so
llvm-6.0.1p18:devel/llvm,-main:/usr/local/lib/liblldb.so.0.0

$ ls /usr/local/lib/liblldb.so*
/usr/local/lib/liblldb.so.0.0


Below an untested diff to correct the symlink in post-install. I will
test it soon.

Thanks.
--
Sebastien Marie


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.199
diff -u -p -r1.199 Makefile
--- Makefile 21 Nov 2018 08:03:05 -0000 1.199
+++ Makefile 5 Dec 2018 15:59:19 -0000
@@ -19,7 +19,7 @@ PKGSPEC-main = llvm-=${LLVM_V}
 PKGNAME-main = llvm-${LLVM_V}
 PKGNAME-python = py-llvm-${LLVM_V}
 REVISION-main = 18
-REVISION-python = 2
+REVISION-python = 3
 CATEGORIES = devel
 DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX} \
  cfe-${LLVM_V}.src${EXTRACT_SUFX} \
@@ -124,6 +124,8 @@ post-install:
     ${PREFIX}/man/man1
  ${INSTALL_DATA} ${WRKSRC}/tools/clang/docs/_build/man/clang.1 \
     ${PREFIX}/man/man1
+ ln -fs ${PREFIX}/lib/liblldb.so \
+    ${PREFIX}/lib/python${MODPY_VERSION}/site-packages/lldb/_lldb.so
  # lit and FileCheck are not installed
  @rm ${PREFIX}/man/man1/lit.1
  @rm ${PREFIX}/man/man1/FileCheck.1

Reply | Threaded
Open this post in threaded view
|

Re: devel/llvm,-python: symlink problem

Sebastien Marie-3
On Wed, Dec 05, 2018 at 05:03:14PM +0100, Sebastien Marie wrote:

> Hi,
>
> While testing lang/rust testsuite with lldb, I noted several failure due
> to not properly packaged devel/llvm,-python.
>
> devel/llvm,-python provides a lldb python module. The module used a
> _lldb.so module, which is in fact a symlink to liblldb.so (installed in
> /usr/local/lib).
>
> the library is provided by devel/llvm, but its name isn't liblldb.so
> but liblldb.so.0.0. The symlink is wrong, so the python module fails to
> load.
>
> $ python2.7 -c 'import lldb'
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "/usr/local/lib/python2.7/site-packages/lldb/__init__.py", line 39, in <module>
>     import _lldb
> ImportError: No module named _lldb
>        
>
> $ pkg_locate _lldb.so
> py-llvm-6.0.1p2:devel/llvm,-python:/usr/local/lib/python2.7/site-packages/lldb/_lldb.so
>
> $ ls -l /usr/local/lib/python2.7/site-packages/lldb/_lldb.so
> lrwxr-xr-x  1 root  wheel  26 Dec  5 13:06 /usr/local/lib/python2.7/site-packages/lldb/_lldb.so@ -> ../../../../lib/liblldb.so
>
> (it is /usr/local/lib/liblldb.so)
>
> $ pkg_locate liblldb.so
> llvm-6.0.1p18:devel/llvm,-main:/usr/local/lib/liblldb.so.0.0
>
> $ ls /usr/local/lib/liblldb.so*
> /usr/local/lib/liblldb.so.0.0
>
>
> Below an untested diff to correct the symlink in post-install. I will
> test it soon.

After testing, it seems my diff was wrong. so a new diff (tested this
time).

Comments or OK ?
--
Sebastien Marie

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.199
diff -u -p -r1.199 Makefile
--- Makefile 21 Nov 2018 08:03:05 -0000 1.199
+++ Makefile 7 Dec 2018 05:21:41 -0000
@@ -19,7 +19,7 @@ PKGSPEC-main = llvm-=${LLVM_V}
 PKGNAME-main = llvm-${LLVM_V}
 PKGNAME-python = py-llvm-${LLVM_V}
 REVISION-main = 18
-REVISION-python = 2
+REVISION-python = 3
 CATEGORIES = devel
 DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX} \
  cfe-${LLVM_V}.src${EXTRACT_SUFX} \
@@ -124,6 +124,8 @@ post-install:
     ${PREFIX}/man/man1
  ${INSTALL_DATA} ${WRKSRC}/tools/clang/docs/_build/man/clang.1 \
     ${PREFIX}/man/man1
+ ln -fs ${LOCALBASE}/lib/liblldb.so.${LIBlldb_VERSION} \
+    ${PREFIX}/lib/python${MODPY_VERSION}/site-packages/lldb/_lldb.so
  # lit and FileCheck are not installed
  @rm ${PREFIX}/man/man1/lit.1
  @rm ${PREFIX}/man/man1/FileCheck.1

Reply | Threaded
Open this post in threaded view
|

Re: devel/llvm,-python: symlink problem

Sebastien Marie-3
On Fri, Dec 07, 2018 at 06:23:33AM +0100, Sebastien Marie wrote:

> On Wed, Dec 05, 2018 at 05:03:14PM +0100, Sebastien Marie wrote:
> > Hi,
> >
> > devel/llvm,-python provides a lldb python module. The module used a
> > _lldb.so module, which is in fact a symlink to liblldb.so (installed in
> > /usr/local/lib).
> >
> > Below an untested diff to correct the symlink in post-install. I will
> > test it soon.
>
> After testing, it seems my diff was wrong. so a new diff (tested this
> time).
>

And updated diff after latest changes in devel/llvm.

Comments or OK ?
--
Sebastien Marie

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.200
diff -u -p -r1.200 Makefile
--- Makefile 6 Dec 2018 21:51:01 -0000 1.200
+++ Makefile 7 Dec 2018 05:38:40 -0000
@@ -22,6 +22,7 @@ PKGNAME-python = py-llvm-${LLVM_V}
 PKGNAME-lldb = lldb-${LLVM_V}
 REVISION-main = 19
 REVISION-python = 3
+REVISION-lldb = 0
 CATEGORIES = devel
 DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX} \
  cfe-${LLVM_V}.src${EXTRACT_SUFX} \
@@ -138,6 +139,8 @@ post-install:
     ${PREFIX}/man/man1
  ${INSTALL_DATA} ${WRKSRC}/tools/clang/docs/_build/man/clang.1 \
     ${PREFIX}/man/man1
+ ln -fs ${LOCALBASE}/lib/liblldb.so.${LIBlldb_VERSION} \
+    ${PREFIX}/lib/python${MODPY_VERSION}/site-packages/lldb/_lldb.so
  # lit and FileCheck are not installed
  @rm ${PREFIX}/man/man1/lit.1
  @rm ${PREFIX}/man/man1/FileCheck.1

Reply | Threaded
Open this post in threaded view
|

Re: devel/llvm,-python: symlink problem

Jeremie Courreges-Anglas-2
On Fri, Dec 07 2018, Sebastien Marie <[hidden email]> wrote:

> On Fri, Dec 07, 2018 at 06:23:33AM +0100, Sebastien Marie wrote:
>> On Wed, Dec 05, 2018 at 05:03:14PM +0100, Sebastien Marie wrote:
>> > Hi,
>> >
>> > devel/llvm,-python provides a lldb python module. The module used a
>> > _lldb.so module, which is in fact a symlink to liblldb.so (installed in
>> > /usr/local/lib).
>> >
>> > Below an untested diff to correct the symlink in post-install. I will
>> > test it soon.
>>
>> After testing, it seems my diff was wrong. so a new diff (tested this
>> time).
>>
>
> And updated diff after latest changes in devel/llvm.
>
> Comments or OK ?

- LOCALBASE is "where other ports have been installed".  You should use
  TRUEPREFIX.
- the command will fail if lldb isn't built, so you need to make it
  conditional.

Revised diff below tested on amd64, my sparc64 is MIA at the moment but
the logic should be fine.  If you agree with that diff, ok jca@


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.200
diff -u -p -r1.200 Makefile
--- Makefile 6 Dec 2018 21:51:01 -0000 1.200
+++ Makefile 6 Dec 2018 22:16:24 -0000
@@ -22,6 +22,7 @@ PKGNAME-python = py-llvm-${LLVM_V}
 PKGNAME-lldb = lldb-${LLVM_V}
 REVISION-main = 19
 REVISION-python = 3
+REVISION-lldb = 0
 CATEGORIES = devel
 DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX} \
  cfe-${LLVM_V}.src${EXTRACT_SUFX} \
@@ -141,6 +142,10 @@ post-install:
  # lit and FileCheck are not installed
  @rm ${PREFIX}/man/man1/lit.1
  @rm ${PREFIX}/man/man1/FileCheck.1
+.if ${BUILD_PACKAGES:M-lldb}
+ ln -fs ${TRUEPREFIX}/lib/liblldb.so.${LIBlldb_VERSION} \
+    ${PREFIX}/lib/python${MODPY_VERSION}/site-packages/lldb/_lldb.so
+.endif
 
 .include <bsd.port.mk>
 


--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply | Threaded
Open this post in threaded view
|

Re: devel/llvm,-python: symlink problem

Sebastien Marie-3
On Fri, Dec 07, 2018 at 09:35:40AM +0100, Jeremie Courreges-Anglas wrote:
>
> Revised diff below tested on amd64, my sparc64 is MIA at the moment but
> the logic should be fine.  If you agree with that diff, ok jca@

I commited your version :)

Thanks.
 

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/llvm/Makefile,v
> retrieving revision 1.200
> diff -u -p -r1.200 Makefile
> --- Makefile 6 Dec 2018 21:51:01 -0000 1.200
> +++ Makefile 6 Dec 2018 22:16:24 -0000
> @@ -22,6 +22,7 @@ PKGNAME-python = py-llvm-${LLVM_V}
>  PKGNAME-lldb = lldb-${LLVM_V}
>  REVISION-main = 19
>  REVISION-python = 3
> +REVISION-lldb = 0
>  CATEGORIES = devel
>  DISTFILES = llvm-${LLVM_V}.src${EXTRACT_SUFX} \
>   cfe-${LLVM_V}.src${EXTRACT_SUFX} \
> @@ -141,6 +142,10 @@ post-install:
>   # lit and FileCheck are not installed
>   @rm ${PREFIX}/man/man1/lit.1
>   @rm ${PREFIX}/man/man1/FileCheck.1
> +.if ${BUILD_PACKAGES:M-lldb}
> + ln -fs ${TRUEPREFIX}/lib/liblldb.so.${LIBlldb_VERSION} \
> +    ${PREFIX}/lib/python${MODPY_VERSION}/site-packages/lldb/_lldb.so
> +.endif
>  
>  .include <bsd.port.mk>
>  
>
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

--
Sebastien Marie