SUMMARY Using okular to display any PDF file results in a message "Bogus memory allocation size". The application runs, but does not show the contents of the file. However it does recognise the different pages which it renders as blanks. STEPS TO REPRODUCE 1. Run okular <filename> 2. 3. OBSERVED RESULT Blank pages throughout. EXPECTED RESULT Display contents of files. To be clear, the files are not corrupt. All other viewers (atril, epdfview, mupdf, evince, kpdf (yes from KDE3), etc.) are capable of displaying the same files correctly. SOFTWARE/OS VERSIONS Windows: MacOS: Linux/KDE Plasma: opensuse leap 15 (available in About System) KDE Plasma Version: 5.15 KDE Frameworks Version: 5.55.0 Qt Version: 5.12.1 ADDITIONAL INFORMATION
So you're using leap or self compiled? Seems to me this is a PEBKAC if this happens for al the files, since well, it works fine. Or is it only for one particular file?
My base OS is opensuse leap 15 but my QT/KDE packages are self-compiled, albeit based on opensuse source RPMs. The issue wih okular affects any file that is in the PDF format. I should add, this was also the base in v18.12.0. The problem is unique to okular - any other viewer will render the PDF files correctly. As an aside, I came across a similar bug report from 2009. I wonder why it should recur 10 years hence?
If you compile yourself, do you also install it into /usr using the cmake variables?
No, I don't use /usr. The reason I compile both QT5 and KDE packages is that I install them in a different partition. i.e. /opt/kde. I have done this for several years without a problem from okular. It broke in the last two updates.
Please make sure Okular finds its kpart and generator plugins by setting the environment variables to also point to your installation. If unsure, use strace to check.
Please also note that openSUSE developers offer repositories with compiled versions of Okular, but from stable, as well as from unstable branch, so I don't see the need to compile yourself.
Unless further information is provided, let's assume it's an error on your end.
As I mentioned previously, I compile the packages because I install them in a available (non-standard) partition. What environment variable does okular need, please? or could someone point me to the part of the code that hard-codes that path. I presume this has changed in versions 18.12.x given that prior versions worked fine with precisely the same installation root? Moreover, all I change is the prefix from /usr to /opt/kde in all KDE apps.
Looking back at a similar bug 10 years ago, I am tempted to suggest that the problem is due to the incomparability of this version of okular with the newer versions of poppler. I suspect the problems began when I upgraded to poppler-0.72; I now have poppler-0.74. If poppler is the cause, then I suppose okular won't work on my system.
Regarding environment variables, please see https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source#Set_up_the_runtime_environment Okular works with poppler 0.72 on my system (openSUSE Krypton).
OK thanks. Setting the environments variables does not sort things. In fact, most of them were already set correctly. This leaves me even more convinced that it is an issue of the interaction of okular with poppler-0.74. I get this idea from [Bug 211526] which is precisely what I observe. A few other tools also also depend on the same poppler library, and they show mixed results: - Texstudio also fails to show a PDF file with the same error (but I am not sure that it was designed to access PDF files that it did not generate) - Calligra has not problem at all - Dfm also works fine I will try to rebuild texstudio since it I installed from the opensuse repositories directly, thus it was built with a different version of poppler.
Just to close issue, I can confirm that this bug affects some applications (not all) that depend on poppler-qt5. Those that use poppler-glib are not affected. Moreover, QT5 is not the source of the problem - given that xpdf works fine, yet is uses QT5 but not poppler-qt5. Therefore, I concluded that some function in okular and texstudio calling libpoppler-qt5.so.1 does not allocate memory properly which then causes libpoppler-qt5.so.1 to fail with the "bogus memory" warning. Searching online, I came across this explanation for a similar issue with a different app using an old version of poppler. << "Bogus memory allocation size" is given by gmallocn(), gmallocn3(), or greallocn(). It is not raised by the memory exhaust, but by the checking of invalid argument (e.g. requested memory size ... numMember x sizeOfMember > INT_MAX, etc). ... >> Anyway, just my 2 cents worth of explanation.
For anyone who might come have a similar problem, I finally figured out the solution. I was blindly applying opensuse's build procedures, using their standard flags ("-Wl,--as-needed -Wl,--no-undefined -Wl,-Bsymbolic-functions"). If I build using plain options (e.g. ArchLinux procedures), then the issue goes away. The lesson is: "do not set the linker flags to anything exotic!"