Author Topic: Can't add X11 to search directory  (Read 10640 times)

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Can't add X11 to search directory
« on: December 13, 2021, 05:08:35 pm »
Hello

First time user and poster for Code Blocks IDE.

I'm having an issue with X11/Xmu/WinUtil.h in that Code Blocks can't see it and as get the error:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h|43|fatal error: X11/Xmu/WinUtil.h: No such file or directory
when I attempt to build or compile.

Now I've tried adding the /usr/include/X11 folder to the search directory in the build options of the project, but for some reason it can't see it.
And I know I have the X11/Xmu/WinUtil.h header in the /usr/include/ folder from the file explorer

I have attached screenshots of the IDE's directory search and my OS's file explorer as proof of this issue as X11 is one folder Code Blocks can't seem to see.

It would help if I knew what was wrong, or if I'm thinking about the solution in the wrong way.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #1 on: December 13, 2021, 11:42:24 pm »

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #2 on: December 16, 2021, 04:04:27 pm »
I am running Code::Blocks version Code::Blocks 20.03 on Zorin OS 16 Core.
The compiler I use is GNU GCC Compiler
version gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04).

When I import a VS code sample project using a 3rd Party SDK (Ultra App Kit) and added in the needed include folder in the directory search for the 3rd Party SDK everything seems fine.
Until I go to build / Compile where it asks for X11/Xmu/WinUtil.h, which is in the usr/include/ folder on the system.
The header file asking with the line; #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
is part of the 3rd Party SDK, and yes, I ran sudo apt-get install libxmu-dev to make sure it was installed.

Though now that I look at the order of includes in that file something seems a bit weird.
As just above the line with an error is; include <X11/Xlib.h>           // `apt-get install libx11-dev`
so is Code::Blocks not doing a recursive check in the /usr/include/X11 folder?
Or do I need to rebuild a certain file somewhere so the compiler can more easily see it?


Build log:
Code
-------------- Clean: Debug x64 in Testing (compiler: GNU GCC Compiler)---------------

Cleaned "Testing - Debug x64"

-------------- Build: Debug x64 in Testing (compiler: GNU GCC Compiler)---------------

g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/main.cpp" -o Debug/Source/main.o
g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp" -o Debug/Source/UltraEngine.o
In file included from ../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/UltraEngine.h:42,
                 from /home/ryos/Documents/Ultra Engine/Projects/Testing/Source/main.cpp:1:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h:43:18: fatal error: X11/Xmu/WinUtil.h: No such file or directory
   43 |         #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
      |                  ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
 
In file included from ../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/UltraEngine.h:42,
                 from /home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp:1:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h:43:18: fatal error: X11/Xmu/WinUtil.h: No such file or directory
   43 |         #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
      |                  ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))


I've tried to get the IDE to include usr/include/X11 in the search directory list and it can't see the X11 folder in the usr/include/ location.
I have a tried Looking for a VC++ compiler since I am importing a VS code sample project even loading the mingw compiler.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Can't add X11 to search directory
« Reply #3 on: December 16, 2021, 04:19:33 pm »
This part
Code
-I/Include/
is not correct, it should look something similar to this
Code
-I/usr/include

Look in the project's search folders for the error

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #4 on: December 16, 2021, 05:00:10 pm »
I gave that a shot and got the same error.

It is like as I mentioned in the OP, Code::Blocks can not seem to see the X11 folder when doing the directory search, and in the second post noted something weird.

As the file that has the issue is like this:
Code
	....
#include <X11/Xlib.h>           // <-- does Fine
#include <X11/Xmu/WinUtil.h>    // <-- Gives error
#include <X11/Xatom.h>
...

How can X11/Xlib.h be fine, but X11/Xmu/WinUtil.h not be?

Here's the Build Log:
Code
-------------- Clean: Debug x64 in Testing (compiler: GNU GCC Compiler)---------------

Cleaned "Testing - Debug x64"

-------------- Build: Debug x64 in Testing (compiler: GNU GCC Compiler)---------------

g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I/usr/include -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/main.cpp" -o Debug/Source/main.o
g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I/usr/include -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp" -o Debug/Source/UltraEngine.o
In file included from ../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/UltraEngine.h:42,
                 from /home/ryos/Documents/Ultra Engine/Projects/Testing/Source/main.cpp:1:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h:43:18: fatal error: X11/Xmu/WinUtil.h: No such file or directory
   43 |         #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
      |                  ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
