Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 153166 - Dynamic/static library not loaded : image not found
Dynamic/static library not loaded : image not found
Status: VERIFIED FIXED
Product: cnd
Classification: Unclassified
Component: Project
6.x
Macintosh Mac OS X
: P2 (vote)
: 6.x
Assigned To: Thomas Preisler
issues@cnd
65fixes1-verified
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-13 17:42 UTC by laurent01
Modified: 2009-02-19 20:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description laurent01 2008-11-13 17:42:36 UTC
Dear sir :

I failed to build properly my applications suing NetBeans (6.5 beta and 61) under Mac OS-X Leopard (v. 10.5 updated 
5.5). In fact, my main concern was to build a dynamic library of a radiative transfer numerical model written in 
Fortran. Even though the library was sucessful build with NetBeans, and linked with a main.f programme compiled also 
with NetBeans, it failed when runned. The message was that the dynamic library was not loaded. Reason : image not found.

Because the programme was too complex, I decided to develop a very easy Hello programme calling for an external dynamic 
library. The routines coded were the following ones :

i) hello.h

void hello (void) ;

ii) hello.c

#include <stdio.h>

void hello (void)
{
printf ("Hello ! Si ça s'affiche, c'est que ça marche.\n");
}

iii) main.c
#include <stdio.h>
#include "hello.h"
main ()
{
        hello () ;
}

I build the library with hello.c (giving libhello.dylib). Correct : debug and release versions were successful. Then, I 
build main.c without omitting the -L option and -l option using NetBeans by Browsing, nor "Add option" for dynamic 
bindings. Debug and release versions were sucessful.

However, when Run, always the same error when looking the X11 window opened :

dyld : dynamic library not found.
[...] Reason : image not found

A great pity, because I cannot develop my programmes with NetBeans at this stage, having decided to build many 
scientific dynamic libraries with NetBeans for codes written in C, Fortran, or sometimes in C++.

Hoping you a good receipt.
I look forward to hearing from you soon.

Yours sincerely,


Laurent Delphin
Comment 1 Leonid Lenyashin 2008-11-13 17:53:22 UTC
Thank you for reporting this, Laurent,

And sorry for the issue you came across.

Thomas, Please evaluate. If it is Fortran specific, please lower to P2. Even if it is lowered, but confirmed, then it is
a good candidate for patch_1.

Leonid.
Comment 2 Alexander Pepin 2008-11-13 19:51:56 UTC
It's generally not a bug at least not a P1, probably it's just inconvenience. You need to say somehow where your library
is or put it in a default place e.g you can set 'Run Directory' in your application project properties 'Run' section to
folder where your library is (in my case it is /Users/idetester/NetBeansProject/DynamicLibrary_1/dist/Debug/GNU-MacOSX)
or just copy your library into your application directory. Another option is to set 'Output' in Linker section for your
library project to your application project directory and rebuild the library project.    
Comment 3 Thomas Preisler 2008-11-14 17:39:57 UTC
I can reproduce your problem using the a modified version of the Subproject Application sample project. If I set the link step to link with 
-L../hello3lib/dist/Debug/GNU-MacOSX -lhello3lib and remove the project dependency, the project builds fine but doesn;t run. The problem is DYLD_LIBRARY_PATH is not set correctly. I think the project system should add the -L options to DYLD_LIBRARY_PATH.

There are two (not very good) workarounds:
1) set DYLD_LIBRARY_PATH before you start NetBeans
2) create a makefile wrapper project around the external library add that project to your project.
Comment 4 Thomas Preisler 2008-11-14 18:41:39 UTC
Fixed. I will ask to get the fix included in NB Patch 1.
Comment 5 Thomas Preisler 2008-11-14 20:13:50 UTC
Fixed similar issue on Windows.

Two changesets:

changeset 5f0046a84a8c in main
details: http://hg.netbeans.org/main?cmd=changeset;node=5f0046a84a8c
description:
	#153166 Dynamic/static library not loaded : image not found

changeset 850ad670a035 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=850ad670a035
description:
	#153166 Dynamic/static library not loaded : image not found


Comment 6 Quality Engineering 2008-11-16 04:13:29 UTC
Integrated into 'main-golden', will be available in build *200811160201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/5f0046a84a8c
User: Thomas Preisler <thp@netbeans.org>
Log: #153166 Dynamic/static library not loaded : image not found
Comment 7 Alexander Pepin 2008-11-17 19:59:51 UTC
The fix works on Mac and Windows but fails on Linux.
I think LD_LIBRARY_PATH should be used on Linux/Solaris
Comment 8 Thomas Preisler 2008-11-17 23:55:20 UTC
Applied same fix toLinux/Solarisalthough there is another solution: you can use Runtime Search Directory.

changeset 2905572c9856 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=2905572c9856
description:
	#153166 Dynamic/static library not loaded : image not found

Comment 9 Quality Engineering 2008-11-18 04:59:58 UTC
Integrated into 'main-golden', will be available in build *200811180201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2905572c9856
User: Thomas Preisler <thp@netbeans.org>
Log: #153166 Dynamic/static library not loaded : image not found
Comment 10 Alexander Pepin 2008-11-18 17:05:13 UTC
The fix works on Windows, Linux and Solaris.
Sorry, can not verify fix on Mac due to issue #153396 (Can't open display)
Comment 11 Thomas Preisler 2008-11-18 17:49:56 UTC
you can switch to internal output window. It should work too.
Comment 12 Thomas Preisler 2008-11-18 17:50:03 UTC
you can switch to internal output window. It should work.
Comment 13 Alexander Pepin 2008-11-18 19:43:38 UTC
verified in build 200811180201 on Mac using Output Window
Comment 14 jinb 2008-11-26 16:34:09 UTC
fix backported into release65_fixes branch
http://hg.netbeans.org/release65_fixes/rev/575ca5cdee92
Comment 15 Alexander Pepin 2008-12-01 18:52:56 UTC
verified in 6.5 with patch1


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo