Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot embed linux libraries ending with .so.1.0.0 #424

Closed
rrva opened this issue Jul 2, 2013 · 3 comments
Closed

Cannot embed linux libraries ending with .so.1.0.0 #424

rrva opened this issue Jul 2, 2013 · 3 comments
Labels

Comments

@rrva
Copy link

rrva commented Jul 2, 2013

It seems you cannot embed libraries which have a name containing .so.1.0.0

For example I have a transitive dependency on libcrypto.so.1.0.0, which I cannot embed for now.

Platform.getEmbeddedLibraryResource() assumes all libraries end with ".so"

 if (path != null) {
        ret.add(path + "lib" + name + ".so");
        ret.add(path + name + ".so");
 }

An untested suggestion is:

 if (path != null) {
   if(name.contains(".so.")) {
       ret.add(path + name);
   } else {
        ret.add(path + "lib" + name + ".so");
        ret.add(path + name + ".so");
   }
 }

I'll see if there are more bits which need fixing than this for a library name like "libcrypto.so.1.0.0"

ochafik added a commit that referenced this issue Jul 2, 2013
…ile names lookup (+ name treated as possible exact file name when it contains a dot ".", see issue #424)
@ochafik
Copy link
Member

ochafik commented Jul 2, 2013

Hi @rrva ,

Thanks for your report!
Can you give more details about your use-case? (do you distribute your JAR with only one version of your library ?)
I've committed a change (deployed in latest 0.7-SNAPSHOT) that allows for exact library file name in the @Library annotation or with BridJ.addNativeLibraryAlias or BridJ.setNativeLibraryActualName.

Please let me know if it works in your case.

Cheers

@ochafik ochafik closed this as completed Jul 2, 2013
@rrva
Copy link
Author

rrva commented Jul 2, 2013

My use case is

I access a library on linux lets call it libUser.so

It in turns depends on libSys.so. I cannot change/rebuild libSys.so, its from a third-party vendor.

libSys.so depends on libcrypto.so.1.0.0

So, I need to embed libcrypto.so.1.0.0 for those systems missing it. For example Redhat 6.2 has it, but Redhat 5.3 not.

Thanks for very prompt fixes and answers! I will try to test.

@ochafik
Copy link
Member

ochafik commented Jul 2, 2013

Hi @rrva ,

Thanks for these details.
I would suggest trying the latest snapshot with code along the following lines:

@Library("User", dependencies = { "Sys" })
class UserLibrary {
  static {
    BridJ.addNativeLibraryDependencies("Sys", "crypto");
    BridJ.setNativeLibraryActualName("crypto", "libcrypto.so.1.0.0");
    BridJ.register();
  }
  ...
}

EDIT: now using BridJ.addNativeLibraryDependencies from very latest snapshot in code sample

There's non-negligible chances of this not working, in that case please let me know.
Alternatively, you might succeed in changing the path hard-coded in libSys.so with HT or gelf (see SO ).

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants