# why using giac via libgiac crashes sagemath when giac crashes?

(I do not know if this is known issue or there is similar post about it)

I am testing solution given in result-that-comes-with-warning-from-giac-integrator/

Which is to use giac integrator via libgiac vs. using what is called the text interface.

But on some integrals, this gives `sigfaul`

and sagemath crashes. I am not able to even catch this using try block

Using version `9.3`

on Linux with giac version `1.7`

Here is an example

```
sage: from sage.libs.giac import libgiac
// Giac share root-directory:/usr/share/giac/
// Giac share root-directory:/usr/share/giac/
Added 0 synonyms
sage: var('x')
x
sage: integrand=(x+(1+x)^(1/2))^(1/2)/(x^2+1)/(1+x)^(1/2)
sage: anti=libgiac.integrate(integrand,x).sage()
Segmentation fault (core dumped)
>
```

Compare to

```
sage: var('x')
x
sage: integrand=(x+(1+x)^(1/2))^(1/2)/(x^2+1)/(1+x)^(1/2)
sage: anti=integrate(integrand,x,algorithm="giac")
Giac crashed -- automatically restarting.
sage:
```

The difference is that sage does not crash here. And my script will continue running to the next integral.

Why does calling libgiac crashes sagemath itself (in the case when giac itself does crash) but not when using the text interface?

This makes this method not workable for me as is.

I suspect the reason is, when using libgic, it uses giac code which is linked statically into the sagemath image.

So when giac code core dumps, the whole sagemath process will core dump as well since it is all the same process.

But when using the text interface, sagemath will communicate with giac as separate process using some form of process to process communications. So when giac process core dumps, it does not affect sagemath process.

Any workaround so I can use libgiac but bypasses these giac crashes so my sagemath script does not itself crash?