shared-libraries

Force GCC to static-link e.g. pthreads (and not dynamic link)

青春壹個敷衍的年華 提交于 2019-12-04 22:32:37
问题 My program is built as a loader and many modules which are shared libraries. Now one of those libraries uses pthreads and it seems its bound to the module dynamically (loaded on startup). Now it'd be simplier if i could force pthreads to be linked into the module file. GCC on linux, how do i do? I guess a libpthread.a is necessary.... 回答1: While linking libpthread.a into a shared library is theoretically possible, it is a really bad idea . The reason is that libpthread is part of glibc , and

undefined reference error for linking CUDA static or shared library with gcc

こ雲淡風輕ζ 提交于 2019-12-04 22:28:22
问题 gcc and CUDA question Hi, I have compiled a CUDA shared library but can't link it with the main program that uses it. I am compiling the main program with gcc. The code: simplemain.c #include <stdio.h> #include <stdlib.h> void fcudadriver(); int main() { printf("Main \n"); fcudadriver(); return 0; } test.cu __global__ void fcuda() { } void fcudadriver() { fcuda<<<1,1>>>(); } I compile test.cu as --> It works nvcc --compiler-options '-fPIC' -o libtest.so --shared test.cu I compile simplemain.c

Java: load shared libraries with dependencies

依然范特西╮ 提交于 2019-12-04 22:12:21
问题 I am wrapping a shared library (written in C) with Java using JNA. The shared library is written internally, but that library uses functions from another external library, which again depends another external library. So the situation is something like this: ext1 <- ext2 <- internal I.e. the internal uses external library ext2 which again uses external library ext1. What I have tried is: System.loadLibrary("ext1"); System.loadLibrary("ext2"); NativeLIbrary.loadLibrary("internal",xxx.class);

Finding Offsets of Local Symbols in Shared Libraries Programmatically on OS X

扶醉桌前 提交于 2019-12-04 21:25:59
问题 I need to find the offset of a local symbol in a shared library on OS X. Local symbol as in non-exported symbol. Therefore dyld("symbol_name") will not work. I can however use nm to find these offsets, for example $ nm /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/DesktopServicesPriv | grep -e ChildSetLabel -e NodeVolumeEject 000000000006cccd T _NodeVolumeEject 000000000009dbd7 t __ChildSetLabel There we see the exported ( T ) symbol NodeVolumeEject which's offset 0x6cccd I

Python's easy_install and custom header/library location

╄→尐↘猪︶ㄣ 提交于 2019-12-04 20:13:11
I am trying to install adns-python using linux and had to recompile adns with some special options, so I can't seem to use easy_install <tarball> as I normally would (py26_default)[mpenning@localhost src]$ easy_install adns-python-1.2.1.tar.gz Processing adns-python-1.2.1.tar.gz Running adns-python-1.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-9cVl4i/adns-python-1.2.1/egg-dist-tmp-vvO8Ms adnsmodule.c:10:18: error: adns.h: No such file or directory adnsmodule.c:31: error: expected specifier-qualifier-list before âadns_stateâ adns.h is installed under /opt/adns/include/adns.h ; how

Compile a shared library statically

拟墨画扇 提交于 2019-12-04 19:45:23
问题 I've got a shared library with some homemade functions, which I compile into my other programs, but I have to link the end program with all the libraries I have used to compile the static library. Here is an example: I have function foo in the library which requires a function from another library libbar.so . In my main program to use function foo I have to compile it with the -lbar flag. Is there a way I can compile my library statically so it includes all the required code from the other

*.so library from included *.jar involves UnsatisfiedLinkError

こ雲淡風輕ζ 提交于 2019-12-04 19:26:32
I've wrote android app with native shared library ( libnativeext.so ). Inside java class in app I load libnativeext.so with System.loadLibrary("nativeext"). All works great. Native code compiles, and libnativeext.so places in /libs/armeabi/ folder. So final first.apk file contains /lib/armeabi/libnativeext.so , installs on device and all work ok. Then I export project in javaext.jar . At this point javaext.jar contains libnativeext.so in /libs/armeabi/ . In the new project (second-proj) I include javaext.jar and add path to javaext.jar in java build path. Project builds with only warning about

How to build Flutter project with Android aar file?

十年热恋 提交于 2019-12-04 19:20:00
问题 I want to use Flutter to create an Android app which depends on a third-party SDK that wrapped in an aar file. So far, I have only found the article Accessing Platform and Third-Party Services in Flutter. It seems that I have to build the Flutter project with additional Java files using Android Studio . This is complicated and not what I want. Is there any way to directly load aar files or *.so files in Dart code? Something like how JNI works. 回答1: After learning the Flutter example - hello

UnsatisfiedLinkError While Calling Native Method from OSGi Bundle

ぐ巨炮叔叔 提交于 2019-12-04 19:10:04
I have created one OSGi plugin (Bundle) using eclipse File-->New-->Other-->Plug-in Project called plugin 1. I want to use a native .so library in this plugin. I have added libtest_app_wrap1.so at the root of my plugin project. my project structure looks like below And here is the manifest file Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: JniTest Bundle-SymbolicName: JniTest Bundle-Version: 1.0.0.qualifier Bundle-Activator: jnitest.Activator Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: org.osgi.framework;version="1.3.0" Bundle-NativeCode: libtest_app_wrap1.so;

How do I trace through an XS .so file?

北战南征 提交于 2019-12-04 18:14:17
问题 I have a small Perl program. The program loads a module. The module loads an .so file with XSLoader. This Perl runs on Linux and is built with gcc and -DDEBUGGING , and subsequently so is the .so file. I can recompile. When the Perl program is executed, how do I trace through the C functions in the .so file? I need to know the names of the functions in the order they run. It would be nice to have the function arguments, too. 回答1: Here is an example of using gdb to step into a shared library.