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

Include is ignored by nvq++ #319

Closed
2 of 3 tasks
bettinaheim opened this issue Jun 29, 2023 · 8 comments
Closed
2 of 3 tasks

Include is ignored by nvq++ #319

bettinaheim opened this issue Jun 29, 2023 · 8 comments
Assignees
Milestone

Comments

@bettinaheim
Copy link
Collaborator

bettinaheim commented Jun 29, 2023

Required prerequisites

  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

Describe the bug

Bug report received via email:

Using nvq++ with its own cmake configuration provided by CUDA Quantum website, whenever I include additional directories to my project,
They are passed to the compiler without the -I flag, making them to be ignored during compilation.

set(CUDAQ_DIR $ENV{CUDA_QUANTUM_PATH}/lib/cmake/cudaq)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
find_package(CUDAQ REQUIRED)
 
add_library(tgt)
set_target_properties(tgt PROPERTIES LANGUAGE CXX)
 
target_sources(tgt
PRIVATE
 
# Sources
${CMAKE_CURRENT_SOURCE_DIR}/src/tgt_source.cpp
PUBLIC
 
# Headers
${CMAKE_CURRENT_SOURCE_DIR}/include/tgt/tgt_header.hpp
)
 
target_include_directories(tgt PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
 
target_link_libraries(tgt nvqir-custatevec)

The output from cmake during build has these messages

[build] argument /project/cudaq/include is ignored
[build] argument /usr/include is ignored

Steps to reproduce the bug

See above.

Expected behavior

Include should be processed.

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

  • CUDA Quantum version: current main
  • Python version: N/A
  • C++ compiler: N/A
  • Operating system: N/A

Suggestions

No response

@schweitzpgi
Copy link
Collaborator

The -I flag is required. Is this a request for some sort of extension?

@1tnguyen
Copy link
Collaborator

I'm not sure if this is related: when integrating CUDAQ's nvq++ into a CMake project (via find_package(CUDAQ)), I've added set(CMAKE_INCLUDE_FLAG_CUDAQ "-I") to get it to work.

@orclassiq
Copy link
Contributor

Note that the same applies for libraries that are linked by path.
For example, when calling nvq++ /usr/lib/x86_64-linux-gnu/libssl.a main.cpp.o -o test_app the output is:

argument /usr/lib/x86_64-linux-gnu/libssl.a is ignored
ld.lld: error: undefined symbol: OPENSSL_init_ssl
>>> referenced by main.cpp
>>>               CMakeFiles/test_app.dir/main.cpp.o:(main)
>>> referenced by main.cpp
>>>               CMakeFiles/test_app.dir/main.cpp.o:(main)
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

While the issue can be solved by using -lssl instead, this solution doesn't apply for other cases.
The main case is C++ package managers (such as vcpkg or conan) that link libraries by path to support using multiple builds of the same package on one machine.

@bettinaheim bettinaheim added the needs more information Questions that need more information label Jul 20, 2023
@mdepasca
Copy link

mdepasca commented Aug 2, 2023

Adding set(CMAKE_INCLUDE_FLAG_CUDAQ "-I") fixed the problem thanks a lot.

IMHO setting this variable should be taken care by CUDAQ cmake config files.

@bettinaheim
Copy link
Collaborator Author

@mdepasca Thanks for the confirmation. We are planning some updates to facilitate integration with common tools, and any feedback regarding what integration scenarios are relevant for you is very welcome. We have added documentation for the CMAKE_INCLUDE_FLAG_CUDAQ flag. I'll keep the issue open so we keep this in mind for a future update.

@bettinaheim bettinaheim added enhancement New feature or request and removed needs more information Questions that need more information labels Aug 7, 2023
@mdepasca
Copy link

mdepasca commented Aug 10, 2023

I may have spotted additional problems with cmake integration. Do you prefer I open a separate issues?

@mdepasca
Copy link

I opened issue #545

@schweitzpgi
Copy link
Collaborator

I believe this is fixed. Please reopen (or better open a new issue) if there are other option handling issues with the tools.

@bettinaheim bettinaheim added ecosystem and removed enhancement New feature or request labels Oct 26, 2023
@bettinaheim bettinaheim added this to the release 0.4.1 milestone Oct 26, 2023
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

5 participants