# link error:libvtkCommonDataModel-9.3.so.9.3: undefined reference to \`vtkpugixml::xml\_attribute\_iterator::operator!

**URL:** https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745
**Category:** Support
**Created:** [April 19, 2024, 6:34am UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745 "2024-04-19T06:34:22Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [April 19, 2024, 6:34am UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/1 "2024-04-19T06:34:22Z")

</div>

My configuration : ubuntu 22.04,linking stage gives this error:

```auto
[98%] Built target WrapJava
[99%] Built target PythonInterpreter
[99%] Linking CXX executable ../../bin/vtkProbeOpenGLVersion-9.3
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml_attribute_iterator::operator!=(vtkpugixml::xml_attribute_iterator const&) const'
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkIOImage-9.3.so.9.3: undefined reference to `vtkpugixml::xml_parse_result::operator bool() const'
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkIOImage-9.3.so.9.3: undefined reference to `vtkpugixml::xml_node::child(char const*) const'
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml_attribute::operator!() const'
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml_node::append_copy(vtkpugixml::xml_node const&)'
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkIOImage-9.3.so.9.3: undefined reference to `vtkpugixml::xml_attribute::as_int(int) const'
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkIOImage-9.3.so.9.3: undefined reference to `vtkpugixml::xml_document::~xml_document()'
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml_node::xml_node()'
/usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml_node::append_attribute(char const*)'
/...

```

As you can see in attached image,the libvtkpugixml got built:  
 ![Selection_872](https://discourse.vtk.org/uploads/default/original/2X/c/c30e250422127c0ffade0d0cf590fe961cef3660.png)

How to fix this issue?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 23, 2024, 9:10pm UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/2 "2024-04-23T21:10:49Z")

</div>

Hello,

Can you, please, try to share the linker command for one of the offending libraries (e.g. `vtkCommonDataModel.so`) ? It’s something starting with `g++ -Wl ...`. To enable a more verbose output to get the linker commands printed to your shell (I suppose you’re using GCC’s `make`), please, refer to this: [Using CMake with GNU Make: How can I see the exact commands? - Stack Overflow](https://stackoverflow.com/questions/2670121/using-cmake-with-gnu-make-how-can-i-see-the-exact-commands) .

best,

PC

---

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [April 24, 2024, 7:31am UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/3 "2024-04-24T07:31:10Z")

</div>

@Paulo_Carvalho Thanks for replying,something like this:

`[99%] Linking CXX executable ../../bin/vtkProbeOpenGLVersion-9.3 cd /home/alex/workspace/VTK/Debug/Rendering/OpenGL2 && /usr/bin/cmake -E cmake_link_script CMakeFiles/vtkProbeOpenGLVersion.dir/link.txt --verbose=1 /usr/bin/c++ -g -Wl,-lc -Wl,-lc CMakeFiles/vtkProbeOpenGLVersion.dir/vtkProbeOpenGLVersion.cxx.o -o ../../bin/vtkProbeOpenGLVersion-9.3 -Wl,-rpath,"\$ORIGIN/../lib/x86_64-linux-gnu:" ../../lib/x86_64-linux-gnu/libvtkRenderingOpenGL2-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkIOImage-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkRenderingHyperTreeGrid-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkImagingCore-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkRenderingUI-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkRenderingCore-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkFiltersGeneral-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkFiltersCore-9.3.so.9.3 /usr/lib/x86_64-linux-gnu/libX11.so ../../lib/x86_64-linux-gnu/libvtkglew-9.3.so.9.3 /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libX11.so ../../lib/x86_64-linux-gnu/libvtkCommonExecutionModel-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkCommonTransforms-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkCommonMisc-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkCommonMath-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkkissfft-9.3.so.9.3 ../../lib/x86_64-linux-gnu/libvtkCommonCore-9.3.so.9.3 /usr/lib/gcc/x86_64-linux-gnu/11/libgomp.so /usr/lib/x86_64-linux-gnu/libpthread.a ../../lib/x86_64-linux-gnu/libvtksys-9.3.so.9.3 -ldl -Wl,-rpath-link,/home/alex/workspace/VTK/Debug/lib/x86_64-linux-gnu /usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml\_attribute\_iterator::operator!=(vtkpugixml::xml\_attribute\_iterator const&) const’  
/usr/bin/ld: …/…/lib/x86\_64-linux-gnu/libvtkIOImage-9.3.so.9.3: undefined reference to `vtkpugixml::xml_parse_result::operator bool() const' /usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkIOImage-9.3.so.9.3: undefined reference to `vtkpugixml::xml\_node::child(char const\*) const’  
/usr/bin/ld: …/…/lib/x86\_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml_attribute::operator!() const' /usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml\_node::append\_copy(vtkpugixml::xml\_node const&)’  
/usr/bin/ld: …/…/lib/x86\_64-linux-gnu/libvtkIOImage-9.3.so.9.3: undefined reference to `vtkpugixml::xml_attribute::as_int(int) const' /usr/bin/ld: ../../lib/x86_64-linux-gnu/libvtkIOImage-9.3.so.9.3: undefined reference to `vtkpugixml::xml\_document::~xml\_document()’  
/usr/bin/ld: …/…/lib/x86\_64-linux-gnu/libvtkCommonDataModel-9.3.so.9.3: undefined reference to `vtkpugixml::xml_node::xml_node()'`

add after:  
`ldd libvtkCommonDataModel-9.3.so`

I got:

```auto
	linux-vdso.so.1 (0x00007ffe35bad000)
	/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x0000775063c00000)
	libvtkCommonTransforms-9.3.so.1 (0x00007750649ce000)
	libvtkCommonMisc-9.3.so.1 (0x0000775063400000)
	libvtkCommonSystem-9.3.so.1 (0x000077506499c000)
	libvtkCommonMath-9.3.so.1 (0x0000775064962000)
	libvtkCommonCore-9.3.so.1 (0x0000775060c00000)
	libvtksys-9.3.so.1 (0x0000775063f93000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x0000775060800000)
	libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x0000775063eac000)
	libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x000077506493c000)
	libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x0000775060400000)
	libdl.so.2 => /usr/lib/x86_64-linux-gnu/libdl.so.2 (0x0000775064937000)
	libpthread.so.0 => /usr/lib/x86_64-linux-gnu/libpthread.so.0 (0x0000775064932000)
	libvtkkissfft-9.3.so.1 (0x0000775064928000)
	/lib64/ld-linux-x86-64.so.2 (0x0000775064a1f000)
	libvtkloguru-9.3.so.1 (0x000077506490a000)
	libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x0000775063e58000)

```

Seems like that vtkCommonDataModel won’t use pugixml

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 24, 2024, 6:05pm UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/4 "2024-04-24T18:05:30Z")

</div>

Hello,

If you don’t need pugixml, I recommend disabling it in CMake configuration:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/a/ab94bb64c2522b3bcd57af445dcd210fd81b7a65.png)

