shared-libraries

link static library (without -fPIC) to shared library on 64bit OS

安稳与你 提交于 2019-12-10 18:13:20
问题 I write programm in c++, from which will be made shared library - and done it will be used by JNI. I have 3rd party library ( libexample.a ) and need to link it to shared library ( libshared.so ). The problem is, that I work on 64bit CentOS and -fPIC is needed to create shared lib, but 3rd party library wasnt compiled with -fPIC. Until building I recive: /usr/bin/ld: /home/tom/Project/src/libexample.a(SomeObject.o): relocation R_X86_64_32 against 'someData' can not be used when making a

Using Jenkins Shared Libraries as classes

徘徊边缘 提交于 2019-12-10 18:06:12
问题 I have a Jenkins file, and i'm trying to instantiate a groovy class from my shared library. I get "unable to resolve class Test " I have a src/com/org/foo.groovy file in a shared library : package com.org class Test implements Serializable{ String val Test(val) { this.val = val } } and I'm trying to instantiate it in my jenkinsfile @Library('Shared-Library@master') import com.org //also tried to use with .foo with no success def t = new Test("a") //doesnt work def t = new foo.Test("a")/

C++ catch enum value as exception

邮差的信 提交于 2019-12-10 17:56:42
问题 I am trying to use an external C++ library which have defined its exceptions as: enum MY_ERRORS { ERR_NONE = 0, ERR_T1, ERR_T2, }; Then in the code exceptions are thrown like this: if(...) { throw ERR_T1; Being new to programming in C++, I would do something like: try { call_to_external_library(); } catch(??? err) { printf("An error occurred: %s\n", err); } catch(...) { printf("An unexpected exception occurred.\n"); } How do I determine what was thrown? 回答1: You will need to write your code

How does gcc/ld find zlib.so?

扶醉桌前 提交于 2019-12-10 16:52:18
问题 I've used zlib for ages and never thought about the fact that it is named slightly unconventionally. While most libraries on Linux follow the naming convention of lib<name>.so for shared objects and lib<name>.a for archives, zlib is named zlib.so / zlib.a . My question is: how does gcc/ld know to look for zlib.so when I use -lz as a link flag? I understand that for linking, gcc invokes ld, which searches for libraries in certain default paths and any path specified with -L , and it appends

How do I fix a “version `GLIBC_2.14' not found” error?

大城市里の小女人 提交于 2019-12-10 16:44:12
问题 I've compiled a C program under Ubuntu 12.04, built a Debian package out of it, and want to install it on a server running Debian Lenny. Last time I did that (about two months ago) it worked: I could install the package and run the binary. But now I get the following error message: (binary's name): /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by (binary's name)) Other than upgrading my machine to Ubuntu 12.4, the only significant change we've brought to the code

GDB shows incorrect jump address at PLT section

点点圈 提交于 2019-12-10 16:30:20
问题 I wrote the following example to get a grasp of PLT/GOT section. The shared library libshar code: shared.h int sum(int a, int b); shared.c #include "shared.h" int sum(int a, int b){ return a + b; } The executable bin_shared code: #include <stdio.h> #include "shared.h" int main(void){ printf("Starting the programm... \n"); int s = sum(1, 2); //<=== I expected the dynamic linker would be called here int s2 = sum(2, 3); printf("s = %d, s2 = %d\n", s, s2); } So I compiled and linked the shared

How to COPY library files between stages of a multi-stage Docker build while preserving symlinks?

给你一囗甜甜゛ 提交于 2019-12-10 16:03:10
问题 I have a Dockerfile which is split into a two-stage multi-stage docker build. The first stage generates a basic gcc build environment in which a number of C and C++ library are compiled. The second stage uses the COPY --from= command to copy the library files from the first stages /usr/local/lib/libproto* to the current image's. The problem I am seeing is that the first image contains symlinks from a generic library file name to a specific versioned file name. AFAIK this is common practice

Named common block in a shared library

无人久伴 提交于 2019-12-10 16:00:02
问题 I am encountering a problem when I include a Fortran subroutine in a shared library. This subroutine has a named common block. I have a Fortran main program that uses this common block and links with the shared library. The behavior is that variables in the common block set in either the subroutine or main program are not shared between the two. I am using gfortran 4.9.3 under MinGW on windows. Here are the pieces of my very simple example. Main program: program mainp common/whgc/ivar ivar =

Is it possible to mix static, multi-threaded, DLL libraries in one project?

一世执手 提交于 2019-12-10 15:53:21
问题 Is it possible to use distinct libraries A, B, C in the same project in Visual Studio, where A is a static library, B is multi-threaded and C is a multi-threaded DLL? Or do they all have to be the same type for a single .exe output? Edit: Sorry, A is a single-threaded static library. B is a multi-threaded static library, C is a multi-threaded DLL. (I guess A and B are the same from the linker's point of view?) 回答1: Are you talking about libraries compiler with different CRT linking type

Undefined modules when switching to a newer version of android ndk

℡╲_俬逩灬. 提交于 2019-12-10 14:53:13
问题 I'm attempting to upgrade from ndk-r11c to ndk-r14. When I run r14, I get an error Android NDK: Module myJNI depends on modules: png jpeg log In my Android make: LOCAL_SHARED_LIBRARIES := png jpeg log 回答1: Assuming you didn't copy the full error message and it actually said "depends on undefined modules", check the release notes: Module builds will now fail if they have any missing dependencies. To revert to the old behavior, set APP_ALLOW_MISSING_DEPS=true. See https://github.com/android-ndk