Skip to content

Compile PyString

Test on version 1.1.4

Requirements

  • cmake (tested with v3.26.1)
  • gcc (tested with v10.3)

Get source

You can get source from GitHub

Compile

bash
cd ./<SOURCE_DIR>
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=<SOURCE_DIR>/install
cmake --build build --config Release --target install

Hotfix for OpeniamgeIO compilation

To avoid the following error when compiling OpenImageIO:

bash
/home/oargentieri/Documents/PullGithub/OpenColorIO-2.3.0/install/lib64/libOpenColorIO.so.2.3: undefined reference to `pystring::replace(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/home/oargentieri/Documents/PullGithub/OpenColorIO-2.3.0/install/lib64/libOpenColorIO.so.2.3: undefined reference to `pystring::os::path::isabs(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/oargentieri/Documents/PullGithub/OpenColorIO-2.3.0/install/lib64/libOpenColorIO.so.2.3: undefined reference to `pystring::os::path::basename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [bin/strutil_test] Error 1
gmake[1]: *** [src/libutil/CMakeFiles/strutil_test.dir/all] Error 2
gmake: *** [all] Error 2

At the end of pystring compilation, in the prefix install directory, you need to also have an include directory with the pystring source code. So you can just copy the source code cpp files into <PYSTRING_SOURCE_DIR>/install/include/

bash
cp <PYSTRING_SOURCE_DIR>/src/*.h <PYSTRING_SOURCE_DIR>/install/include/
cp <PYSTRING_SOURCE_DIR>/src/*.cpp <PYSTRING_SOURCE_DIR>/install/include/

This is not a good solution, but it works. A real solution would be to compile pystring as a static library and link it to OpenImageIO.