Web lists-archives.com

Re: [Mingw-users] libaddr2line.a: dependencies of libbfd.a?

On Oct 04, 2016 at 09:20 AM, Jannick wrote:
> > > From: Keith Marshall <keithmarshall@xxxxxxxxxxxxxxxxxxxxx>
> > > Date: Mon, 3 Oct 2016 23:15:42 +0100
> > >
> > > > Thanks - agree. However, this package comes along with the implied
> > > > dependency to libintl-8.dll which, in general, I wanted to avoid.
> > >
> > > You'll need to provide a SSCCE, to help me understand where that
> > > dependency arises; I'm not seeing it in my build trees, for either
> > > the distributed libbfd.a or libiberty.a, (when inspected using
> > > "objdump -x ... | grep -i dll" -- not that I'd really expect it to
> > > show up, within a static library, until the linker finds a symbol
> > > dependency which needs the DLL in question).
> Sure. Compile main.c below with
> 	mingw32-gcc main.c -o t.exe -lbfd -liberty -lintl -lz
> to see that t.exe is dependent on libintl-8.dll.

I should refine my objective which is why to exclude the intl dependency: My
intention is to produce a stand-alone executable, i.e. an executable with
references to pure Windows dlls only which are available on - hopefully -
every Windows machine; I guess this means '-static' in c lingo. 

Now, after saying 'set PATH=' I discovered that t.exe (compiled with '
mingw32-gcc main.c -o t.exe -lbfd -liberty -lintl -lz ') depends on another
non-Windows dll (corresponding to libiconv.a). I amended this by linking
with '-static' and including '-liconv', i.e.

	mingw32-gcc.exe main.c -o t.exe -static -lbfd -liberty -lintl
-liconv -lz

which produces a 'stand-alone executable'.

BTW: Is there an easy standard *one-step* approach to determine the complete
dependency graph of (non-Windows) libraries to be linked with given the
'root libraries' which are linked in the first place? In the example
above/below that would mean that the libraries 'libiberty.a', 'libintl.a',
'libiconv.a' and 'libz.a' are spit out somehow given the root library

As a side remark, compiling the GNU binutils package from scratch with an

	./configure --disable-nls

I could turn off the dependency on intl.

> <main.c>
> #define PACKAGE "your-program-name"
> #define PACKAGE_VERSION "1.2.3"
> #include <stdio.h>
> #include <bfd.h>
> int main(int argc, char** argv)
> {
>     bfd_init();
>     char* fn=argv[0];
>     printf("exe: '%s'\n", fn);
>     bfd* file = bfd_openr(fn, 0);
>     if (!file)
>         return 1;
>     if (bfd_check_format(file, bfd_object))
>         printf("object file\n");
>     else
>         printf("not object file\n");
>     bfd_close(file);
>     return 0;
> }
> </main.c>


Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
MinGW-users mailing list

This list observes the Etiquette found at 
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

You may change your MinGW Account Options or unsubscribe at:
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe