Comments (8)
I think your issue is that you have specified that libcrypto.a
is a source file to build your static library crypto
. Is that what you really meant? It seems like it should be libcrypto.c
or some such.
from meson.
I think your issue is that you have specified that
libcrypto.a
is a source file to build your static librarycrypto
. Is that what you really meant? It seems like it should belibcrypto.c
or some such.
I have already built the static library i just want to include it to meson.build
from meson.
static_library(...)
is how you build a static library. See https://mesonbuild.com/Reference-manual_functions.html#static_library
You might want to have a look at https://mesonbuild.com/Dependencies.html
from meson.
This is not the idiomatic way to find a dependency. There is a libcrypto finder in Meson, you may be able to make this work by simply doing (untested):
project('myproject', 'c')
dep_crypto = dependency('libcrypto', static : true)
meson setup builddir -Dc_args="-I/path/to/crypto/includes" -Dc_link_args="-L/path/to/crypto/libs"
It doesn't look like liboqs provides any discovery methods at all? I don't see a pkg-config or a cmake-config, so that's going to be rather difficult to use from Meson.
The way to handle libraries like that if you can't use a pkg-config is something like:
cc = meson.get_compiler('c')
root_dir = get_option('openssl-root') # or hardcode it if you don't care if it works on another machine
dep = declare_dependency(
link_with : cc.find_library('crypto', dirs : root_dir, static : true),
compile_args : f'-I@root_dir@/include',
)
from meson.
cc = meson.get_compiler('c') root_dir = get_option('openssl-root') # or hardcode it if you don't care if it works on another machine dep = declare_dependency( link_with : cc.find_library('crypto', dirs : root_dir, static : true), compile_args : f'-I@root_dir@/include', )
Trying the above methods i encountered few error such as -
meson.build:27:21: ERROR: Expecting rbracket got string.
compile_args : [f'-I{root_dir}/include/crypto'],
Library crypto found: YES
meson.build:25:0: ERROR: Entries in "link_with" may only be self-built targets,
external dependencies (including libraries) must go to "dependencies".
So i changed a little i have poste dit below
This is the structure i have saved the libraries
usr/local/openssl-root/
├── include/
│ ├── openssl/
│ │ ├── ssl.h
│ │ └── ...
└── lib/
├── libcrypto.a
├── libssl.a
└── ...
In my build file i have added these lines as you suggested
cc = meson.get_compiler('c')
openssl_root = get_option('openssl-root') # or hardcode it if you don't care if it works on another machine
liboqs_root = get_option('liboqs-root') # or hardcode it if you don't care if it works on another machine
crypto_dep = dependency('crypto', required : false)
ssl_dep = dependency('ssl', required : false)
oqs_dep = dependency('oqs', required : false)
if not crypto_dep.found()
dep = declare_dependency(
compile_args : ['-I' + join_paths(openssl_root, 'include', 'crypto')],
link_with : crypto_dep,
)
endif
if not ssl_dep.found()
dep = declare_dependency(
compile_args : ['-I' + join_paths(openssl_root, 'include', 'openssl')],
link_with : ssl_dep,
)
endif
if not oqs_dep.found()
dep = declare_dependency(
compile_args : ['-I' + join_paths(liboqs_root, 'include', 'oqs')],
link_with : oqs_dep,
)
endif
This is the error im getting when i do meson build :
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Found CMake: /usr/bin/cmake (3.16.3)
Run-time dependency crypto found: NO (tried pkgconfig and cmake)
Run-time dependency ssl found: NO (tried pkgconfig and cmake)
Run-time dependency oqs found: NO (tried pkgconfig and cmake)
meson.build:35:4: ERROR: Entries in "link_with" may only be self-built targets,
external dependencies (including libraries) must go to "dependencies".
i have static libraries libssl.a, libcrypto.a and liboqs.a i also have the .h files of these libraries i have used the functions of ssl in my code so i want to add these libraries to the build and link
from meson.
meson.build:25:0: ERROR: Entries in "link_with" may only be self-built targets,
Oops, yes, that should be dependencies
not link_with
. I don't know what I was thinking when I wrote that.
I think this is what you want:
# [snip]
if not crypto_dep.found()
dep = declare_dependency(
compile_args : ['-I' + join_paths(openssl_root, 'include', 'crypto')],
dependencies : cc.find_library('crypto', dirs : join_paths(openssl_root, 'lib')),
)
endif
if not ssl_dep.found()
dep = declare_dependency(
compile_args : ['-I' + join_paths(openssl_root, 'include', 'openssl')],
dependencies : cc.find_library('ssl', dirs : join_paths(openssl_root, 'lib')),
)
endif
if not oqs_dep.found()
dep = declare_dependency(
compile_args : ['-I' + join_paths(liboqs_root, 'include', 'oqs')],
dependencies : cc.find_library('oqs', dirs : join_paths(liboqs_root, 'lib')),
)
endif
from meson.
Hey, Thankyou for your help my meson setup _build is successful, but im still facing issue in ninja build , it says undefined reference to all the openssl functions i have used, i have added the libraries properly but still it says undefined reference and throws an error
After doing meson setup _build this is how it build
Run-time dependency crypto found: NO (tried pkgconfig and cmake)
Run-time dependency ssl found: NO (tried pkgconfig and cmake)
Run-time dependency oqs found: NO (tried pkgconfig and cmake)
Library crypto found: YES
Library ssl found: YES
Library oqs found: YES
But this is the error im getting when i do ninja -c build
[203/265] Linking target p11-kit/libp11-kit.so.0.3.1.
FAILED: p11-kit/libp11-kit.so.0.3.1
/usr/bin/ld: p11-kit/077403d@@p11-kit@sha/rpc-server.c.o: in function p11_kit_remote_serve_module': /home/eaas/Sivapriya/p11-kit/_build/../p11-kit/rpc-server.c:2514: undefined reference to
OPENSSL_init_ssl'
/usr/bin/ld: /home/eaas/Sivapriya/p11-kit/_build/../p11-kit/rpc-server.c:2523: undefined reference to SSL_CTX_set_verify' /usr/bin/ld: /home/eaas/Sivapriya/p11-kit/_build/../p11-kit/rpc-server.c:2524: undefined reference to
SSL_CTX_load_verify_locations'
/usr/bin/ld: /home/eaas/Sivapriya/p11-kit/_build/../p11-kit/rpc-server.c:2528: undefined reference to `SSL_new'
Im trying to add ssl functions to p11-kit, will you be able to help with this please
from meson.
What does the library
or shared_library
call for libp11-kit
look like? I suspect you need to add dep_ssl
to that target's dependency
line
from meson.
Related Issues (20)
- Cython support issue with generated pyx when touching cimported pxd: ninja needs to be run twice to fully build the project? HOT 3
- [cmake] Generator expression test during configure doesn't work.
- Setting `fortran_args = ['']` will cause `meson compile` to fail HOT 3
- meson and NVIDIA HPC SDK HOT 4
- Passing sys_root to the --sysroot compiler argument
- Linker detection fails for wr-cc (VxWorks) without a file input
- install_symlink pointing_to does not observe prefix
- Add checks for files in POTFILES.in / POTFILES.skip
- binaries in toolchain file are wrongly handled
- Rust bindgen with output_inline_wrapper create c file with incorrect include path if build directory is not inside source directory HOT 1
- Meson Failing with FLTK HOT 1
- `meson rewrite kwargs delete project / <option>` raises unhandled exception unless a dummy second value is passed
- CI failure in rust / Windows
- Build failure in gst-plugins-rs Subproject with meson 0.61.2-1 on Intel N100 CPU HOT 1
- 'cuda' compile find_library() always returns found
- Unable to find CUPTI module in CUDA runfile installation
- `meson format` crashes in `add_nl_after` HOT 1
- Generated pkg-config file for Qt6 includes has incorrect file separator
- Support getting library file path from compiler for preloading purposes
- Why the library compiled on Apple's M2 machine,but have x86_64 architecture
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meson.