[libcamera-devel] meson: Correctly locate libc++
diff mbox series

Message ID 20230728161517.15399-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit eed6a079d2f989bdbc24ff1d3f8fc4360fc577b0
Headers show
Series
  • [libcamera-devel] meson: Correctly locate libc++
Related show

Commit Message

Laurent Pinchart July 28, 2023, 4:15 p.m. UTC
The meson find_library() function takes a library name without the "lib"
prefix. Its usage to find lic++ is thus not correct, and meson warns
about it:

WARNING: find_library('libc++') starting in "lib" only works by accident and is not portable

Fix it by dropping the "lib" prefix.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham July 28, 2023, 4:38 p.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2023-07-28 17:15:17)
> The meson find_library() function takes a library name without the "lib"
> prefix. Its usage to find lic++ is thus not correct, and meson warns
> about it:
> 
> WARNING: find_library('libc++') starting in "lib" only works by accident and is not portable
> 
> Fix it by dropping the "lib" prefix.

The 'Only works by accident' is curious!...

Hrm ... introduced last year - so I guess we haven't seen this much
before (or when we first added it).
 - https://github.com/mesonbuild/meson/pull/10864

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Anyway, seems reasonable based on the meson developers discussions and
statements so:

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 031e1eda08f0..7959b5386eee 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -109,7 +109,7 @@ if cc.get_id() == 'clang'
>  
>      # Use libc++ by default if available instead of libstdc++ when compiling
>      # with clang.
> -    if cc.find_library('libc++', required : false).found()
> +    if cc.find_library('c++', required : false).found()
>          cpp_arguments += [
>              '-stdlib=libc++',
>          ]
> -- 
> Regards,
> 
> Laurent Pinchart
>
Nicolas Dufresne July 28, 2023, 5:20 p.m. UTC | #2
Le vendredi 28 juillet 2023 à 17:38 +0100, Kieran Bingham via libcamera-devel a
écrit :
> Quoting Laurent Pinchart via libcamera-devel (2023-07-28 17:15:17)
> > The meson find_library() function takes a library name without the "lib"
> > prefix. Its usage to find lic++ is thus not correct, and meson warns
> > about it:
> > 
> > WARNING: find_library('libc++') starting in "lib" only works by accident and is not portable
> > 
> > Fix it by dropping the "lib" prefix.
> 
> The 'Only works by accident' is curious!...

On Windows there is no lib prefix, as this is a Linux library, this is unlikely
an accident that it worked.

> 
> Hrm ... introduced last year - so I guess we haven't seen this much
> before (or when we first added it).
>  - https://github.com/mesonbuild/meson/pull/10864
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Anyway, seems reasonable based on the meson developers discussions and
> statements so:
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> 
> > ---
> >  meson.build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 031e1eda08f0..7959b5386eee 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -109,7 +109,7 @@ if cc.get_id() == 'clang'
> >  
> >      # Use libc++ by default if available instead of libstdc++ when compiling
> >      # with clang.
> > -    if cc.find_library('libc++', required : false).found()
> > +    if cc.find_library('c++', required : false).found()
> >          cpp_arguments += [
> >              '-stdlib=libc++',
> >          ]
> > -- 
> > Regards,
> > 
> > Laurent Pinchart
> >

Patch
diff mbox series

diff --git a/meson.build b/meson.build
index 031e1eda08f0..7959b5386eee 100644
--- a/meson.build
+++ b/meson.build
@@ -109,7 +109,7 @@  if cc.get_id() == 'clang'
 
     # Use libc++ by default if available instead of libstdc++ when compiling
     # with clang.
-    if cc.find_library('libc++', required : false).found()
+    if cc.find_library('c++', required : false).found()
         cpp_arguments += [
             '-stdlib=libc++',
         ]