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

library targets generated with nvcc cannot be linked with #8330

Open
mdegans opened this issue Feb 12, 2021 · 1 comment
Open

library targets generated with nvcc cannot be linked with #8330

mdegans opened this issue Feb 12, 2021 · 1 comment

Comments

@mdegans
Copy link

mdegans commented Feb 12, 2021

Describe the bug
Library generated with nvcc do not work as link_with arguments.

To Reproduce
I generate a library with some cuda included. The compiler that generates the problematic target is nvcc. I then use executable(... link_with: the_library, ...) but this argument is not respected. i get undefined symbol.... when running the test executable and ldd shows it's not linked. The same general procedure works with gcc and clang.

source code to reproduce is here (requires a tegra board).

excerpt from my library's .build in src/meson.build

...
libnvcvcam_libname = meson.project_name() + '-' + proj_ver_short
libnvcvcam = library(libnvcvcam_libname, nvcvcam_src,
  dependencies: nvcvcam_deps,
  cpp_args: ['-fno-exceptions'],
  include_directories: [nvcvcam_incdir, mmapi_incdirs],
)
...

test/meson.build has:

...
  exe = executable(t['filename'], t['sources'],
    link_with: libnvcvcam,
    dependencies: nvcvcam_deps,
    cpp_args: [
      '-DLOGFILE="' + t['filename'] + '.txt"',
    ],
    include_directories: [nvcvcam_incdir, mmapi_incdirs],
  )
...

when a test is run:
test/test_capture: symbol lookup error: test/test_capture: undefined symbol: _ZTVN7nvcvcam7NvCvCamE

.. and ldd shows it's not linked

Expected behavior
a library target generated with cuda to be usable in executable with link_with

system parameters

  • native build on aarch64 (linux for Tegra)
  • JetPack 4.5 (Ubuntu 18.04 based)
  • Python 3.6.9
  • Meson 0.56.2
  • Ninja 1.8.2
@obilaniu
Copy link
Contributor

@mdegans Could you cut down the test case a bit more, see if you can isolate it from Tegra and JetPack? I don't have a board, and JetPack is a rather big and involved thing to install.

You could start from my own attempt at a minimal reproducer, which I believe to be similar to your codebase in every relevant sense. However, it simply doesn't fail at all, never mind in the way you describe.

Be aware that my testing has been with my work in #8355 merged in. It may be that this is no longer reproducible. If it is not, then you may presumably close this issue; If it is, then it would be helpful to see the full output of ninja clean; ninja -v.

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