Unable to build OCCT on Debian bookworm

Hi there! I'm unable to build OCCT in my Docker container, which uses Debian bookworm release. This is how I build it:

WORKDIR "/dependencies"
RUN git clone https://github.com/Open-Cascade-SAS/OCCT.git
WORKDIR "/dependencies/OCCT"

RUN mkdir occt-build
RUN mkdir occt-install

WORKDIR "/dependencies/OCCT/occt-build"
RUN cmake /dependencies/OCCT \
    -DINSTALL_DIR=/dependencies/OCCT/occt-install \
    -DBUILD_LIBRARY_TYPE=static \
    -DBUILD_MODULE_Draw=0 \
    -DBUILD_RELEASE_DISABLE_EXCEPTIONS=Off
RUN make install

And this is what I finally see in my console (after waiting around 2 hours))):

[100%] Built target TKExpress
[100%] Building CXX object src/ExpToCasExe/CMakeFiles/ExpToCasExe.dir/lex.exptocas.cxx.o
[100%] Building CXX object src/ExpToCasExe/CMakeFiles/ExpToCasExe.dir/exptocas.tab.cxx.o
[100%] Building CXX object src/ExpToCasExe/CMakeFiles/ExpToCasExe.dir/ExpToCasExe.cxx.o
[100%] Linking CXX executable ../../lin64/gcc/bin/ExpToCasExe
/usr/bin/ld: ../../lin64/gcc/lib/libTKExpress.a(Express.cxx.o): in function `Express::WriteFileStamp(std::ostream&)':
Express.cxx:(.text+0x9d): undefined reference to `OSD_Process::OSD_Process()'
/usr/bin/ld: Express.cxx:(.text+0xa5): undefined reference to `OSD_Process::SystemDate()'
/usr/bin/ld: Express.cxx:(.text+0xce): undefined reference to `OSD_Environment::OSD_Environment(TCollection_AsciiString const&)'
/usr/bin/ld: Express.cxx:(.text+0xe6): undefined reference to `OSD_Environment::Value()'
/usr/bin/ld: Express.cxx:(.text+0x188): undefined reference to `OSD_Process::UserName()'
/usr/bin/ld: ../../lin64/gcc/lib/libTKExpress.a(Express_Entity.cxx.o): in function `Express_Entity::writeIncludes(std::ostream&) const':
Express_Entity.cxx:(.text+0x1dcf): undefined reference to `OSD_Directory::OSD_Directory(OSD_Path const&)'
/usr/bin/ld: Express_Entity.cxx:(.text+0x1dda): undefined reference to `OSD_Directory::Build(OSD_Protection const&)'
/usr/bin/ld: ../../lin64/gcc/lib/libTKExpress.a(Express_Entity.cxx.o): in function `Express_Entity::GenerateClass() const':
Express_Entity.cxx:(.text+0x91e8): undefined reference to `OSD_Directory::OSD_Directory(OSD_Path const&)'
/usr/bin/ld: Express_Entity.cxx:(.text+0x91f3): undefined reference to `OSD_Directory::Build(OSD_Protection const&)'
/usr/bin/ld: Express_Entity.cxx:(.text+0xacf7): undefined reference to `OSD_Directory::OSD_Directory(OSD_Path const&)'
/usr/bin/ld: Express_Entity.cxx:(.text+0xad07): undefined reference to `OSD_Directory::Build(OSD_Protection const&)'
/usr/bin/ld: Express_Entity.cxx:(.text+0xbb32): undefined reference to `OSD_Directory::OSD_Directory(OSD_Path const&)'
/usr/bin/ld: Express_Entity.cxx:(.text+0xbb98): undefined reference to `OSD_Directory::Build(OSD_Protection const&)'
/usr/bin/ld: ../../lin64/gcc/lib/libTKExpress.a(Express_Enum.cxx.o): in function `Express_Enum::GenerateClass() const':
Express_Enum.cxx:(.text+0x4a7): undefined reference to `OSD_Directory::OSD_Directory(OSD_Path const&)'
/usr/bin/ld: Express_Enum.cxx:(.text+0x4b2): undefined reference to `OSD_Directory::Build(OSD_Protection const&)'
/usr/bin/ld: ../../lin64/gcc/lib/libTKExpress.a(Express_Select.cxx.o): in function `Express_Select::generateSelectMember(opencascade::handle<TColStd_HSequenceOfInteger> const&) const':
Express_Select.cxx:(.text+0x2b5): undefined reference to `OSD_Directory::OSD_Directory(OSD_Path const&)'
/usr/bin/ld: Express_Select.cxx:(.text+0x2c0): undefined reference to `OSD_Directory::Build(OSD_Protection const&)'
/usr/bin/ld: ../../lin64/gcc/lib/libTKExpress.a(Express_Select.cxx.o): in function `Express_Select::GenerateClass() const':
Express_Select.cxx:(.text+0x181b): undefined reference to `OSD_Directory::OSD_Directory(OSD_Path const&)'
/usr/bin/ld: Express_Select.cxx:(.text+0x1826): undefined reference to `OSD_Directory::Build(OSD_Protection const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/ExpToCasExe/CMakeFiles/ExpToCasExe.dir/build.make:132: lin64/gcc/bin/ExpToCasExe-7.8.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:2387: src/ExpToCasExe/CMakeFiles/ExpToCasExe.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

What may be wrong with that and how can I fix it? Thanks in advance!!

Attachments: 
bingo-soft's picture

And some extra information that may be important:

# gcc --version
gcc (Debian 12.2.0-14) 12.2.0

and

# cmake --version
cmake version 3.27.4
Dmitrii Pasukhin's picture

Hello,

ExpToCasExe is a known problem. If you are using OCCT 7.7.1+. Please disable Cmake variable.

-DBUILD_MODULE_DETools=OFF

If you are using older version. I will give another solution.

Best regards, Dmitrii.
 

Esteban Dugueperoux's picture

Hi,

I'm on a Fedora Linux 39 workstation and after cloning https://github.com/Open-Cascade-SAS/OCCT/, I try to build master branch with 'cmake -DBUILD_MODULE_DETools=OFF -DBUILD_LIBRARY_TYPE=Static . && make' but I get following errorr:

[100%] Linking CXX executable ../../lin64/gcc/bin/DRAWEXE
/usr/bin/ld : ../../lin64/gcc/lib/libTKBinTObj.a(BinTObjDrivers_IntSparseArrayDriver.cxx.o) : dans la fonction « BinTObjDrivers_IntSparseArrayDriver::NewEmpty() const » :
BinTObjDrivers_IntSparseArrayDriver.cxx:(.text+0x1a) : référence indéfinie vers « TObj_TIntSparseArray::TObj_TIntSparseArray() »
/usr/bin/ld : ../../lin64/gcc/lib/libTKBinTObj.a(BinTObjDrivers_IntSparseArrayDriver.cxx.o) : dans la fonction « BinTObjDrivers_IntSparseArrayDriver::Paste(BinObjMgt_Persistent const&, opencascade::handle<TDF_Attribute> const&, BinObjMgt_RRelocationTable&) const » :

I got it also with BUILD_MODULE_DETools enabled.
I got this issue also on V7_7_2 tag.

Is it a known issue?

Regards.

Dmitrii Pasukhin's picture

Fedora Linux 39 which gcc is there? Your problem is not related with DETools.

Best regards, Dmitrii.

Esteban Dugueperoux's picture

Hi Dmitrii,

I have gcc 13.2.1.

Regards.

Dmitrii Pasukhin's picture

Please check branch CR0-780. We will check gcc only for the last version. (static_build)

Best regards, Dmitrii.

Joachim Mairböck's picture

We use the following patch for building ExpToCasExe statically (on Windows, but it should work cross-platform I think): https://github.com/RISCSoftware/OCCT/commit/de2b9df74fc3d27b80ca0d743187...

Dmitrii Pasukhin's picture

Thank you!

Yes, looks as a solution for static build. We will check.

But usually I recommend to disable this module, because it is only for specific scenarious.

Best regards, Dmitrii.