View Issue Details

IDProjectCategoryView StatusLast Update
0030976CommunityOCCT:Configurationpublic2021-09-04 16:23
Reportermblanchard Assigned Tobugmaster  
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
PlatformWindowsOSWindows 
Product Version7.3.0 
Target Version7.6.0Fixed in Version7.6.0 
Summary0030976: Configuration, CMake - Build failure with static FreeType dependency
DescriptionBuilding on Windows using CMake, linking againts a static version of the FreeType library seems to be failing:

  Linking CXX shared library win64\vc14\bind\TKService.dll
  FAILED: win64/vc14/bind/TKService.dll win64/vc14/libd/TKService.lib
  LINK : fatal error LNK1104: cannot open file 'freetype.lib'

Building OCCT with -DBUILD_SHARED_LIBS=TRUE and -DBUILD_SHARED_LIBS=FALSE are both failing on my machine.

Is linking against static FreeType not supported?
Steps To Reproduce1. Build a static+debug freetyped.lib:

cmake -Bwin64-msvc2015-debug-static -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=NO -DCMAKE_INSTALL_PREFIX=/d/opt/nf-libs/freetype-2.10.1/win64-msvc2015-debug-static

Generates 'D:\opt\nf-libs\freetype-2.10.1\win64-msvc2015-debug-static\lib\freetyped.lib'.

2. Try building OCCT against that binary:

cmake -Bwin64-msvc2015-debug-static -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=NO -D3RDPARTY_FREETYPE_DIR=/d/opt/nf-libs/freetype-2.10.1/win64-msvc2015-debug-static -DBUILD_MODULE_Draw:BOOL=FALSE -DCMAKE_INSTALL_PREFIX=/d/opt/nf-libs/opencascade-7.3.0/win64-msvc2015-debug-static

Fails...
Additional information
and documentation updates
Failing linker command:

C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\link.exe
/nologo
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_Background.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_CircularGrid.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_DisplayConnection.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_GenId.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_GradientBackground.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_Grid.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_NeutralWindow.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_RectangularGrid.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Aspect\Aspect_Window.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\SelectBasics\SelectBasics.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\SelectBasics\SelectBasics_EntityOwner.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\SelectBasics\SelectBasics_SensitiveEntity.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Image\Image_AlienPixMap.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Image\Image_Diff.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Image\Image_PixMap.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Image\Image_VideoRecorder.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\WNT\WNT_WClass.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\WNT\WNT_Window.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Font\Font_BRepFont.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Font\Font_BRepTextBuilder.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Font\Font_FontMgr.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Font\Font_FTFont.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Font\Font_FTLibrary.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Font\Font_SystemFont.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\Font\Font_TextFormatter.cxx.obj
src\TKService\CMakeFiles\TKService.dir\__\__\resources\TKService.rc.res
/out:win64\vc14\bind\TKService.dll
/implib:win64\vc14\libd\TKService.lib
/pdb:win64\vc14\bind\TKService.pdb
/dll
/version:7.3
/machine:x64
/debug
/INCREMENTAL
-LIBPATH:D:\opt\nf-libs\freetype-2.10.1\win64-msvc2015-debug-static\lib
win64\vc14\libd\TKShHealing.lib
win64\vc14\libd\TKTopAlgo.lib
opengl32.lib
windowscodecs.lib
D:\opt\nf-libs\freetype-2.10.1\win64-msvc2015-debug-static\lib\freetyped.lib
win64\vc14\libd\TKGeomAlgo.lib
win64\vc14\libd\TKBRep.lib
win64\vc14\libd\TKGeomBase.lib
win64\vc14\libd\TKG3d.lib
win64\vc14\libd\TKG2d.lib
win64\vc14\libd\TKMath.lib
win64\vc14\libd\TKernel.lib
advapi32.lib
gdi32.lib
user32.lib
Psapi.lib
wsock32.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
/MANIFEST
/MANIFESTFILE:src\TKService\CMakeFiles\TKService.dir/intermediate.manifest
src\TKService\CMakeFiles\TKService.dir/manifest.res
TagsNo tags attached.
Test case numberNot required

Relationships

related to 0032553 closedbugmaster Community Configuration, CMake - unable to building with ActiveTcl 
related to 0031087 verifiedsmoskvin Open CASCADE Configuration - make FreeType dependency optional 

Activities

mblanchard

2019-09-17 15:27

reporter   ~0087204

Also note that the following warning gets emitted at configure-time:

  CMake Warning at CMakeLists.txt:740 (message):
    Could not find DLLs of used third-party products: 3RDPARTY_FREETYPE_DLL_DIR

kgv

2020-03-04 12:23

developer   ~0090810

Linking against static FreeType makes small sense when building OCCT DLLs, as several DLLs depend on FreeType.

-DBUILD_SHARED_LIBS=NO should effectively ignore paths to FreeType libraries, as linkage should be done at application stage (see adm/cmake/freetype.cmake). If this is not the case for some reason - CMake scripts should be debugged.

git

2021-09-03 15:22

administrator   ~0103721

Branch CR30976 has been created by kgv.

SHA-1: 0bf8fbdadeaabf0118da70cbff40dde340fa4450


Detailed log of new commits:

Author: kgv
Date: Fri Sep 3 15:22:22 2021 +0300

    0030976: Configuration, CMake - Build failure with static FreeType dependency
    
    Removed linkage with "freetype.lib" with help of pragma lib specific to msvc.
    FreeType library should be configured as a normal external dependency via CSF_FreeType
    by CMake and genproj, which is already done (information was duplicated).

kgv

2021-09-03 15:26

developer   ~0103722

> Generates 'D:\opt\nf-libs\freetype-2.10.1\win64-msvc2015-debug-static\lib\freetyped.lib'.
> LINK : fatal error LNK1104: cannot open file 'freetype.lib'
I guess that the main issue here is not static library but using "freetyped.lib" instead of "freetype.lib".
This problem could be solved just by removing linkage to "freetype.lib" via pragma comment within Font_FontMgr.cxx, which duplicates linkage information already defined by CMake / genproj.

kgv

2021-09-03 15:26

developer   ~0103723

Please raise the patch
- OCCT: branch CR30976.

mblanchard

2021-09-03 15:58

reporter   ~0103727

Nice catch, thanks!

smoskvin

2021-09-04 14:26

administrator   ~0103762

Combination -
OCCT branch : IR-2021-09-03
master SHA - f26ee38f2a309ffbf7de4eebbcef2c5a5c57d84e
a87b7ddc8cb44606b91e3f37113847c3f5f50fdc
Products branch : IR-2021-09-03 SHA - 87cca1a8f3dd94387a936b9d49f5bd719c69cf4d
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17495.94000000042 / 17441.55000000031 [+0.31%]
Products
Total CPU difference: 11565.440000000113 / 11534.270000000102 [+0.27%]
Windows-64-VC14:
OCCT
Total CPU difference: 19307.140625 / 19200.421875 [+0.56%]
Products
Total CPU difference: 12917.859375 / 12874.53125 [+0.34%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2021-09-04 14:59

administrator   ~0103783

Branch CR30976 has been deleted by mnt.

SHA-1: 0bf8fbdadeaabf0118da70cbff40dde340fa4450

Related Changesets

occt: master e21db5b8

2021-09-03 12:22:22

kgv


Committer: bugmaster Details Diff
0030976: Configuration, CMake - Build failure with static FreeType dependency

Removed linkage with "freetype.lib" with help of pragma lib specific to msvc.
FreeType library should be configured as a normal external dependency via CSF_FreeType
by CMake and genproj, which is already done (information was duplicated).
Affected Issues
0030976
mod - src/Font/Font_FontMgr.cxx Diff File

Issue History

Date Modified Username Field Change
2019-09-17 13:20 mblanchard New Issue
2019-09-17 13:20 mblanchard Assigned To => bugmaster
2019-09-17 15:27 mblanchard Note Added: 0087204
2020-03-03 10:23 bugmaster Assigned To bugmaster => apn
2020-03-03 10:23 bugmaster Status new => assigned
2020-03-04 12:17 kgv Summary Build failure with static FreeType dependency => Configuration, CMake - Build failure with static FreeType dependency
2020-03-04 12:23 kgv Note Added: 0090810
2020-03-04 12:24 kgv Severity major => minor
2020-03-04 12:24 kgv Target Version => 7.5.0
2020-09-11 15:37 utverdov Assigned To apn => inv
2020-09-11 15:40 utverdov Target Version 7.5.0 => 7.6.0
2020-09-11 17:08 bugmaster Assigned To inv => bugmaster
2021-09-03 14:13 bugmaster Target Version 7.6.0 => 7.7.0
2021-09-03 15:18 kgv Relationship added related to 0032553
2021-09-03 15:19 kgv Relationship added related to 0031087
2021-09-03 15:22 git Note Added: 0103721
2021-09-03 15:26 kgv Note Added: 0103722
2021-09-03 15:26 kgv Note Added: 0103723
2021-09-03 15:26 kgv Severity minor => trivial
2021-09-03 15:26 kgv Status assigned => resolved
2021-09-03 15:26 kgv Target Version 7.7.0 => 7.6.0
2021-09-03 15:26 kgv Additional Information Updated
2021-09-03 15:26 kgv Status resolved => reviewed
2021-09-03 15:58 mblanchard Note Added: 0103727
2021-09-04 14:26 smoskvin Note Added: 0103762
2021-09-04 14:26 smoskvin Status reviewed => tested
2021-09-04 14:36 bugmaster Changeset attached => occt master e21db5b8
2021-09-04 14:36 bugmaster Status tested => verified
2021-09-04 14:36 bugmaster Resolution open => fixed
2021-09-04 14:59 git Note Added: 0103783
2021-09-04 16:23 smoskvin Test case number => Not required