Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#56128 closed defect (worksforme)

qmake5 PortGroup does not respect configure.ldflags

Reported by: mojca (Mojca Miklavec) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: RJVB (René Bertin)
Port:

Description

C++11 software using the qmake5 PortGroup does not build correctly because LDFLAGS are not passed to the compiler.

Is there any special reason why they are ignored?

Change History (4)

comment:1 Changed 6 years ago by mojca (Mojca Miklavec)

In e356e9b44d2787a65bd37c7ad1276488be9b66ba/macports-ports:

kchmviewer: fix build, respect LDFLAGS

  • Create configure.dir for an out-of-source build
  • Respect LDFLAGS

See: #56128
Closes: #56107

comment:2 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Sorry for not getting to this earlier.

The reason that the qmake5 PortGroup does not respect configure.ldflags is because qmake is its own build ecosystem.
The default values of configure.ldflags are -L/opt/local/lib and -Wl,-headerpad_max_install_names.
-headerpad_max_install_names is added to QMAKE_LFLAGS by using QMAKE_LFLAGS_HEADERPAD.
-L/opt/local/lib is supposed to be redundant as well.
The qmake way of adding a library is LIBS or PKGCONFIG.
There might be a case to be made for adding LIBS += -L${prefix}/lib, in the .qmake.cache file.
However, I would argue that this is unnecessary since qmake respects the LIBRARY_PATH=${prefix}/lib environmental variable set by MacPorts.

Removing qt5.ldflags ${configure.ldflags} in kchmviewer allowed the port to build without problems for me.
It also built correctly without removing
LIBS += -lchm -lzip
and replacing it with
LIBS += @PREFIX@/lib/libchm.$$QMAKE_EXTENSION_SHLIB @PREFIX@/lib/libzip.$$QMAKE_EXTENSION_SHLIB.
I am not sure if there are other reasons why these patches are needed.

comment:3 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: worksforme
Status: newclosed

I have opened a pull request for kchmviewer.
Please reopen if I have misunderstood the situation.

comment:4 Changed 6 years ago by Marcus Calhoun-Lopez <marcuscalhounlopez@…>

In 963baa28c8d59e9be1aa16dd6bf6f7752bc87c27/macports-ports (master):

kchmviewer: remove unnecessary code

See #56128

Note: See TracTickets for help on using tickets.