In file included from ../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/UltraEngine.h:42,
                 from /home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp:1:
../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include/framework.h:43:18: fatal error: X11/Xmu/WinUtil.h: No such file or directory
   43 |         #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev
      |                  ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Can't add X11 to search directory
« Reply #5 on: December 16, 2021, 05:08:35 pm »
Quote
I've tried adding the /usr/include/X11 folder to the search directory in the build options

Somehow you failed and ended adding /Include/ also (note the uppercase I). The second folder is OK.

Have you installed libxmu-dev? The error says this:

Quote
No such file or directory #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #6 on: December 16, 2021, 05:13:55 pm »
Quote
I've tried adding the /usr/include/X11 folder to the search directory in the build options

Somehow you failed and ended adding /Include/ instead (note also the uppercase I). The second folder is OK.

Have you installed libxmu-dev? The error says this:

Quote
No such file or directory #include <X11/Xmu/WinUtil.h>    // `apt-get install libxmu-dev

The the one after /Include/, is -I/usr/include in the log as I used the GUI to add the /usr/Include directory.
To get what I mean look at Images in the OP to see what I mean about /usr/include/X11, and Code::Blocks not seeing it.

And as I said in the second post, I did run sudo apt-get install libxmu-dev in the terminal to ensure X11/Xmu/WinUtil.h was installed.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #7 on: December 17, 2021, 11:32:19 am »
is X11/Xmu/WinUtil.h in your file system? Have you actually checked id the file is there? only running
Code
apt-get install libxmu-dev
does not ensure that the file is there :)

can you run
Code
tree /usr/include > test.txt
in a shell/bash in your home directory, zip the generated test.txt and post it here?

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #8 on: January 11, 2022, 03:59:07 pm »
Hey

Sorry for the delay, was busy with Christmas and some stuff in the New year
Yes, I checked that the file existed, and it does.

Here is the tree of /usr/include in the test file.


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #9 on: January 11, 2022, 10:02:24 pm »
Linux file system is case sensitive... Are the x in your includes the same case? They should be upper case according your tree output

have you tried to switch order of includes?
Have you checked the access rights to the Xmu folder?

it is not codeblocks that is giving you errors, but gcc...

can you run
Code
c++ -xc++ /dev/null -E -Wp,-v 2>&1 | sed -n 's,^ ,,p'
in your console and post the result here?

This has to be some stupid error, where we all will head bang when it works...
« Last Edit: January 11, 2022, 10:14:41 pm by BlueHazzard »

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #10 on: January 13, 2022, 07:19:06 pm »
....

This has to be some stupid error, where we all will head bang when it works...

Your not the only one that thinks this, or this is a strong beer bug.
Gotta keep a sense of humour with annoying programming issues.

I've dumped the results of the terminal into files attached to post.
One covering compiler the other the permissions of the X11 folder in /usr/include


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #11 on: January 13, 2022, 09:21:25 pm »
Looking at your files, confirms that "/usr/include" is in the default search path, so #including <X11/Xmu/WinUtil.h> should result in /usr/include/X11/Xmu/WinUtil.h

Ok ,i am somehow out of ideas:

I tried to reproduce your problem, the steps i did:
1) Set up fresh linux Mint
2)
Code
sudo apt-get install libx11-dev
3)
Code
sudo apt-get install libxmu-dev
4) Open codeblocks, create a c++ console project
5) paste
Code
#include <X11/Xmu/WinUtil.h>    // <-- Gives error
#include <X11/Xatom.h>
#include <X11/Xlib.h>           // <-- does Fine
6) Hit compile

everything compiles fine...

i also added your include directories (beside the steam things) and still everything worked fine...

have you tried to call in your project folder
Code
g++ -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I/usr/include -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp" -o Debug/Source/UltraEngine.o
directly in console and look at the output?

Also you can try to call (note the added -v -E)
Code
g++ -v -E -lX11 -Wall -g -O0 -D_ULTRA_APPKIT -D_DEBUG -I/Include/ -I/usr/include -I"../../../../.steam/debian-installation/steamapps/common/Ultra App Kit/Include" -c "/home/ryos/Documents/Ultra Engine/Projects/Testing/Source/UltraEngine.cpp" -o Debug/Source/UltraEngine.o
and look at the include directories if you can find something

Are you running in a linux on windows system, or native linux system?


Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #12 on: January 14, 2022, 04:51:44 pm »
I tested with a NEW console project (Hello world) on my ZorinOS 16 Core Virtual Machine

only adding /usr/include in the search directories for Code::Blocks

and it fails on X11/Xmu/WinUtil.h

it sees other directories in the X11, but not the Xmu directory.
As I decided to manually re-type the include statement and the auto-fill did not list X11/Xmu
as I did not find it between Xmd.h and Xos.h

Yeah, this is a rare head scratcher of a problem.

--

Is there a way to get the IDE to run as Root, to test if it is a permission issue of some sort, or some other issue?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #13 on: January 14, 2022, 04:56:07 pm »
Is there a way to get the IDE to run as Root, to test if it is a permission issue of some sort, or some other issue?

simply run codeblocks with "sudo codeblocks".

but then all created files will be owned by root.

Have you tried the commands i wrote? you can try them with root too.

Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #14 on: January 14, 2022, 05:48:31 pm »
I've run those commands (sudo) when setting up codeblocks and even used Synaptic package manager to re-install them encase something was corrupted.

And I can't run CodeBlocks as sudo in the terminal
Code
ryos@ZorinVM:~$ sudo codeblocks
sudo: codeblocks: command not found

Seems I must have a different version of code-blocks installed.

I'll try using the one from the Zorin repo using
Code
sudo apt-get install codeblocks
and the console project works now.

So their is an Issue with one from the software centre, Version: 20.03, Updated: 2021-12-06,  sourced from dl.flathub.org.
While the apt-get one works.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #15 on: January 14, 2022, 06:46:24 pm »
Quote
dl.flathub.org.
Is this a flatpak installation? So this could  be IS the reason... Flatpack and codeblocks do not like each other, because flatpack applications run in a sandbox and do not have access to system resources, where libraries and header are... This is the reason for your problems...


Offline AzureZero

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Can't add X11 to search directory
« Reply #16 on: January 17, 2022, 08:14:17 pm »
Yeah I found that out after the terminal didn't see Codeblocks as a program.

Thanks for helping me through this as I would not of expected it to be an issue of the software centre choosing a flatpak installation which has issues.

It might be a good idea to pin that Flatpak installs will likely have issues, and that installation should be done via the terminal and not the software centre as the software centre may only install flatpak versions when a non-flatpak version is available via the terminal.
It should also help lessen the chance of this problem coming up again and causing two or more people to bang their head against a coding wall. Well one sign of the issue for checking is if headers in the usr/include folder can't be found, it likely is a flatpak installation issue.

Maybe a pinned FAQ of problems could help folks find some of the rare problems and it's solution.

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Can't add X11 to search directory
« Reply #17 on: January 17, 2022, 09:22:59 pm »
On the other hand, whoever is building the flatpak could simply update the permissions to allow access to the host filesystem, depending on security requirements read-only to (almost) everything and write-access only to the home directory.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Can't add X11 to search directory
« Reply #18 on: January 18, 2022, 01:15:52 am »
We are not the maintainer for the flat pack distribution, we even didn't knew this exists.
Some time ago a user asked if he could distribute the flat pack and one of our devs said, that this is not a good idea, because of the file access rights (like you experienced)...
At this time i looked at this and it was not possible to add only read permission, or at least i did not find it...

On the other hand, whoever is building the flatpak could simply update the permissions to allow access to the host filesystem, depending on security requirements read-only to (almost) everything and write-access only to the home directory.
So you say, this is now possible?
It would be great to have some flatpack codeblocks... Will have to look into it....

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Can't add X11 to search directory
« Reply #19 on: January 18, 2022, 05:41:48 pm »
I have only quite limited Flatpak experience, for the single application i'm building for Flatpak i didn't need to read the footnotes. I'm afraid for CodeBlocks the footnotes do apply: Sandbox Permissions. So on second thought, looks like it's kind of impossible to create a general purpose CodeBlocks Flatpak, due to the path conflicts you need major adaptions of the project to access libraries of the host. Sorry for the misinformation.

However, a possible Flatpak scenario could be to create very specific distributions that contain all required libraries for a specific use case. This way you don't have to pollute the host with such libraries, you could use fixed versions different from the host and the user doesn't need to setup his system to use them. Looking at you, school teachers and the like ;).