Undefined reference to CGAL::precondition_fail

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Undefined reference to CGAL::precondition_fail

Juan Jose Casafranca
I have posted this question in stack overflow (https://stackoverflow.com/
questions/59851535/undefined-reference-cgalprecondition-fail), but I reproduce
it here as I think its the right place for CGAL questions:

I am trying to build a project with CMake in Debug mode. The project contains
several static libraries, a dynamic library and an executable. The executable
links against the dynamic library and the dynamic library links against
several external dynamic libraries and to the project static libraries. One of
the static libraries depends on CGAL.

```
Static A -> CGAL
Static B
Dynamic C -> Static A, Static B, Qt...
Executable -> Dynamic C
```

When compiling in Release mode, everything works fine, but when compiling in
Debug mode, I get

```
[100%] Linking CXX executable ../../bin/Executable
/usr/bin/ld: ../../lib/DynamicC.so: undefined reference to
`CGAL::precondition_fail(char const*, char const*, int, char const*)'
collect2: error: ld returned 1 exit status
```

I have checked the exported symbols for DynamicC with `nm -D DynamicC | grep
CGAL::precondition_fail` and it says its undefined

```
nm -C DynamicC.so | grep CGAL::precondition
                 U CGAL::precondition_fail(char const*, char const*, int, char
const*)
```

I'm using a very recent CGAL header only version.
I dont understand why it's complaining about undefined reference in Debug mode
but not in Release, or how to fix it. Any ideas?





--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Undefined reference to CGAL::precondition_fail

Joachim Reichel-2
On 22.01.20 02:59, Juan José Casafranca wrote:

> [...]
>
> ```
> Static A -> CGAL
> Static B
> Dynamic C -> Static A, Static B, Qt...
> Executable -> Dynamic C
> ```
>
> [...]
>
> ```
> nm -C DynamicC.so | grep CGAL::precondition
>                  U CGAL::precondition_fail(char const*, char const*, int, char
> const*)
> ```

Can you do this also for all libraries and the executable? Once you've found
the source, you can further drill down on the corresponding object files.

Did you maybe disable the header-only mode for some translation units? Or use
a second include path that points to an older CGAL version where header-only
was not the default? Do your external libraries depends on CGAL?

The problem does not show up in release builds because the assertions are
disabled in release builds (which probably means that your external libraries
do not depend on CGAL and are unrelated).

  Joachim

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss