qir-alliance / qcor

C++ compiler for heterogeneous quantum-classical computing built on Clang and XACC
http://docs.aide-qc.org
MIT License
97 stars 39 forks source link

CMake Error 'functional' file not found #253

Open lotshawpc opened 2 years ago

lotshawpc commented 2 years ago

I'm trying to install QCOR on Mac using git pull, mkdir build, cd build, cmake .. -DXACC_BUILD_TESTS=TRUE -DXACC_BUILD_EXAMPLES=TRUE, make -j 48 install

This returns an error at the end of the install

In file included from /Users/5ci/.xacc/include/qcor/qcor_lang_ext.hpp:12: /Users/5ci/.xacc/include/qcor/objective_function.hpp:13:10: fatal error: 'functional' file not found

include

     ^~~~~~~~~~~~

1 error generated. CMake Error at runtime/cmake_install.cmake:89 (file): file INSTALL cannot find "/Users/5ci/qcor/build/runtime/qcor_lang_ext.hpp.pch": No such file or directory. Call Stack (most recent call first): cmake_install.cmake:48 (include)

I've tried updating to the latest version of xacc before installing, but this didn't help. Any ideas what is going on?

amccaskey commented 2 years ago

Usually the 'include functional' not found error is related to not being able to find the xcode command line tools. Make sure you install that, and you might also set the SDKROOT environment variable. check out https://github.com/eclipse/xacc/issues/430

For building from source check out https://aide-qc.github.io/deploy/getting_started/build_from_source/#a-idxqbrewa-xacc-and-qcor-on-mac-os-x-and-linux-x86_64-with-homebrew-not-ubuntu. For example, you wouldn't want to set XACC_BUILD* when running cmake for qcor.

lotshawpc commented 2 years ago

Thanks, Alex! I’ve been able to install qcor after install xcode.

Now I’m trying to run the example program bell.py. The code is below, it is copied from https://aide-qc.github.io/deploy/getting_started/

This returns the following error, any idea what is happening?

python3 bell.py

Failure value returned from cantFail wrapped call

Symbols not found: [ _ ]

UNREACHABLE executed at /usr/local/Cellar/llvm-csp/1.0.0/include/llvm/Support/Error.h:749!

Abort trap: 6

Here’s the program bell.py –

import sys

import os

from pathlib import Path

sys.path.insert(1, str(Path.home()) + '/.xacc')

sys.path.insert(1, str(Path.home()) + '/.qcor')

from qcor import qjit, qalloc, qreg

Define a Bell kernel

@qjit

def bell(q : qreg):

H(q[0])

CX(q[0], q[1])

for i in range(q.size()):

    Measure(q[i])

Allocate 2 qubits

q = qalloc(2)

Run the bell experiment

bell(q)

Print the results

print('Results')

print(q.counts())

Thanks, Phil

From: Alex McCaskey @.> Reply-To: qir-alliance/qcor @.> Date: Friday, February 4, 2022 at 11:58 AM To: qir-alliance/qcor @.> Cc: "Lotshaw, Phil" @.>, Author @.***> Subject: [EXTERNAL] Re: [qir-alliance/qcor] CMake Error 'functional' file not found (Issue #253)

Usually the 'include functional' not found error is related to not being able to find the xcode command line tools. Make sure you install that, and you might also set the SDKROOT environment variable. check out eclipse/xacc#430https://github.com/eclipse/xacc/issues/430

For building from source check out https://aide-qc.github.io/deploy/getting_started/build_from_source/#a-idxqbrewa-xacc-and-qcor-on-mac-os-x-and-linux-x86_64-with-homebrew-not-ubuntu. For example, you wouldn't want to set XACC_BUILD* when running cmake for qcor.

— Reply to this email directly, view it on GitHubhttps://github.com/qir-alliance/qcor/issues/253#issuecomment-1030170391, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASOU63PIL54FUYK3L6KUODLUZQARRANCNFSM5NQA6DCA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

KJay221 commented 2 years ago

Hi, @amccaskey I found same error when I install QCOR on ubuntu 22.04 LST using following command

$ git clone https://github.com/qir-alliance/qcor.git
$ cd qcor && mkdir build && cd build    
$ cmake .. -G Ninja -DLLVM_ROOT=/usr/local/aideqc/llvm
$ cmake --build . --target install

And I get error message when running $ cmake --build . --target install

In file included from /home/kjay/.xacc/include/qcor/qcor_lang_ext.hpp:12:
/home/kjay/.xacc/include/qcor/objective_function.hpp:13:10: fatal error: 'functional' file not found
#include <functional>
     ^~~~~~~~~~~~
1 error generated.
CMake Error at runtime/cmake_install.cmake:98 (file):
  file INSTALL cannot find
  "/home/kjay/Desktop/quantum_computing/qcor/build/runtime/qcor_lang_ext.hpp.pch":
  No such file or directory.
Call Stack (most recent call first):
  cmake_install.cmake:53 (include)

FAILED: CMakeFiles/install.util 
cd /home/kjay/Desktop/quantum_computing/qcor/build && /home/kjay/.local/lib/python3.10/site-packages/cmake/data/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.

Any ideas or suggestions? Thanks!!!