Linking with jack using qmake

238 Views Asked by At

I have two similar projects on the same machine. Their difference is that one is using GUI (Qt and Qwt) and the other is not. As the result, the one that has Qt is using qmake to compile and the other one cmake.

The project itself is about signal processing and working with audio. I decided to use RtAudio for capturing audio signal. I can compile and run the example code fine when I'm compiling with cmake but when I try to compile the other project using qmake, it fails.

The problem is jack (audio library) which is not found when compiling using qmake. But first, let's start with the project that works. Here's what I have in my CMakeLists.txt file:

cmake_minimum_required(VERSION 3.18)
project(cli_test)

set(CMAKE_CXX_STANDARD 17)

add_executable(cli_test main.cpp)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(arecord PRIVATE Threads::Threads)
target_link_libraries(arecord PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/fftw/lib/libfftw3.a)


include_directories(./rtaudio/include/rtaudio)

#list(GET LIB_TARGETS 0 LIBRTAUDIO)

set(LINKLIBS)
list(APPEND LINKLIBS ${ALSA_LIBRARY})
list(APPEND INCDIRS ${ALSA_INCLUDE_DIR})

target_link_libraries(cli_test ${CMAKE_CURRENT_SOURCE_DIR}/rtaudio/lib/librtaudio.a ${LINKLIBS})
target_link_libraries(cli_test PRIVATE Threads::Threads)
target_link_libraries(cli_test PRIVATE jack)
target_link_libraries(cli_test PRIVATE /usr/lib/libasound.so)
target_link_libraries(cli_test PRIVATE /usr/lib/libpulse.so)
target_link_libraries(cli_test PRIVATE /usr/lib/libpulse-simple.so)

(which again, works just fine). Then I got this one for qwt_test.pro:

CONFIG += c++1z c++14
INCLUDEPATH += .
INCLUDEPATH += $${PWD}/rtaudio/include/rtaudio

LIBS += $${PWD}/fftw/lib/libfftw3.a
LIBS += $${PWD}/rtaudio/lib/librtaudio.a
LIBS += jack
LIBS += /usr/lib/libasound.so
LIBS += /usr/lib/libpulse.so
LIBS += /usr/lib/libpulse-simple.so

TARGET       = qwt_test

SOURCES = \
    main.cpp

The error that I get is:

linking ../bin/qwt_test
/usr/bin/ld: cannot find jack: No such file or directory
collect2: error: ld returned 1 exit status

My question is, how can I link my project that is using qmake with jack?

1

There are 1 best solutions below

0
On BEST ANSWER

To let qmake know where to find the lib please add

LIBS += -L"where-you-have-jack-lib" -ljack