On Sunday, March 17, 2024 at 3:09:57 PM UTC-7 Albrecht-S wrote:
Very likely, I see pretty much chaos and inconsistent code in this
area. :-(
I started working on this but it will take some time - definitely
not today.
No worries. I have my workarounds and am happy to be patient to remove them once it gets settled. It looks like this may be the tip of a larger iceberg in certain ways.
For now I have a short request to test: can you please comment out
(or delete) the 3 lines of code in src/CMakeLists.txt that set the
'-no-pie' flag in the FLTK code and try again w/o the assignment?
767 if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND NOT FLTK_BUILD_SHARED_LIBS)
768 list(APPEND OPTIONAL_LIBS "-no-pie")
769 endif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND NOT FLTK_BUILD_SHARED_LIBS)
Removing these lines works exactly as you would expect. Everything else is the same, the '-no-pie' does not come through to my application, everything works.
I believe that we can remove that '-no-pie' entirely but I'm still
investigating why it was introduced in the first place. The
condition used for the assignment (... AND NOT
FLTK_BUILD_SHARED_LIBS) is wrong anyway in this context.
Alternatively (or additionally) you could try changing the two lines
that assign OPTIONAL_LIBS as PUBLIC to PRIVATE:
775 target_link_libraries(fltk PUBLIC ${OPTIONAL_LIBS})
831 target_link_libraries(fltk-shared PUBLIC ${OPTIONAL_LIBS})
s/PUBLIC/PRIVATE/
I made this change as well, when I did so, the INTERFACE_LINK_LIBRARIES target property changed from:
/usr/lib64/libdl.a/usr/lib64/libX11.so/usr/lib64/libXext.so/usr/lib64/libXinerama.so/usr/lib64/libXfixes.so/usr/lib64/libXcursor.so/usr/lib64/libXrender.so/usr/lib64/libpango-1.0.so/usr/lib64/libpangocairo-1.0.so/usr/lib64/libcairo.so/usr/lib64/libgobject-2.0.so/usr/lib64/libpangoxft-1.0.so/usr/lib64/libXft.so/usr/lib64/libfontconfig.so-lwayland-egl -lEGL-L/usr/lib64-lgtk-3-lgdk-3-lpangocairo-1.0-lpango-1.0-lharfbuzz-latk-1.0-lcairo-gobject-lcairo-lgdk_pixbuf-2.0-lgio-2.0-lgobject-2.0-lglib-2.0-lwayland-cursor -lwayland-client -lxkbcommon -ldl-L/usr/lib64-ldbus-1-no-pie
To:
/usr/lib64/libdl.a/usr/lib64/libX11.so/usr/lib64/libXext.so/usr/lib64/libXinerama.so/usr/lib64/libXfixes.so/usr/lib64/libXcursor.so/usr/lib64/libXrender.so/usr/lib64/libpango-1.0.so/usr/lib64/libpangocairo-1.0.so/usr/lib64/libcairo.so/usr/lib64/libgobject-2.0.so/usr/lib64/libpangoxft-1.0.so/usr/lib64/libXft.so/usr/lib64/libfontconfig.so-lwayland-egl -lEGL-L/usr/lib64$<LINK_ONLY:-lgtk-3>$<LINK_ONLY:-lgdk-3>$<LINK_ONLY:-lpangocairo-1.0>$<LINK_ONLY:-lpango-1.0>$<LINK_ONLY:-lharfbuzz>$<LINK_ONLY:-latk-1.0>$<LINK_ONLY:-lcairo-gobject>$<LINK_ONLY:-lcairo>$<LINK_ONLY:-lgdk_pixbuf-2.0>$<LINK_ONLY:-lgio-2.0>$<LINK_ONLY:-lgobject-2.0>$<LINK_ONLY:-lglib-2.0>-lwayland-cursor -lwayland-client -lxkbcommon -ldl-L/usr/lib64$<LINK_ONLY:-ldbus-1>
Of course the '-no-pie' is gone from removing the first lines.
However, the change from PUBLIC to PRIVATE added the $<LINK_ONLY:foo> wrapper around a bunch of the list items. This still worked in the end, but I am not sure if this is what is expected / intended.
For fun, I restored the first three lines, but kept the change to PRIVATE. The result of this is as follows:
/usr/lib64/libdl.a/usr/lib64/libX11.so/usr/lib64/libXext.so/usr/lib64/libXinerama.so/usr/lib64/libXfixes.so/usr/lib64/libXcursor.so/usr/lib64/libXrender.so/usr/lib64/libpango-1.0.so/usr/lib64/libpangocairo-1.0.so/usr/lib64/libcairo.so/usr/lib64/libgobject-2.0.so/usr/lib64/libpangoxft-1.0.so/usr/lib64/libXft.so/usr/lib64/libfontconfig.so-lwayland-egl -lEGL-L/usr/lib64$<LINK_ONLY:-lgtk-3>$<LINK_ONLY:-lgdk-3>$<LINK_ONLY:-lpangocairo-1.0>$<LINK_ONLY:-lpango-1.0>$<LINK_ONLY:-lharfbuzz>$<LINK_ONLY:-latk-1.0>$<LINK_ONLY:-lcairo-gobject>$<LINK_ONLY:-lcairo>$<LINK_ONLY:-lgdk_pixbuf-2.0>$<LINK_ONLY:-lgio-2.0>$<LINK_ONLY:-lgobject-2.0>$<LINK_ONLY:-lglib-2.0>-lwayland-cursor -lwayland-client -lxkbcommon -ldl-L/usr/lib64$<LINK_ONLY:-ldbus-1>$<LINK_ONLY:-no-pie>
So, the change to PRIVATE does not keep the -no-pie from coming through. The subsequent build failed. So, the PRIVATE marker is not having the effect I would have expected it to.
I'd appreciate if you could test and report back, but there's no
need to hurry. I won't be able to work on it today, I need some
sleep. If you could do it in your TZ's "today" so I could find it
here tomorrow that would be great. TIA
PS: I'm also investigating an option like "DISABLE_GLU" to solve
your other issue but I'll reply to the other thread tomorrow.
Thanks for all the help,
Rob