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

Statically link our code #99

Closed
wants to merge 8 commits into from
Closed

Statically link our code #99

wants to merge 8 commits into from

Conversation

AriaMoradi
Copy link
Contributor

@AriaMoradi AriaMoradi commented Nov 29, 2020

Closes #98

Might fail for the 'deb' target. I'm not sure...

Since this is mostly a search-and-replace job, things should not break, though it might break some install scripts...

@AriaMoradi AriaMoradi requested review from pktiuk and gombosg and removed request for pktiuk November 29, 2020 22:17
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@gombosg
Copy link
Collaborator

gombosg commented Nov 29, 2020

See my comment at the corresponding bug.

@AriaMoradi
Copy link
Contributor Author

So, building without a shared object was successful but for some reason I had to add X11::xcb manually because the linker was complaining about it, but the linker didn't ask for it before..

@AriaMoradi AriaMoradi changed the title library: rename and remove version number Statically link our code Nov 30, 2020
@AriaMoradi
Copy link
Contributor Author

and now CI build is failing because It doesn't have xcb!
Well I'm confused.

if you ask me we always did need it, it's included in qglobalshortcut.cc!
And I'm more confused.

Copy link
Collaborator

@gombosg gombosg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, builds and runs though the pipeline has to be fixed before a merge.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated


add_executable(antimicrox ${antimicrox_MAIN})
target_link_libraries (antimicrox antilib Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::Concurrent)
target_link_libraries(antimicrox Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::Concurrent ${LIBS})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's ${SDL_LIBRARY}? Maybe that contained xcb?

Copy link
Contributor Author

@AriaMoradi AriaMoradi Nov 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg_check_modules(XXX REQUIRED yyy) provides XXX_LIBRARIES which in the case is SDL2_LIBRARIES

this is a oddity in the ways we find libraries.
we could just use find_package(SDL2 REQUIRED) which provides SDL_LIBRARIES and SDL_LIBRARY(they are the same).

So i think in a previous version we used find_package but later it was changed to pkg_check_modules but they forgot to remove the variable.(I can't think of any reasons other than older cmake versions behaving differently)

anyways, I could refactor further and bring back find_package?

ref: https://cmake.org/cmake/help/latest/module/FindSDL.html
ref: https://cmake.org/cmake/help/latest/module/FindPkgConfig.html

Copy link
Contributor Author

@AriaMoradi AriaMoradi Nov 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and before my changes it was empty(not set) so removing it wont change anything.

@gombosg
Copy link
Collaborator

gombosg commented Nov 30, 2020

Sorry, I found SDL at an earlier append_libs. (Then why was it duplicated before?)

endif()

add_library( antilib
SHARED
Copy link
Collaborator

@gombosg gombosg Nov 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a suspicion that xcb linking was not needed because this used to be compiled as a shared library, it was only linked dynamically, and xcb is a requirement for qt so it's available at runtime. @pktiuk is this a wild guess?

Copy link
Contributor Author

@AriaMoradi AriaMoradi Nov 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We directly need xcb because some functions fro xcb/xcb.h where used.
And these are not a part of qt in any ways possible..

@AriaMoradi AriaMoradi requested a review from gombosg November 30, 2020 11:08
@gombosg
Copy link
Collaborator

gombosg commented Nov 30, 2020

It's nice, but we need green ✔️ to merge. So that problem needs to be sorted out first somehow.

@AriaMoradi
Copy link
Contributor Author

AriaMoradi commented Nov 30, 2020

It's nice, but we need green to merge. So that problem needs to be sorted out first somehow.

another pull request should add xcb to the build script

@AriaMoradi
Copy link
Contributor Author

AriaMoradi commented Nov 30, 2020

another pull request should add xcb to the build script

I've tried various settings and configs but I cant get github actions to build on my fork

[100%] Building CXX object CMakeFiles/antimicrox.dir/qrc_resources.cpp.o
[100%] Linking CXX executable bin/antimicrox
/usr/bin/ld: CMakeFiles/antimicrox.dir/src/qglobalshortcut/qglobalshortcut.cc.o: undefined reference to symbol 'xcb_grab_key'
//usr/lib/x86_64-linux-gnu/libxcb.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [bin/antimicrox] Error 1
CMakeFiles/antimicrox.dir/build.make:4374: recipe for target 'bin/antimicrox' failed
CMakeFiles/Makefile2:153: recipe for target 'CMakeFiles/antimicrox.dir/all' failed
Makefile:168: recipe for target 'all' failed
make[1]: *** [CMakeFiles/antimicrox.dir/all] Error 2
make: *** [all] Error 2

I suspect that I'm not installing the currect packages.

I added two lines to inspect the X11_xcb_LIB variable, on my system it has a value:

-- Found X11 Xkb: /usr/lib/libxkbfile.so
-- Found X11 Xkb: /usr/lib/libxcb.so

but under ubuntu

-- Found X11 Xkb: /usr/lib/x86_64-linux-gnu/libxkbfile.so
-- Found X11 Xkb: 

@AriaMoradi
Copy link
Contributor Author

I've verified that /usr/lib/x86_64-linux-gnu/libxcb.so.1 exists on the gh actions vm but cmake wont find it?

@gombosg
Copy link
Collaborator

gombosg commented Nov 30, 2020

@pktiuk save us! :D

@AriaMoradi
Copy link
Contributor Author

@pktiuk save us! :D

He might not be available for the time being, we have to figure this ourselfs.
Well I tried over a dozen of configs and possible solutions on my fork and non worked.
I'll try debugging cmake later.

@AriaMoradi
Copy link
Contributor Author

@gombosg can you build my PR on your end?

@pktiuk
Copy link
Member

pktiuk commented Nov 30, 2020

I won't be able to look at this during this week, but I think this change can (and should) just wait.
It isn't any bugfix or feature and it is invisible change for end-users.

@gombosg gombosg mentioned this pull request Dec 1, 2020
2 tasks
@gombosg gombosg mentioned this pull request Dec 1, 2020
2 tasks
@gombosg gombosg mentioned this pull request Dec 1, 2020
@gombosg
Copy link
Collaborator

gombosg commented Dec 1, 2020

I spent way too much time on this already. I have no clue what's going on. Tried linking against X11_xcb, XCB, X11_X11_xcb etc.
Only X11_xcb === X11::xcb is good, but it doesn't run on the VM.

Tried updating to ubuntu-20.04, tried adding xcb libxcb1-dev to installed packages, they didn't help.

I even checked the pkgconfig files on Ubuntu repos and my machine and they are the same. So I give up.

Next step is removing qglobalshortcuts in a separate PR.

#106

@pktiuk
Copy link
Member

pktiuk commented Dec 2, 2020

Sorry you had to wait for me, but yesterday I had an exam and today I was preparing for the next tomorrow xD

I have dealt with this problem in another PR #107

This one can be closed.

@pktiuk pktiuk closed this in #107 Dec 2, 2020
@AriaMoradi AriaMoradi deleted the so_rename branch December 2, 2020 15:25
Gallxz pushed a commit to Gallxz/antimicrox that referenced this pull request Oct 12, 2023
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

Successfully merging this pull request may close these issues.

Remove antilib shared object because it's not really shared!
3 participants