# Error in building last version

**URL:** <https://swi-prolog.discourse.group/t/error-in-building-last-version/5103>\
**Category:** Help!\
**Tags:** bug\
**Created:** [March 7, 2022, 6:58pm UTC](https://swi-prolog.discourse.group/t/error-in-building-last-version/5103 "2022-03-07T18:58:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![damiazz94](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@damiazz94](https://swi-prolog.discourse.group/u/damiazz94)\
**Post date:** [March 7, 2022, 6:58pm UTC](https://swi-prolog.discourse.group/t/error-in-building-last-version/5103/1 "2022-03-07T18:58:25Z")

</div>

Hi,  
with the last version of SWI (pull from master) i get a building error:

```prolog
/mnt/c/Users/damia/Desktop/Mio/swipl-devel/packages/xpce/src/win/frame.c: In function ‘makeClassFrame’:
/mnt/c/Users/damia/Desktop/Mio/swipl-devel/packages/xpce/src/win/frame.c:2036:31: error: ‘NAME_mappedFrames’ undeclared (first use in this function)
   MappedFrames = globalObject(NAME_mappedFrames, ClassChain, EAV);
                               ^

```

Any idea how to fix this?  
Thanks

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [March 7, 2022, 7:16pm UTC](https://swi-prolog.discourse.group/t/error-in-building-last-version/5103/2 "2022-03-07T19:16:08Z")

</div>

Last week, I saw this error (or something similar) on Ubuntu … and then it went away a few days later. I’m guessing that some underlying dependency got updated. (I also saw some weird “inconsistent history” messages when I did “git pull” … and those mysteriously disappeared later)

Suggestions: do another “git pull --recurse” and do a clean build (delete the “build” directory first)

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 7, 2022, 7:40pm UTC](https://swi-prolog.discourse.group/t/error-in-building-last-version/5103/3 "2022-03-07T19:40:35Z")

</div>

> [@damiazz94](#):
>
> Any idea how to fix this?

Either do a clean build (i.e., remove the build directory) or run this from the build directory and next re-run `ninja`.

```
rm packages/xpce/h/names.i?

```

---

<div class="post-metadata">

**Author:** ![damiazz94](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@damiazz94](https://swi-prolog.discourse.group/u/damiazz94)\
**Post date:** [March 9, 2022, 9:53am UTC](https://swi-prolog.discourse.group/t/error-in-building-last-version/5103/4 "2022-03-09T09:53:04Z")

</div>

This indeed fixes my problem. However, i’m still whondering why sometimes i have to delete the build folder and rebuild the whole project from scratch…

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 9, 2022, 10:15am UTC](https://swi-prolog.discourse.group/t/error-in-building-last-version/5103/5 "2022-03-09T10:15:16Z")

</div>

In this case, a missing dependency. Adding this dependency is doable, but the toolchain is rather complicated and would cause a full rebuild of the XPCE graphics library on any change to it. Adding “names” (XPCE’s atoms) to the source happens so rarely that I didn’t bother.

Otherwise you should typically be fine with an incremental build unless one of the dependencies is updated to a new version. Thus, after an OS upgrade you typically have to restart in a clean build directory.

The overall rule of thumb:

- `git pull`
- `git submodule update --init`
- `cd build`
- `ninja`
- `ninja` # Should not be needed, but some dependencies do not always work correctly ☹

On a persistent failure

- Make sure your git tree is clean (`git status` or `git diff`)
- Remove the `build` dir, recreate it, run `cmake` and `ninja`.

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [March 9, 2022, 4:53pm UTC](https://swi-prolog.discourse.group/t/error-in-building-last-version/5103/6 "2022-03-09T16:53:43Z")

</div>

> [@jan](#):
>
> git submodule update --init

I think that `git pull --recurse` avoids the need for `submodule update --init`. Similarly, you can do initial checkout with `git clone --recurse`. (And adding `-j8` speeds things up by updating the submodules in parallel)
