Author Topic: How to connect static lib.  (Read 3864 times)

Offline dkaip

  • Multiple posting newcomer
  • *
  • Posts: 42
How to connect static lib.
« on: November 14, 2018, 10:49:39 pm »
I have a problem. Just build pdfium.lib library in Windows 10.
In Linux runs ok, with Other linker options.

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

But how to connect on windows???
Code
-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.

Offline Totoxa

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: How to connect static lib.
« Reply #1 on: November 14, 2018, 11:23:15 pm »
Is the library in the linker search path?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to connect static lib.
« Reply #2 on: November 14, 2018, 11:37:00 pm »
-lpdfium -Lpath-to-lib?
(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!]

Offline dkaip

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: How to connect static lib.
« Reply #3 on: November 15, 2018, 07:17:40 am »
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

Code
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


« Last Edit: November 15, 2018, 07:21:24 am by dkaip »

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: How to connect static lib.
« Reply #4 on: November 15, 2018, 10:34:03 am »
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 (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline dkaip

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: How to connect static lib.
« Reply #5 on: November 15, 2018, 04:33:49 pm »
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"
« Last Edit: November 15, 2018, 05:52:09 pm by dkaip »

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: How to connect static lib.
« Reply #6 on: November 15, 2018, 06:06:33 pm »
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.

Offline dkaip

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: How to connect static lib.
« Reply #7 on: November 15, 2018, 06:38:37 pm »
That means that my program can not build with GCC?