Reputation: 163
I am trying to use id3lib
in my project to get audio meta data, for now I just have this one line inside my project that use id3lib
I did #include <id3/tag.h>
and then somewhere in project I have
ID3_Tag myTag("/home/apoorv/Music/hello.ogg");
and when trying to compile it I get error
❯ ./build.sh
The Meson build system
Version: 0.56.0
Source dir: /home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer
Build dir: /home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer/build
Build type: native build
Project name: MusicPlayer
Project version: undefined
Using 'CXX' from environment with value: 'g++'
C++ compiler for the host machine: g++ (gcc 10.2.0 "g++ (GCC) 10.2.0")
C++ linker for the host machine: g++ ld.bfd 2.35.1
Using 'CXX' from environment with value: 'g++'
Host machine cpu family: x86_64
Host machine cpu: x86_64
wx-config found: YES (/usr/bin/wx-config-gtk3) 3.0.5
Run-time dependency WxWidgets found: YES 3.0.5
Build targets in project: 1
Found ninja-1.10.1 at /usr/bin/ninja
Found runner: ['/usr/bin/ninja']
ninja: Entering directory `.'
[3/3] Linking target musicApp
FAILED: musicApp
g++ -o musicApp musicApp.p/src_app.cpp.o musicApp.p/src_frame.cpp.o -Wl,--as-needed -Wl,--no-undefined -pthread -Wl,--start-group -lwx_gtk3u_media-3.0 -lwx_gtk3u_aui-3.0 -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_webview-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 -Wl,--end-group
/usr/bin/ld: musicApp.p/src_frame.cpp.o: in function `Frame::Library(wxCommandEvent&)':
/home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer/build/../src/frame.cpp:495: undefined reference to `ID3_Tag::ID3_Tag(char const*)'
/usr/bin/ld: /home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer/build/../src/frame.cpp:495: undefined reference to `ID3_Tag::~ID3_Tag()'
/usr/bin/ld: /home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer/build/../src/frame.cpp:495: undefined reference to `ID3_Tag::~ID3_Tag()'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
./build.sh: line 12: ./musicApp: No such file or directory
I am using meson
as build system, I tried adding id3lib
as a dependency in meson.build
but no luck
project('MusicPlayer', 'cpp')
src = [
'src/app.cpp',
'src/frame.cpp',
]
wx = dependency('wxwidgets', modules : ['media', 'std', 'aui'])
id3 = dependency('id3lib')
executable('musicApp', src,
dependencies : [wx, id3])
I still get error
❯ ./build.sh
The Meson build system
Version: 0.56.0
Source dir: /home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer
Build dir: /home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer/build
Build type: native build
Project name: MusicPlayer
Project version: undefined
Using 'CXX' from environment with value: 'g++'
C++ compiler for the host machine: g++ (gcc 10.2.0 "g++ (GCC) 10.2.0")
C++ linker for the host machine: g++ ld.bfd 2.35.1
Using 'CXX' from environment with value: 'g++'
Host machine cpu family: x86_64
Host machine cpu: x86_64
wx-config found: YES (/usr/bin/wx-config-gtk3) 3.0.5
Run-time dependency WxWidgets found: YES 3.0.5
Found pkg-config: /usr/bin/pkg-config (1.7.3)
Found CMake: /usr/bin/cmake (3.18.4)
Run-time dependency id3lib found: NO (tried pkgconfig and cmake)
meson.build:12:0: ERROR: Dependency "id3lib" not found, tried pkgconfig and cmake
A full log can be found at /home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer/build/meson-logs/meson-log.txt
ERROR: Current directory is not a meson build directory: `/home/apoorv/repos/cpp-projects/wxWidgets/MusicPlayer/build`.
Please specify a valid build dir or change the working directory to it.
It is also possible that the build directory was generated with an old
meson version. Please regenerate it in this case.
./build.sh: line 12: ./musicApp: No such file or directory
I am on Arch Linux, I did install id3lib
through pacman
.
Upvotes: 0
Views: 281
Reputation: 11007
id3lib doesn't ship package config (.pc) file (and it looks as have no initention), you can create it yourself as described in the link and put it in PKG_CONIFG_PATH but it's simpler to find it as library:
cxx = meson.get_compiler('cpp')
id3 = cxx.find_library('libid3')
Upvotes: 2