Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

NetAnim error

48 views
Skip to first unread message

Shamanth M

unread,
Nov 19, 2024, 5:45:38 PM11/19/24
to ns-3-users
When trying to run NetAnim on my ns-3.43 program, I get the following error: 
qt.qpa.xcb: could not connect to display 192.168.144.1:0.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Aborted (core dumped)

Has anyone encountered this error before and if so what do I do to fix it? 

Tommaso Pecorella

unread,
Nov 19, 2024, 5:59:04 PM11/19/24
to ns-3-users
Dunno, but it's the kind of error I'd expect when trying to launch an app in WSL, or on a remote machine connected trough ssh.

Gabriel Ferreira

unread,
Nov 20, 2024, 4:28:31 PM11/20/24
to ns-3-users
Looks like you're trying to run an X11 application on a wayland session that doesn't support it (it was supposed to work with xwayland).
Or could be what Tommaso said.

Shamanth M

unread,
Nov 21, 2024, 7:39:51 AM11/21/24
to ns-3-users
Yeah he's correct because I'm running it on WSL. I'm guessing WSL just doesn't support NetAnim then. 

igs...@gmail.com

unread,
Nov 21, 2024, 9:48:51 AM11/21/24
to ns-3-users
Of course, WSL support NetAnim and any  Linux GUI Application (x11-based applications). In fact, two year back, I tried to install a older version of ns-3 and NetAnim on WSL.

In some version of Windows 11, You may need to Enable a Windows feature called "Virtual Machine Platform" as explained in this link :


The following screenshot shows NetAnim started from WSL of windows 11.



You may check this link for one such installation.

So, hopefully it will work on your WSL installation also.

Charles Pandian.

Gabriel Ferreira

unread,
Nov 21, 2024, 10:01:39 AM11/21/24
to ns-3-users
As Charles said, you either need an up to date WSLv2 which ships with its own X11 server (https://github.com/microsoft/wslg)

$ wsl --list --all --verbose
  NAME            STATE           VERSION
* Ubuntu-24.04    Running         2

Or if you are feeling adventurous, you can setup by yourself, by installing a X11 server on Windows (e.g. https://vcxsrv.com/)

Then create a task that runs the server on every boot/login, so that it is always available for your linux applications to connect to.
Which can be done via Task Scheduler with the following parameters
  • Command: "C:\Program Files\VcXsrv\vcxsrv.exe"
  • Arguments: :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl

Or straight through command line, using my sample XML

<?xml version="1.0" encoding="UTF-16"?> <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <RegistrationInfo> <Date>2018-01-08T18:04:41.0112034</Date> <Author>VOSTRO-5470\Gabriel</Author> <URI>\VcxSrv</URI> </RegistrationInfo> <Triggers> <LogonTrigger> <Enabled>true</Enabled> <UserId>VOSTRO-5470\Gabriel</UserId> </LogonTrigger> </Triggers> <Principals> <Principal id="Author"> <UserId>S-1-5-21-3616408105-2617412774-1890292899-1001</UserId> <LogonType>InteractiveToken</LogonType> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <Duration>PT10M</Duration> <WaitTimeout>PT1H</WaitTimeout> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT72H</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>"C:\Program Files\VcXsrv\vcxsrv.exe"</Command> <Arguments>:0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl</Arguments> </Exec> </Actions> </Task>

Plus these commands

schtasks /create /TN "VcxSrv" /XML ".\VcxSrv.xml"
schtasks /Run /TN "VcxSrv"


Finally, open the WSL shell and append to ~/.bashrc:

  • For WSLv1: export DISPLAY=:0
  • For WSLv2: export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
Reply all
Reply to author
Forward
0 new messages