# VTK crashed while setting LD\_PRELOAD with libGLEW.so

**URL:** https://discourse.vtk.org/t/vtk-crashed-while-setting-ld-preload-with-libglew-so/4402
**Category:** Support
**Created:** [October 12, 2020, 6:22pm UTC](https://discourse.vtk.org/t/vtk-crashed-while-setting-ld-preload-with-libglew-so/4402 "2020-10-12T18:22:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![TooSchoolForCool](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tooschoolforcool/32/2456_2.png) [@TooSchoolForCool](https://discourse.vtk.org/u/TooSchoolForCool)
#### Post date: [October 12, 2020, 6:22pm UTC](https://discourse.vtk.org/t/vtk-crashed-while-setting-ld-preload-with-libglew-so/4402/1 "2020-10-12T18:22:32Z")

</div>

Hi there,

My System environment is `Ubuntu 16.04`, and I installed vtk via `pip install vtk`

If I set

```bash
export LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/libGLEW.so

```

then every time when I use `vtk` in python the program will crash, and prompted `Segmentation fault (core dumped)`.

For example, the following python scripts will reproduce the crash.

```python
#!/usr/bin/env python
#
import vtk
import time

cone = vtk.vtkConeSource()
cone.SetHeight(3.0)
cone.SetRadius(1.0)
cone.SetResolution(10)

coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInputConnection(cone.GetOutputPort())

coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)

ren = vtk.vtkRenderer()
ren.AddActor(coneActor)
ren.SetBackground(0.1, 0.2, 0.4)

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(500, 500)

iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

for i in range(0, 180):
    time.sleep(0.01)
    renWin.Render()
    ren.GetActiveCamera().Azimuth(1)

iren.Start()

```

However if I do NOT set the variable `LD_PRELOAD` with `libGLEW.so`, everything works well.

I was wondering how to resolve this issue, coz I do not want to manually cancel the `LD_PRELOAD` variable every time before using `vtk`.

Thanks in advance.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [October 12, 2020, 8:19pm UTC](https://discourse.vtk.org/t/vtk-crashed-while-setting-ld-preload-with-libglew-so/4402/2 "2020-10-12T20:19:29Z")

</div>

Why do you have `LD_PRELOAD` in your environment in the first place? All guarantees of anything working with that are off the table when `LD_PRELOAD` is involved. There’s nothing (practical) VTK can do to fix this at all. You really should only set it when necessary, not everywhere and attempt to remove it when it isn’t needed.
