This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"cannot open shared object file: No such file or directory" - maybe linker option can help?



Hi All,

First, thank you for the help about ten days ago; I found there WAS an undefined 'len' - looks like a line somehow got truncated.

In this case, I'm getting this error ONLY when I run the target program from Java:

"error while loading shared libraries: ?: cannot open shared object file: No such file or directory"

So far as I have seen, this one program I have is the ONLY one that is having trouble being launched from Java. Other Cygwin programs (albeit ones that came with the Cygwin distribution, like cygpath.exe) work perfectly when called in identical manner. I researched it (via web search, archives, etc) and nobody seems to have had quite this particular problem. I know the program had been called from Java in the past quite successfully, and I have NO IDEA what changed.

I suspected that MAYBE it was due to the java.policy settings, so I spent a LOT of time trying everything I could think of - entries like this:

permission java.io.FilePermission "C:/cygwin/-", "read, execute";

None of that seemed to have any effect on this problem, so I looked into the Java call itself. This code literally started about 17 years ago with Java 1.0 or 1.1, and the call to launch an external program hadn't been updated in a while, so even though there were no other problems launching any program desired, I updated it to use the (relatively young, by comparison) ProcessBuilder strategy. FYI, Java calls whatever shell the user has configured, in this case Cygwin's /bin/bash with the -c flag, which then calls the program of interest - in this case the same binary that had the missing 'len' definition you folks helped me with last week.

Again, if you run it "by hand" or in a script, from the bash prompt, it runs perfectly.

So I figured there's something wrong with PATH or LD_LIBRARY_PATH or some such with the Java environment, but that hasn't been fruitful either.

I then got this idea I can maybe include the shared object file - which I take to be cygwin1.dll - directly in the process image! So, I've tried linking it in with a linker command identical to how it is normally built but with the -l option too, like this:

$ gcc  -lcygwin1.dll -o ctj.exe ctj.o hashc.o sha1.o;
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lcygwin1.dll
collect2: ld returned 1 exit status

Noting that it says it can't find it either, I think this is curious, and I've tried every varriation of this I can think of - kindly omitted here in the interests of space. ...This must either not be possible OR I'm doign it wrong! (An obvious conclusion!)

-harumph- ...I'm stumped! But Persistent!

I read somewhere that maybe strace can be used to help figure these kinds of things out, but I'm a novice at it. When I run it by hand I get a LOT of information, but I don't know what I'm looking for, or what to do with it when I find it!

Any advice / assistance greatly appreciated!

Regards,
Richard


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]