Subject: Linker Error on Fresh ns-3.43 Install: cannot find -lns3-wifi

33 views
Skip to first unread message

Naveen Vaidyanathan

unread,
Oct 3, 2025, 7:24:14 AMOct 3
to ns-3-users

Hello everyone,

I'm having a persistent linker error on a fresh installation of ns-allinone-3.43 and I'm hoping someone can point me in the right direction.

The Problem: When I try to build a simple program in the scratch directory, the build fails at the final linking stage with the error /usr/bin/ld: cannot find -lns3-wifi: No such file or directory. This happens for all the core ns-3 libraries. It seems the main libraries (.so files) are not being created in the build/lib directory, even though the compilation of their source files seems to succeed.

My System:

  • ns-3 Version: ns-3.43 (from the ns-allinone-3.43.tar.bz2 package)

  • Operating System: 
    navvu@RaghunathDas:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 24.04.3 LTS
    Release:        24.04
    Codename:       noble

Troubleshooting Steps I've Already Taken: I've spent a long time trying to debug this and have already tried:

  1. A complete, clean re-installation of ns-allinone-3.43 after removing the old directory.

  2. Installing all prerequisite and optional system dependencies for Ubuntu/Debian using a comprehensive sudo apt-get install ... command (including g++, cmake, python3-dev, ninja-build, etc.).

  3. Running ./ns3 clean and then ./ns3 build multiple times.

  4. Verifying my simple program code and scratch/CMakeLists.txt are correct. The build fails even with the most basic setup.

Even on a completely fresh install with all dependencies met, the linker cannot find the core ns-3 libraries.

Here is the final error log:

  [826/1004] Linking CXX executable /home/navvu/ns-allinone-3.43/ns-3.43/build/ns3-glowworm
 FAILED: /home/navvu/ns-allinone-3.43/ns-3.43/build/ns3-glowworm
 : && /usr/bin/c++ -Os -g -DNDEBUG scratch/CMakeFiles/ns3-glowworm.dir/ns3-glowworm.cc.o -o /home/navvu/ns-allinone-3.43/ns-3.43/build/ns3-glowworm -L/home/navvu/ns-allinone-3.43/ns-3.43/build/lib -Wl,-rpath,/home/navvu/ns-allinone-3.43/ns-3.43/build/lib -lns3-wifi -lns3-internet -lns3-mobility -lns3-applications && : /usr/bin/ld: cannot find -lns3-wifi: No such file or directory 
/usr/bin/ld: cannot find -lns3-internet: No such file or directory 
/usr/bin/ld: cannot find -lns3-mobility: No such file or directory 
/usr/bin/ld: cannot find -lns3-applications: No such file or directory
 collect2: error: ld returned 1 exit status 
ninja: build stopped: subcommand failed.  

Here are my simple test files:

scratch/ns3-glowworm.cc:

C++
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/mobility-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"

int main(int argc, char* argv[]) {
    ns3::NodeContainer nodes;
    nodes.Create(2);
    // ... rest of the simple program ...
    ns3::Simulator::Run();
    ns3::Simulator::Destroy();
    return 0;
}

scratch/CMakeLists.txt:

add_executable(ns3-glowworm
    ns3-glowworm.cc
)

target_link_libraries(ns3-glowworm
    PRIVATE
    ns3-wifi
    ns3-internet
    ns3-mobility
    ns3-applications
)

Does anyone have an idea why a fresh ns-3 installation on my system would fail to create its own libraries, leading to this linker error? Any suggestions for further diagnostics would be greatly appreciated.

Thank you for your time.

Tom Henderson

unread,
Oct 3, 2025, 5:47:58 PMOct 3
to ns-3-...@googlegroups.com

Can you try by adding your program to scratch/ but not modifying scratch/CMakeLists.txt?  The scratch/ directory is special in that it doesn't require CMakeLists.txt, so perhaps what you are adding there is interfering with how it is naturally handled.

- Tom

--
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 visit https://groups.google.com/d/msgid/ns-3-users/5e707967-ed56-4431-b3a1-2fd0b5379cb4n%40googlegroups.com.

Naveen Vaidyanathan

unread,
Oct 4, 2025, 1:08:54 AMOct 4
to ns-3-users

Hi Tom,

Thank you very much for your suggestion to try building without modifying the scratch/CMakeLists.txt.

Unfortunately, the problem persisted. After a full re-installation and installing all system dependencies, the build still fails at the final linking stage with the cannot find -lns3-wifi error. It seems to be a deeper issue with my specific build environment that is preventing the core ns-3 libraries from being created.

I have started a new thread on the main group with the complete error logs and system details.

Gabriel Ferreira

unread,
Oct 6, 2025, 8:53:20 AMOct 6
to ns-3-users

mv scratch/ns3-glowworm.cc scratch/glowworm.cc

./ns3 clean && ./ns3 configure && ./ns3 run glowworm

Reply all
Reply to author
Forward
0 new messages