Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Vala & C++ project #476

Open
ghost opened this issue Mar 25, 2016 · 9 comments
Open

Create Vala & C++ project #476

ghost opened this issue Mar 25, 2016 · 9 comments

Comments

@ghost
Copy link

ghost commented Mar 25, 2016

I can't create this type of project due to errors :

  • We can't override vala arguments
  • package dependencies are reused
  • build continues even if vala build failed

meson.build : http://pastebin.com/AWtjPUF6
build log : http://pastebin.com/NWu9g3ks

@jpakkane
Copy link
Member

The log is clipped but there is this:

error: Package `taglib' not found in specified Vala API directories or GObject-Introspection GIR directories

and

In file included from ../src/giofilestream.cpp:1:0:
../src/giofilestream.h:4:25: fatal error: taglib-glib.h: Aucun fichier ou dossier de ce type

This seems to indicate some sort of problem in the dependencies rather than with Vala/C++ mixing.

@ghost
Copy link
Author

ghost commented Mar 27, 2016

taglib doesn't exist in vala (only c binding)
your system checks dependencies for each language : vala doesn't have vapi for C++ libraries ;)

@jpakkane
Copy link
Member

Is the problem here that Meson passes --pkg-taglib to valac and would it start working if those were removed?

@ghost
Copy link
Author

ghost commented Mar 27, 2016

taglib is a C++ library, we can't use this type of lib in vala world. We have to write C binding.

btw, I've found an hack : create a fake 'taglib' vapi.
but I can't override options and meson add his own options :/

FAILED: valac '-d' 'src/taglib-glib@sha' '-C' '-H' 'src/File.h' '--library=taglib-glib' '--vapi=../File.vapi' '--pkg' 'taglib' '--pkg' 'gio-2.0' '--pkg' 'gee-0.8' '-H' 'taglib-glib.h' '--vapidir' 'vapi' ../src/File.vala ../src/Tag.vala ../src/Picture.vala ../src/AudioProperties.vala ../src/RemoteFileStream.vala

meson ignore custom vapidir

@jpakkane
Copy link
Member

If this is an existing project can you post the compiler invocations that the current build system does?

@ghost
Copy link
Author

ghost commented Mar 27, 2016

[3/9] Compiling Vala source ../src/File.vala ../src/Tag.vala ../src/Picture.vala ../src/AudioProperties.vala ../src/RemoteFileStream.vala.
FAILED: valac '-d' 'src/taglib-glib@sha' '-C' '-H' 'src/File.h' '--library=taglib-glib' '--vapi=../File.vapi' '--pkg' 'taglib' '--pkg' 'gio-2.0' '--pkg' 'gee-0.8' '--vapi' 'taglib-glib.vapi' '-H' 'taglib-glib.h' '--vapidir' 'vapi' ../src/File.vala ../src/Tag.vala ../src/Picture.vala ../src/AudioProperties.vala ../src/RemoteFileStream.vala
error: Package `taglib' not found in specified Vala API directories or GObject-Introspection GIR directories
Compilation failed: 1 error(s), 0 warning(s)

but the normal way to compile vala library is :

valac --library my-lib -H lib.h file.vala file2.vala --vapidir=path/to/vapis

add -C option to generate C files

with meson custom options are ignored

@jpakkane
Copy link
Member

If you edit build.ninja and remove --pkg taglib from this compiler invocation, does it pass?

@ghost
Copy link
Author

ghost commented Mar 27, 2016

no because C step comes before vala step

[3/9] Compiling cpp object 'src/taglib-glib@sha/functions.cpp.o'
FAILED: c++  '-pipe' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-g' '-fPIC' '-I/usr/local/include/taglib' '-pthread' '-I/usr/include/glib-2.0' '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include' '-I/usr/include/gee-0.8' '-I/usr/include/glib-2.0' '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include' '-Isrc/taglib-glib@sha' '-I../src' '-Isrc' '-MMD' '-MQ' 'src/taglib-glib@sha/functions.cpp.o' '-MF' 'src/taglib-glib@sha/functions.cpp.o.d' -o 'src/taglib-glib@sha/functions.cpp.o' -c ../src/functions.cpp
In file included from ../src/functions.cpp:42:0:
../src/giofilestream.h:4:25: fatal error: taglib-glib.h: Aucun fichier ou dossier de ce type
compilation terminated.
[3/9] Compiling Vala source ../src/File.vala ../src/Tag.vala ../src/Picture.vala ../src/AudioProperties.vala ../src/RemoteFileStream.vala.

@ssssam
Copy link
Contributor

ssssam commented Jun 15, 2016

One workaround for this is to put the Vala code in a separate, static library. Then link the C++ library to it. That way you can put taglib as a dependency of the C++ library but not the Vala library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants