CMake | Build profile switching triggers complete compilation every time

119 views
Skip to first unread message

Emanuele Giona

unread,
Oct 24, 2022, 9:55:31 AM10/24/22
to ns-3-users
Hello everyone,

I have recently upgraded to ns-3.36 (via the all-in-one package) and I noticed that switching build profiles with CMake does not work as it previously did under Waf.
As the documentation states, explicitly configuring the ns3 utility script with both build-profile and out options, only new files should be compiled in order to switch between the two profiles.
However, this only happens if some source code is updated and a new build is invoked whilst in the same build profile; when switching between two build profiles (debug and optimized, namely) the entire source code compilation is triggered even when no new files are added or any change at all has been made.

This unintended behavior happens with a fresh installation of ns-3, with no external modules.
It might be interesting to know that I am passing CC and CXX environmental variables to the ns3 utility script in order to point at gcc/g++ 8, since I am keeping older versions installed system-wide.

Is there any way to solve this issue without keeping separate ns-3 installations, one permanently in debug profile and the other one in the optimized one?

Thanks in advance.

Gabriel Ferreira

unread,
Oct 24, 2022, 2:32:08 PM10/24/22
to ns-3-users
In most cases, it is just the build system printing progress checkpoints, which appear to be a full build but might not be the case.
However, object files of different build types share the same names, which I believe could cause something like that if you are reusing the same cmake-cache directory (which is the hardcoded behavior of the ns3 script).
Ccache mitigates that to some extent, and is recommended.

Suparna

unread,
Oct 25, 2022, 1:31:18 PM10/25/22
to ns-3-...@googlegroups.com
Hello Everyone, 

I am a Postgraduate student. Doing My project on Underwater Wireless Sensor network. I want to build a small network in Aquasim environment. Could anybody help me doing this? I am Unable to use NS3.24.1 software. please help.

Thanks and Regards.
Suparna Chakraborty

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/a42f4931-e856-4311-b031-3b47ed66c395n%40googlegroups.com.

BIKASH MAZUMDAR

unread,
Oct 26, 2022, 4:27:37 AM10/26/22
to ns-3-...@googlegroups.com
Use ubuntu .. You can try in VMs as well. Look at https://dpprojectdevelopment.wordpress.com/ns3-project-support/install-ns3-ns-allinone-3-17-on-ubuntu-12-0414-04-for-beginnersdp-project-development/ for required packages you need to install before ns3.

Let me know if you need any help related to installation.

Tom Henderson

unread,
Oct 26, 2022, 9:57:21 AM10/26/22
to ns-3-...@googlegroups.com, Suparna
When you start a new topic, please do not reply to a previous
(unrelated) topic-- start a new thread with a new subject line.

Please provide more details (in a separate thread) why you are not able
to use ns-3.24.1.

- Tom


On 10/25/22 10:31, Suparna wrote:
> Hello Everyone,
>
> I am a Postgraduate student. Doing My project on Underwater Wireless
> Sensor network. I want to build a small network in Aquasim environment.
> Could anybody help me doing this? I am Unable to use NS3.24.1 software.
> please help.
>
> Thanks and Regards.
> Suparna Chakraborty
>
> On Mon, Oct 24, 2022 at 7:25 PM 'Emanuele Giona' via ns-3-users
> <ns-3-...@googlegroups.com <mailto:ns-3-...@googlegroups.com>> wrote:
>
> Hello everyone,
>
> I have recently upgraded to ns-3.36 (via the all-in-one package) and
> I noticed that switching build profiles with CMake does not work as
> it previously did under Waf.
> As the documentation states
> <https://www.nsnam.org/docs/tutorial/html/getting-started.html#build-profiles>, explicitly configuring the ns3 utility script with both /build-profile/ and /out/ options, only new files should be compiled in order to switch between the two profiles.
> However, this only happens if some source code is updated and a new
> build is invoked whilst in the same build profile; when switching
> between two build profiles (/debug/ and /optimized/, namely) the
> entire source code compilation is triggered even when no new files
> are added or any change at all has been made.
>
> This unintended behavior happens with a fresh installation of ns-3,
> with no external modules.
> It might be interesting to know that I am passing CC and CXX
> environmental variables to the ns3 utility script in order to point
> at gcc/g++ 8, since I am keeping older versions installed system-wide.
>
> Is there any way to solve this issue without keeping separate ns-3
> installations, one permanently in debug profile and the other one in
> the optimized one?
>
> Thanks in advance.
>
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> <https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting>
> ---
> You received this message because you are subscribed to the Google
> Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to ns-3-users+...@googlegroups.com
> <mailto:ns-3-users+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ns-3-users/a42f4931-e856-4311-b031-3b47ed66c395n%40googlegroups.com <https://groups.google.com/d/msgid/ns-3-users/a42f4931-e856-4311-b031-3b47ed66c395n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> <https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting>
> ---
> You received this message because you are subscribed to the Google
> Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ns-3-users+...@googlegroups.com
> <mailto:ns-3-users+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ns-3-users/CAMjqjTgmytX5Lr%3Dx89uFmMW7MEJK%2B%3DPN%2BNgfqAKTj-V4E1KyTg%40mail.gmail.com <https://groups.google.com/d/msgid/ns-3-users/CAMjqjTgmytX5Lr%3Dx89uFmMW7MEJK%2B%3DPN%2BNgfqAKTj-V4E1KyTg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Suparna

unread,
Nov 9, 2022, 10:20:42 AM11/9/22
to ns-3-...@googlegroups.com
Hi Bikash, 
Thanks for your reply. I have installed ubuntu 20.04.5 version and installed NS 3.24.1 installed aquasim. there are no problems in installation. but now how can I create my own network. please help
TIA

Gabriel Ferreira

unread,
Nov 30, 2022, 9:03:41 PM11/30/22
to ns-3-users
Emanuele, just giving you an update. I believe I found the issue. 
When the precompiled headers are enabled, the stdlib_pch target didn't have a different name/path to reflect the different build profiles.
When you switch the build profile without cleaning the cmake cache first, the cache ended up rebuilding the stdlib_pch, which triggered a recompilation of the libraries.
It wasn't a full recompilation, but still takes a while since ccache needs to match the contents of the files with the expected output instead of simply pulling it based on the path/name.

Should be mitigated with https://gitlab.com/nsnam/ns-3-dev/-/merge_requests/1237/diffs?commit_id=5b644250c09ecca66932ce6251ddec262c210c6a

On Monday, October 24, 2022 at 10:55:31 AM UTC-3 Emanuele Giona wrote:

sabit Abera

unread,
Dec 1, 2022, 12:59:56 AM12/1/22
to ns-3-...@googlegroups.com
Hello, everyone when I generate Map I fetch with this problem In OSM(open street Map) please help me how can i fix this problem
sabit@sabit-VirtualBox:~/sumo/tools$ python osmWebWizard.py
Building scenario in '/home/sabit/sumo/tools/2022-11-30-16-14-05'
Downloading map data
200 OK
Converting map data
usage: osmWebWizard.py [-h] [-c FILE] [-C FILE] [--save-template FILE]
                       [-p PREFIX] [-f OSM_FILE] [-m TYPEMAP]
                       [--netconvert-typemap NETCONVERT_TYPEMAP]
                       [-o OLDAPI_PREFIX] [-t TILES]
                       [--vehicle-classes VEHICLE_CLASSES]
                       [-d OUTPUT_DIRECTORY] [-n NETCONVERT_OPTIONS]
                       [--pedestrians] [-y POLYCONVERT_OPTIONS] [-z]
osmWebWizard.py: error: typemap file "${SUMO_HOME}/data/typemap/osmPolyconvert.typ.xml" not found


--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages