How to know the library name when I already know function name
Dear all,
When I call a function in linux kernel, I want to know what library name contains that function. Please give me the solution. For example, I want to know the name of library which contains local_bh_enable() Thank you Tuan Le |
Function: Google
Input: local_bh_enable() Output: asm/smp.h :) In all seriousness, I don't know how you would try and use a function (assuming C) in C without knowing the library you are calling it from. If you don't include the library than you can't call the function. Do you think you could explain a little more clearly what you are trying to do? Thanks |
Hello Centinul,
It is easy to know which .h file need to include into my source code which calling the local_bh_enable() function. But when I compile, the error occurs (cannot link the library). I need to know the name of library which contains local_bh_enable() to pass to the command line gcc myproject -lXX My question is XX = ? (XX is the name of library which contains local_bh_enable()) Thank you Tuan Le |
Do a google search: http://www.google.com/search?client=...utf-8&oe=utf-8
|
Hya,
I had same question a while ago. I did not know the answer. So that, I used "nm" to see. But it did not work on Penguin. It worked with Macintosh. Also it was not efficient at all.... Happy Penguins! |
The library contains in Linux is in Binary Code, so we cannot search it like the header file, I guess the only way we can do is search through the internet.
Any better ideas? |
Hi.
Quote:
What do you mean by not efficient at all? ... cheers, makyo |
Hya,
My Penguin is etch Debian. 2.6.20.11 Code:
>nm /lib/libm-2.3.6.so |
Hi.
Quote:
Code:
#!/bin/sh Code:
% ./s1 |
Quote:
Code:
nm -D *.so > /tmp/dsym.txt |
Does "man local_bh_enable" give you anything?
Also, you're asking specifically about the Linux kernel's headers, and not C/C++ libraries in general, right? I'm pretty sure the answer, then, actually is RTFM. There are a lot of guides to programming against those. |
No, I'm wondering about the libraries in general, not kernel-specific. Here's an example. On a Raspberry Pi I'm trying to isolate the OpenGL ES demo program called hello_triangle and set it up to build with a normal makefile, not be one of 20 or so programs that's set up for cmake. I want to try tinkering with it, making small changes, learning from it. When I run my makefile I get a slew of undefined reference errors like:
Code:
/opt/vc/lib/libEGL.so: undefined reference to `gl11_client_state_init' I fired up my program (on my OpenBSD laptop) and output looks like: Code:
search directories: /usr/lib:/usr/X11R6/lib:/usr/local/lib No, man local_bh_enable doesn't do anything. And this isn't for headers, -I/opt/vc/include seems to cover those well enough. The Broadcom libraries are in -L/opt/vc/lib but I need names. |
Quote:
https://github.com/danginsburg/openg...Hello_Triangle Just get that information from the CMake files. The surest way is to actually do a CMake build and just look at which gcc flags are being applied. The actual library names CMake looks for are in the sources for the CMake modules in /usr/share/cmake/Modules. |
Quote:
Code:
ldd /opt/vc/lib/libEGL.so |
Quote:
These would be "-lbrcmEGL" and "-lbrcmGLESv2" If that's all you wanted to know, mark the thread as "solved". |
All times are GMT -5. The time now is 11:29 PM. |