News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How to connect static lib.

Started by dkaip, November 14, 2018, 10:49:39 PM

Previous topic - Next topic

dkaip

I have a problem. Just build pdfium.lib library in Windows 10.
In Linux runs ok, with Other linker options.

-pg -s -Wl,--start-group libpdfium.a -Wl,--end-group -lpthread -ldl -lpthread

But how to connect on windows???
-pg -s -Wl,--start-group libpdfium.lib -Wl,--end-group -lpthread -ldl -lpthread

With pdfium.lib i take
||=== Build: Debug in maintest (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lpdfium.lib|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|
Thank you
Jim.

Totoxa

Is the library in the linker search path?

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

dkaip

#3
Yes pdfium.lib is in main folder. No problem with path.
If i put -lpdfium i am taking ...

||=== Build: Debug in maintest (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
C:\Users\jj\Desktop\pdfium_test\main.cpp|6|undefined reference to `FPDF_LoadDocument'|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

All i have is one file, the pdfium.lib in main folder, that is a static lib, so i must put at Other linker options, have i right?

In Linux the pdfium.a runs ok, but in windows i have problem with pdfium.lib

mingw32-g++.exe -Lpublic -Llibs -o bin\Debug\maintest.exe obj\Debug\main.o  -pg -s -Wl,--start-group pdfium.lib -Wl,--end-group -lpthread

Thank you
Jim



gd_on

May be your problem comes with your static library file. A .lib file is generally for microsoft visual C. With mingw32, as in linux, the standard library extension is .a.
May be you should try to compile your library yourself with your compiler or find a compatible .a file.
Not sure this will solve your problem because I have already used .lib file and mingw32 with success, but it failed also in many cases, so ...
gd_on
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

dkaip

#5
As i see pdfium build with Clang compiler, not MS C.
How to determine the code bellow when ninja build step by step the library?
Have anyone run program with pdfium.lib on windows with GCC?


Quote[1/1136] ../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo /showIncludes  "-imsvc..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-imsvc..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\include" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" -DV8_DEPRECATION_WARNINGS -DUSE_AURA=1 -DNO_TCMALLOC -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED "-DCR_CLANG_REVISION=\"343342-1\"" -D_HAS_EXCEPTIONS=0 -D__STD_C -D_CRT_RAND_S -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL -D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=1 -DWIN32 -D_SECURE_ATL -D_USING_V110_SDK71_ -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_UNICODE -DUNICODE -DNTDDI_VERSION=0x0A000002 -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DOPJ_STATIC -DPNG_PREFIX -DPNG_USE_READ_MACROS -I../.. -Igen -I../.. /utf-8 /X -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -fcolor-diagnostics -fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -fcomplete-member-pointers /Gy /FS /bigobj /d2FastFail /Zc:sizedDealloc- -fmsc-version=1911 -m64 /Brepro /O1 /Ob2 /Oy- /Zc:inline /Gw /Oi /Z7 -fno-standalone-debug /MT -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare /W3 /wd4800 /wd4267 /wd4996 -Wno-unused-variable /WX /wd4091 /wd4127 /wd4251 /wd4275 /wd4312 /wd4324 /wd4351 /wd4355 /wd4503 /wd4589 /wd4611 /wd4100 /wd4121 /wd4244 /wd4505 /wd4510 /wd4512 /wd4610 /wd4838 /wd4995 /wd4996 /wd4456 /wd4457 /wd4458 /wd4459 /wd4200 /wd4201 /wd4204 /wd4221 /wd4245 /wd4267 /wd4305 /wd4389 /wd4702 /wd4701 /wd4703 /wd4661 /wd4706 /wd4715 /wd4702 -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-user-defined-warnings -Wno-unused-lambda-capture -Wno-null-pointer-arithmetic -Wno-enum-compare-switch -Wno-ignored-pragma-optimize -Wno-defaulted-function-deleted /utf-8 /TP /GR- /wd4577 /c ../../third_party/bigint/BigUnsignedInABase.cc /Foobj/third_party/bigint/BigUnsignedInABase.obj /Fd"obj/third_party/bigint_cc.pdb"

sodev

This command line looks pretty much like clang was only used as frontend but uses MSVC 14.1 (aka Visual Studio 2017) as the compiler.

dkaip

That means that my program can not build with GCC?