[poppler] Poppler provided printf() functions on Windows not language compliant
williambader at hotmail.com
Sun Mar 6 23:57:04 UTC 2016
> To: williambader at hotmail.com
> Subject: RE: [poppler] Poppler provided printf() functions on Windows not language compliant
> Date: Sun, 6 Mar 2016 13:18:49 -0800
> From: mathog at caltech.edu
> CC: poppler at lists.freedesktop.org
> On 06-Mar-2016 12:22, William Bader wrote:
> > Can you add -v to the compile command to show the full link line? g++
> > adds a number of libraries automatically, and probably mingw adds some
> > additional Windows libraries.
> COLLECT_GCC_OPTIONS='-v' '-o' 'printf_bug.exe' '-LC:\progs\devlibs61/lib' '-shared-libgcc' '-mtune=i386' '-march=i386'
> c:/progs/mingw/bin/../libexec/gcc/mingw32/4.6.2/collect2.exe -Bdynamic
> -u ___register_frame_info -u ___deregister_frame_info -o pri
> ntf_bug.exe c:/progs/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o
> c:/progs/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o -LC:\
> progs\devlibs61/lib -Lc:/progs/mingw/bin/../lib/gcc/mingw32/4.6.2
> -Lc:/progs/mingw/bin/../lib/gcc -Lc:/progs/mingw/bin/../lib/gcc/mi
> o -lpoppler -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex
> -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_
> s -lgcc -lmoldname -lmingwex -lmsvcrt
The collect2 command line does the linking. https://gcc.gnu.org/onlinedocs/gccint/Collect2.html
It pulls in both the mingw32 library and the msvcrt library.
I think that the problem is that you are getting part of stdio from one library and part from another, and they are not compatible.
Compile once with -c so you have the .o file of your test program, and then try running the link without -lmsvcrt to see what comes up undefined. That might give a clue to what the link is pulling from msvcrt that might be incompatible with mingw32. I haven't used mingw enough to know whether it is supposed to get stdio from libmingw32 or libmsvcrt.
I googled libmingw32 to see what might be in it, and I found the link below that mentions a conflict between mingw32 and a Windows library.
> jazzynico posted a version as an attachment for message 6 here:
I looked at it. I have Fedora 23 Linux. Neither nm or objdump could open it, but ar could unpack libpoppler.dll.a, and then I could run .o files (in i386 COFF format) through strings. I found a reference to printf in d006434.o, and a reference to sprintf in d006436.o, but those modules are so small that they are probably just relocation entries rather than code. I could also run nm on libpoppler-58.dll. Dynamic linking is trickier to implement in COFF than in ELF and takes more work to set up. I think that the printf and sprintf code in libpoppler is just a stub for the dynamic linker. Someone with more experience with mingw might know for sure.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the poppler