static-libraries

Android NDK: Link using a pre-compiled static library

China☆狼群 提交于 2019-11-27 01:00:49
I'm trying to port Jnetpcap to Android in order to use it for parsing .pcap files. Jnetpcap is a java wrapper for libpcap which uses JNI. I have compiled libpcap as a static library using the android's source code tree. When compiling Jnetpcap as a shared library I'm getting errors because I have to link with libpcap.a but I don't know how could I tell Android.mk that he must link with the libpcap.a file that I have. Using "LOCAL_STATIC_LIBRARIES:= libpcap" won't work because libpcap doesn't come by default in the android NDK. If any of you guys could help me I would be very thankful. Here is

How to compile a static library using the Android NDK?

流过昼夜 提交于 2019-11-27 00:22:21
I'm trying to compile a static library to use on Android but I can't figure out how to compile it. The library uses standard libraries (stdio.h etc...) and libxml2. I am trying to compile using arm-eabi-gcc but I get the following error: /cygdrive/c/android-ndk-r4/build/platforms/android-8/arch-x86/usr/include/asm/posix_types.h:15:28: error: posix_types_64.h: No such file or directory How do I get this to work? As I understand it, the correct method is to use ndk-build and not invoking the compiler directly. In Android.mk you need to specify a module for each static library you want to compile

CMake and Static Linking

吃可爱长大的小学妹 提交于 2019-11-27 00:17:23
问题 I'm using CMake in a project, and I'm trying to statically link some libraries. I've set: set(BUILD_SHARED_LIBS OFF) set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static") set_target_properties(icarus PROPERTIES LINK_SEARCH_END_STATIC 1) And I've made sure when looking for the actual libraries that I have the *.a version of them. Currently the project imports: libPocoNet.a libPocoUtil.a libPocoXML.a libPocoFoundation.a libmysqlclient.a libmysqlpp.a libcrypto++.a CUDA All

Static libraries in Xcode 4

偶尔善良 提交于 2019-11-26 23:52:33
问题 (My question has been asked here before but with no working answers that I can see. E.g. Xcode4 Workspace with Static library project & application project) I'm trying to use a library provided by a 3rd party. They provide the XCode project which builds a libLibraryName.a file. They recommend adding the project as a subproject to my own, then adding the product libLibraryName.a file to the set of libraries described in my project settings "Link Binary with Libraries". The library does build

Linking libstdc++ statically: any gotchas?

六月ゝ 毕业季﹏ 提交于 2019-11-26 23:21:18
I need to deploy a C++ application built on Ubuntu 12.10 with GCC 4.7's libstdc++ to systems running Ubuntu 10.04, which comes with a considerably older version of libstdc++. Currently, I'm compiling with -static-libstdc++ -static-libgcc , as suggested by this blog post: Linking libstdc++ statically . The author warns against using any dynamically-loaded C++ code when compiling libstdc++ statically, which is something I haven't yet checked. Still, everything seems to be going smoothly so far: I can make use of C++11 features on Ubuntu 10.04, which is what I was after. I note that this article

g++: In what order should static and dynamic libraries be linked?

蹲街弑〆低调 提交于 2019-11-26 22:41:54
问题 Let's say we got a main executable called "my_app" and it uses several other libraries: 3 libraries are linked statically, and other 3 are linked dynamically. In which order should they be linked against "my_app"? But in which order should these be linked? Let's say we got libSA (as in Static A) which depends on libSB, and libSC which depends on libSB: libSA -> libSB -> libSC and three dynamic libraries: libDA -> libDB -> libDC ( libDA is the basic, libDC is the highest) in which order should

How to build a library for both iPhone simulator and device?

烂漫一生 提交于 2019-11-26 22:31:14
问题 I want to build a static library for iphone. I want to give my users the .a library which they can use for both simulator test and device test. Do I have to build two library in simulator mode and device mode? Is there any way to build a single one that can be used for both platforms? 回答1: Compile your library twice. Once using the device SDK, and again using the Simulator SDK. Then use the lipo command line tool to create a "fat" library. lipo -create libdevice.a libsimulator.a -output

g++ linker: force static linking if static library exists?

丶灬走出姿态 提交于 2019-11-26 22:30:19
问题 I've a program which links to many libraries. g++ , by default, prefers to link to shared libraries, even if the corresponding archive exists. How can I change this preference to prefer static archives over dynamic libraries, if a static archive exists? Note, I used -static option, but it tries to find static archive for all libraries which is not what I want. 回答1: g++ -Wl,-Bstatic -lz -lfoo -Wl,-Bdynamic -lbar -Wl,--as-needed Will link zlib and libfoo as static, and libbar as dynamic . --as

How to load a custom binary resource in a VC++ static library as part of a dll?

谁说我不能喝 提交于 2019-11-26 22:21:42
问题 I have custom binary resources (animated cursors) that would like to store as resources in a static lib in Visual Studio C++. It turns out that custom binary resources will not get loaded by ::LoadCursor() or found by ::FindResource() if it is a custom resource and in a static library. This question gives some work around. Following its advice, if I add the *.res file to an exe as a "Configuration Property->Linker->Additional Dependency" then the static library will be able to find the

How do I tell CMake to link in a static library in the source directory?

ⅰ亾dé卋堺 提交于 2019-11-26 21:50:32
I have a small project with a Makefile which I'm trying to convert to CMake, mostly just to get experience with CMake. For purposes of this example, the project contains a source file (C++, though I don't think the language is particularly relevant) and a static library file which I've copied from elsewhere. Assume for argument's sake that the source code to the library is unavailable; I only have the .a file and the corresponding header. My handmade Makefile contains this build rule: main: main.o libbingitup.a g++ -o main main.o libbingitup.a which works fine. How do I tell CMake to reproduce