Forum moved here!

Home / Preview handlers build error

ianas

I’ve been using this old branch https://github.com/sumatrapdfreader/sumatrapdf/tree/rel3.1working
for a simple reason the preview handlers for cbx and mobile formats worked fine
I’m trying to build the comic only handlers so I added
#define BUILD_CBZ_PREVIEW
#define BUILD_CBR_PREVIEW
to \sumatrapdf\src\utils\BuildConfig.h
unfortunately I get a build error
LNK2001 unresolved external symbol “class BaseEngine * __cdecl CbxEngine::CreateFromStream(struct IStream *)” ([email protected]@@YAPAVBaseEngine@@PAUIStream@@@Z) PdfPreview C:\sumatrapdf\vs2015\PdfPreview.obj 1
are the extra handlers broken
the old version had working preview handlers for cb7 cbt cbr cbz epub mobi fb2 fb2z … for all supported formats
what am I missing?
I understand the reason not to include these formats until you get icons but the code worked fine a few months ago, what broke?

kjk

The code changes/is refactored and the parts that are not compiled by default can break due to not being updated for changes.

But this is code issue that is better addressed by opening a bug at https://github.com/sumatrapdfreader/sumatrapdf/issues

ianas

do I need to edit premake5.lua to enable the preview handlers for release builds as they’re there for debug


aside from premake 5 do I need any extra software like lua?

ianas

I edited premake5.lua by adding these lines right after line 509 in premake5.lua

filter {"configurations:Release"}
  defines {
    "BUILD_XPS_PREVIEW", "BUILD_DJVU_PREVIEW", "BUILD_EPUB_PREVIEW",
    "BUILD_FB2_PREVIEW", "BUILD_MOBI_PREVIEW", "BUILD_CBZ_PREVIEW",
    "BUILD_CBR_PREVIEW", "BUILD_CB7_PREVIEW", "BUILD_CBT_PREVIEW",
    "BUILD_TGA_PREVIEW"
  }

basically coping the debug defines for release and I regenerated the vc project files with premake5
the debug builds fine the release does not build the pdfpreview.dll I get these link error’s

Severity	Code	Description	Project	File	Line
Error	LNK2001	unresolved external symbol "class BaseEngine * __cdecl EpubEngine::CreateFromStream(struct IStream *)" ([email protected]@@[email protected]@[email protected]@@Z)	PdfPreview	C:\sumatrapdf\vs2015\PdfPreview.obj	1
Error	LNK2001	unresolved external symbol "class BaseEngine * __cdecl CbxEngine::CreateFromStream(struct IStream *)" ([email protected]@@[email protected]@[email protected]@@Z)	PdfPreview	C:\sumatrapdf\vs2015\PdfPreview.obj	1
Error	LNK2001	unresolved external symbol "class BaseEngine * __cdecl Fb2Engine::CreateFromStream(struct IStream *)" ([email protected]@@[email protected]@[email protected]@@Z)	PdfPreview	C:\sumatrapdf\vs2015\PdfPreview.obj	1
Error	LNK2001	unresolved external symbol "void __cdecl mui::Destroy(void)" ([email protected]@@YAXXZ)	PdfPreview	C:\sumatrapdf\vs2015\PdfPreview.obj	1
Error	LNK2001	unresolved external symbol "void __cdecl mui::Initialize(void)" ([email protected]@@YAXXZ)	PdfPreview	C:\sumatrapdf\vs2015\PdfPreview.obj	1
Error	LNK2001	unresolved external symbol "class BaseEngine * __cdecl ImageEngine::CreateFromStream(struct IStream *)" ([email protected]@@[email protected]@[email protected]@@Z)	PdfPreview	C:\sumatrapdf\vs2015\PdfPreview.obj	1
Error	LNK2001	unresolved external symbol "class BaseEngine * __cdecl MobiEngine::CreateFromStream(struct IStream *)" ([email protected]@@[email protected]@[email protected]@@Z)	PdfPreview	C:\sumatrapdf\vs2015\PdfPreview.obj	1
Error	LNK2001	unresolved external symbol "class BaseEngine * __cdecl DjVuEngine::CreateFromStream(struct IStream *)" ([email protected]@@[email protected]@[email protected]@@Z)	PdfPreview	C:\sumatrapdf\vs2015\PdfPreview.obj	1

I find it strange that I have no problems compiling the debug build any idea on how I can compile the preview handlers for release builds?

ianas

maybe I need to add another library in the links section

links { "utils", "libmupdf", "chm" }
links { "comctl32", "gdiplus", "msimg32", "shlwapi", "version" }

any idea what library would contain the preview handlers?

kjk

You also need to compile the files. See https://github.com/sumatrapdfreader/sumatrapdf/blob/master/premake5.files.lua#L797

ianas

I’m sorry if I sound dumb but I’m not a programmer afaik I did compile the files?
adding “engines” in the links section and now I got even more different link errors
I don’t understand why the preview handlers build in the debug but not in the release I used the same configuration
I’ll look at the premake5.files.lua

edit
OK I get it now
there’s a debug section in premake5.files.lua regarding the preview handler I’ll add a release section and see if it builds
tanks

ianas

that did it tank you very much I’ve been using an ancient version now I can finally update my favorite reader :slight_smile: