TLeconte / acarsdec

ACARS SDR decoder
338 stars 89 forks source link

library not found for -lacars-2 - MacOS #112

Open matta828 opened 1 year ago

matta828 commented 1 year ago

Hi, I have been trying to compile acarsdec on my Mac and I can get past cmake successfully but I encounter the error

[100%] Linking C executable acarsdec
ld: library not found for -lacars-2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [acarsdec] Error 1
make[1]: *** [CMakeFiles/acarsdec.dir/all] Error 2
make: *** [all] Error 2

when using the make command. From here I am stuck and have no idea how to proceed. According to cmake it actually found libacars no problem, here is the log:

cmake .. -Dairspy=ON
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is AppleClang 14.0.3.14030022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /opt/homebrew/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'libacars-2>=2.0.0'
--   Found libacars-2, version 2.2.0
-- Using libacars
-- Not using MQTT
-- Using libsnd
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/horaciomatta/SDR/acarsdec/build

Hopefully someone can help me out with this.

Thanks.

szechyjs commented 10 months ago

I fixed it with the following change...

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33c5f02..afe1fb4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ pkg_check_modules(LIBACARS libacars-2>=2.0.0)
 if(LIBACARS_FOUND)
 message ( STATUS "Using libacars")
 add_definitions(-DHAVE_LIBACARS )
-target_link_libraries(acarsdec ${LIBACARS_LIBRARIES})
+target_link_libraries(acarsdec ${LIBACARS_LINK_LIBRARIES})
 target_include_directories(acarsdec PUBLIC ${LIBACARS_INCLUDE_DIRS})
 link_directories(${LIBACARS_LIBRARY_DIRS})
 else()