Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't build on clang due to --no-gnu-unique #279

Open
rozbrajaczpoziomow opened this issue Jan 19, 2025 · 4 comments
Open

Doesn't build on clang due to --no-gnu-unique #279

rozbrajaczpoziomow opened this issue Jan 19, 2025 · 4 comments

Comments

@rozbrajaczpoziomow
Copy link

$ hyprpm add https://github.com/hyprwm/hyprland-plugins -v
[v] running version returned: Hyprland 0.46.0 built from branch main at commit 4da9b7cc5b50c346309378fbb5ae8aa07746fd33  (Author: Tom Englund <[email protected]>).
Date: @DATE@
Tag: v0.46.0-131-g4da9b7cc, commits: 5686
built against:
 aquamarine 0.7.1
 hyprlang 0.6.0
 hyprutils 0.3.3
 hyprcursor 0.1.11
 hyprgraphics 0.1.1


no flags were set


[v] parsed commit 4da9b7cc5b50c346309378fbb5ae8aa07746fd33 at branch main on @DATE@, commits 5686
✔ adding a new plugin repository from https://github.com/hyprwm/hyprland-plugins
  MAKE SURE that you trust the authors. DO NOT install random plugins without verifying the code and author.
  Are you sure? [Y/n]

→ Cloning https://github.com/hyprwm/hyprland-plugins
✔ cloned
✔ found hyprpm manifest
✔ parsed manifest, found 7 plugins:
→ borders-plus-plus by Vaxry version
→ csgo-vulkan-fix by Vaxry version
→ hyprbars by Vaxry version
→ hyprexpo by Vaxry version
→ hyprtrails by Vaxry version
→ hyprwinwrap by Vaxry version
→ xtra-dispatchers by Vaxry version
→ Manifest has 25 pins, checking
 ━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  2 / 5  Verifying headers[v] installed version returned: Hyprland 0.46.0 built from branch main at commit 4da9b7cc5b50c346309378fbb5ae8aa07746fd33  (Author: Tom Englund <[email protected]>).
Date: @DATE@
Tag: v0.46.0-131-g4da9b7cc, commits: 5686
built against:
 aquamarine 0.7.1
 hyprlang 0.6.0
 hyprutils 0.3.3
 hyprcursor 0.1.11
 hyprgraphics 0.1.1


no flags were set


[v] parsed commit 4da9b7cc5b50c346309378fbb5ae8aa07746fd33 at branch main on @DATE@, commits 5686
✔ Hyprland headers OK
→ Building borders-plus-plus
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━  3 / 5  Building plugin(s)[v] shell returned:  -> cd /run/user/1000/hyprpm/roz && PKG_CONFIG_PATH="/home/roz/.local/share/hyprpm/headersRoot/share/pkgconfig" make -C borders-plus-plus all
make: Entering directory '/run/user/1000/hyprpm/roz/borders-plus-plus'
c++ -shared -fPIC --no-gnu-unique main.cpp borderDeco.cpp BorderppPassElement.cpp -o borders-plus-plus.so -g `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` -std=c++2b -O2
c++: error: unknown argument: '--no-gnu-unique'
make: *** [Makefile:2: all] Error 1
make: Leaving directory '/run/user/1000/hyprpm/roz/borders-plus-plus'


✖ Plugin borders-plus-plus failed to build.
  This likely means that the plugin is either outdated, not yet available for your version, or broken.
  If you are on -git, update first
  Try re-running with -v to see more verbose output.

→ Building csgo-vulkan-fix
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━  3 / 5  Building plugin(s)[v] shell returned:  -> cd /run/user/1000/hyprpm/roz && PKG_CONFIG_PATH="/home/roz/.local/share/hyprpm/headersRoot/share/pkgconfig" make -C csgo-vulkan-fix all
make: Entering directory '/run/user/1000/hyprpm/roz/csgo-vulkan-fix'
c++ -shared -fPIC --no-gnu-unique main.cpp -o csgo-vulkan-fix.so -g `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` -std=c++2b -O2
c++: error: unknown argument: '--no-gnu-unique'
make: *** [Makefile:2: all] Error 1
make: Leaving directory '/run/user/1000/hyprpm/roz/csgo-vulkan-fix'


✖ Plugin csgo-vulkan-fix failed to build.
  This likely means that the plugin is either outdated, not yet available for your version, or broken.
  If you are on -git, update first
  Try re-running with -v to see more verbose output.

→ Building hyprbars
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━  3 / 5  Building plugin(s)[v] shell returned:  -> cd /run/user/1000/hyprpm/roz && PKG_CONFIG_PATH="/home/roz/.local/share/hyprpm/headersRoot/share/pkgconfig" make -C hyprbars all
make: Entering directory '/run/user/1000/hyprpm/roz/hyprbars'
c++ -shared -fPIC --no-gnu-unique -g -std=c++2b -Wno-c++11-narrowing `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` main.cpp barDeco.cpp BarPassElement.cpp  -o hyprbars.so `pkg-config --libs pangocairo` -O2
c++: error: unknown argument: '--no-gnu-unique'
make: *** [Makefile:11: hyprbars.so] Error 1
make: Leaving directory '/run/user/1000/hyprpm/roz/hyprbars'