If you need it, then CMake is not adding pugixml to the list of libraries in the linker commands, according to the output posted by you. If so, I’d report an issue here: [https://gitlab.kitware.com/vtk/vtk/-/issues](https://gitlab.kitware.com/vtk/vtk/-/issues).

regards,

PC

---

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [April 25, 2024, 2:34am UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/5 "2024-04-25T02:34:53Z")

</div>

Thx,if disable it,I got:

```auto
CMake Error at CMake/vtkModule.cmake:1075 (message):
  The VTK::CommonDataModel module (enabled because all VTK builds require
  VTK::CommonDataModel) requires the disabled module VTK::pugixml (disabled
  via a `NO` setting (via `VTK_MODULE_ENABLE_VTK_pugixml`)).
Call Stack (most recent call first):
  CMakeLists.txt:402 (vtk_module_scan)

```

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 25, 2024, 11:52am UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/6 "2024-04-25T11:52:19Z")

</div>

Well… that adds to the confusion… Then, I have to ask to myself: why is there an option to disable something that is a requirement to a core module?

I believe you’re left for reporting an issue.

What version of GCC do you have?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 25, 2024, 12:03pm UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/7 "2024-04-25T12:03:34Z")

</div>

It would also be useful if you post the first error encountered during the build. It is possible that something wrong went unnoticed before the linker error. Please, go to the build directory, clean the build (e.g. `make clean`) and rebuild redirecting the outputs (both regular and errors) to a file: `make ... > log.txt 2>&1`. Please, share the build log here (make sure to remove any sensitive information such as passwords, license keys, etc. that may appear in the build messages).

---

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [April 26, 2024, 1:06am UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/8 "2024-04-26T01:06:59Z")

</div>

g++ 11

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 26, 2024, 12:54pm UTC](https://discourse.vtk.org/t/link-error-libvtkcommondatamodel-9-3-so-9-3-undefined-reference-to-vtkpugixml-operator/13745/9 "2024-04-26T12:54:54Z")

</div>

That’s a C++ standard. I asked for the compiler version: `g++ --version`.