✖ Plugin hyprbars failed to build.
  This likely means that the plugin is either outdated, not yet available for your version, or broken.
  If you are on -git, update first
  Try re-running with -v to see more verbose output.

→ Building hyprexpo
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━  3 / 5  Building plugin(s)[v] shell returned:  -> cd /run/user/1000/hyprpm/roz && PKG_CONFIG_PATH="/home/roz/.local/share/hyprpm/headersRoot/share/pkgconfig" make -C hyprexpo all
make: Entering directory '/run/user/1000/hyprpm/roz/hyprexpo'
c++ -shared -fPIC --no-gnu-unique main.cpp overview.cpp OverviewPassElement.cpp -o hyprexpo.so -g `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` -std=c++2b -Wno-narrowing
c++: error: unknown argument: '--no-gnu-unique'
make: *** [Makefile:2: all] Error 1
make: Leaving directory '/run/user/1000/hyprpm/roz/hyprexpo'


✖ Plugin hyprexpo failed to build.
  This likely means that the plugin is either outdated, not yet available for your version, or broken.
  If you are on -git, update first
  Try re-running with -v to see more verbose output.

→ Building hyprtrails
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━  3 / 5  Building plugin(s)[v] shell returned:  -> cd /run/user/1000/hyprpm/roz && PKG_CONFIG_PATH="/home/roz/.local/share/hyprpm/headersRoot/share/pkgconfig" make -C hyprtrails all
make: Entering directory '/run/user/1000/hyprpm/roz/hyprtrails'
c++ -shared -fPIC --no-gnu-unique main.cpp trail.cpp TrailPassElement.cpp -o hyprtrails.so -g `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` -std=c++2b -O2
c++: error: unknown argument: '--no-gnu-unique'
make: *** [Makefile:2: all] Error 1
make: Leaving directory '/run/user/1000/hyprpm/roz/hyprtrails'


✖ Plugin hyprtrails failed to build.
  This likely means that the plugin is either outdated, not yet available for your version, or broken.
  If you are on -git, update first
  Try re-running with -v to see more verbose output.

→ Building hyprwinwrap
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━  3 / 5  Building plugin(s)[v] shell returned:  -> cd /run/user/1000/hyprpm/roz && PKG_CONFIG_PATH="/home/roz/.local/share/hyprpm/headersRoot/share/pkgconfig" make -C hyprwinwrap all
make: Entering directory '/run/user/1000/hyprpm/roz/hyprwinwrap'
c++ -shared -fPIC --no-gnu-unique main.cpp -o hyprwinwrap.so -g `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` -std=c++2b -O2
c++: error: unknown argument: '--no-gnu-unique'
make: *** [Makefile:2: all] Error 1
make: Leaving directory '/run/user/1000/hyprpm/roz/hyprwinwrap'


✖ Plugin hyprwinwrap failed to build.
  This likely means that the plugin is either outdated, not yet available for your version, or broken.
  If you are on -git, update first
  Try re-running with -v to see more verbose output.

→ Building xtra-dispatchers
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━  3 / 5  Building plugin(s)[v] shell returned:  -> cd /run/user/1000/hyprpm/roz && PKG_CONFIG_PATH="/home/roz/.local/share/hyprpm/headersRoot/share/pkgconfig" make -C xtra-dispatchers all
make: Entering directory '/run/user/1000/hyprpm/roz/xtra-dispatchers'
c++ -shared -fPIC --no-gnu-unique main.cpp -o xtra-dispatchers.so -g `pkg-config --cflags pixman-1 libdrm hyprland pangocairo libinput libudev wayland-server xkbcommon` -std=c++2b -O2
c++: error: unknown argument: '--no-gnu-unique'
make: *** [Makefile:2: all] Error 1
make: Leaving directory '/run/user/1000/hyprpm/roz/xtra-dispatchers'


✖ Plugin xtra-dispatchers failed to build.
  This likely means that the plugin is either outdated, not yet available for your version, or broken.
  If you are on -git, update first
  Try re-running with -v to see more verbose output.

✔ all plugins built
✔ installed repository
✔ you can now enable the plugin(s) with hyprpm enable
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  5 / 5  Done!

clang version:

$ c++ -v
Debian clang version 19.1.7 (1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14
Candidate multilib: .;@m64
Selected multilib: .;@m64

Building with g++ instead of clang works, and removing --no-gnu-unique and then building with clang seems to work for the most part, though that build flag is probably there for a reason.

@rozbrajaczpoziomow rozbrajaczpoziomow changed the title Plugins don't build on clang due to --no-gnu-unique Doesn't build on clang due to --no-gnu-unique Jan 19, 2025
@vaxerski
Copy link
Member

does clang have an analogous option or does it just not create unique?

@rozbrajaczpoziomow
Copy link
Author

best I could guess is -fcommon/-fno-common (doc)

-fcommon, -fno-common

Place definitions of variables with no storage class and no initializer (tentative definitions) in a common block, instead of generating individual zero-initialized definitions (default -fno-common).

but fwiw just compiling without --no-gnu-unique (with or without -fcommon/-fno-common) only errors out on hyprtrails with:

/usr/local/include/hyprland/src/plugins/PluginAPI.hpp:156:15: note: 'unregisterCallback' has been explicitly marked deprecated here
  156 |     APICALL [[deprecated]] bool unregisterCallback(HANDLE handle, SP<HOOK_CALLBACK_FN> fn);
      |               ^
trail.cpp:249:29: error: non-constant-expression cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing]
  249 |     box thisboxopengl = box{(PWINDOW->m_vRealPosition->value().x - pMonitor->vecPosition.x) / pMonitor->vecSize.x,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trail.cpp:249:29: note: insert an explicit cast to silence this issue
  249 |     box thisboxopengl = box{(PWINDOW->m_vRealPosition->value().x - pMonitor->vecPosition.x) / pMonitor->vecSize.x,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             static_cast<float>(                                                                  )
trail.cpp:250:29: error: non-constant-expression cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing]
  250 |                             (PWINDOW->m_vRealPosition->value().y - pMonitor->vecPosition.y) / pMonitor->vecSize.y,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trail.cpp:250:29: note: insert an explicit cast to silence this issue
  250 |                             (PWINDOW->m_vRealPosition->value().y - pMonitor->vecPosition.y) / pMonitor->vecSize.y,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             static_cast<float>(                                                                  )
trail.cpp:251:29: error: non-constant-expression cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing]
  251 |                             (PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x) / pMonitor->vecSize.x,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trail.cpp:251:29: note: insert an explicit cast to silence this issue
  251 |                             (PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x) / pMonitor->vecSize.x,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             static_cast<float>(                                                                          )
trail.cpp:252:29: error: non-constant-expression cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing]
  252 |                             (PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y) / pMonitor->vecSize.y};
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trail.cpp:252:29: note: insert an explicit cast to silence this issue
  252 |                             (PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y) / pMonitor->vecSize.y};
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             static_cast<float>(                                                                          )
trail.cpp:339:16: error: non-constant-expression cannot be narrowed from type 'int' to 'double' in initializer list [-Wc++11-narrowing]
  339 |     CBox dm = {(int)(m_vLastWindowPos.x - m_seExtents.topLeft.x), (int)(m_vLastWindowPos.y - m_seExtents.topLeft.y),
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trail.cpp:339:16: note: insert an explicit cast to silence this issue
  339 |     CBox dm = {(int)(m_vLastWindowPos.x - m_seExtents.topLeft.x), (int)(m_vLastWindowPos.y - m_seExtents.topLeft.y),
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                static_cast<double>(                             )
trail.cpp:339:67: error: non-constant-expression cannot be narrowed from type 'int' to 'double' in initializer list [-Wc++11-narrowing]
  339 |     CBox dm = {(int)(m_vLastWindowPos.x - m_seExtents.topLeft.x), (int)(m_vLastWindowPos.y - m_seExtents.topLeft.y),
      |                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trail.cpp:339:67: note: insert an explicit cast to silence this issue
  339 |     CBox dm = {(int)(m_vLastWindowPos.x - m_seExtents.topLeft.x), (int)(m_vLastWindowPos.y - m_seExtents.topLeft.y),
      |                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                   static_cast<double>(                             )
trail.cpp:340:16: error: non-constant-expression cannot be narrowed from type 'int' to 'double' in initializer list [-Wc++11-narrowing]
  340 |                (int)(m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x), (int)m_seExtents.topLeft.y};
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trail.cpp:340:16: note: insert an explicit cast to silence this issue
  340 |                (int)(m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x), (int)m_seExtents.topLeft.y};
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                static_cast<double>(                                                          )
trail.cpp:340:96: error: non-constant-expression cannot be narrowed from type 'int' to 'double' in initializer list [-Wc++11-narrowing]
  340 |                (int)(m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x), (int)m_seExtents.topLeft.y};
      |                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
trail.cpp:340:96: note: insert an explicit cast to silence this issue
  340 |                (int)(m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x), (int)m_seExtents.topLeft.y};
      |                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                static_cast<double>(      )
1 warning and 8 errors generated.
make: *** [Makefile:2: all] Error 1

which seems fixable enough, with everything else just being warnings (full build log)

@vaxerski
Copy link
Member

no-gnu-unique fixes a problem where this happens:

  • you build plugin to a.so
  • hyprland loads plugin a.so
  • hyprland unloads plugin a.so
  • you make changes and rebuild a.so
  • hyprland loads plugin a.so
  • your changes are not visible, because old a.so is kind of "resurrected"

@vaxerski
Copy link
Member

regarding the build error yeah feel free to make a MR I dont use clang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants