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

Problem compiling FaceBoxes #29

Open
pepeballesterostel opened this issue Apr 8, 2023 · 11 comments
Open

Problem compiling FaceBoxes #29

pepeballesterostel opened this issue Apr 8, 2023 · 11 comments

Comments

@pepeballesterostel
Copy link

pepeballesterostel commented Apr 8, 2023

After trying a couple of times, I find impossible to correctly compile the file ./build_cpu_nms.sh. The error is:

cl : Command line error D8021 : **invalid numeric argument '/Wno-cpp'**
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

I am not sure if this could be related to the operating system. I am running the code in Visual Studio Code on Windows 11.

Looking after the error I found this. So I changed in build.py inside FaceBoxes/utils the line of code 47:
from
extra_compile_args=["-Wno-cpp", "-Wno-unused-function"] to
extra_compile_args={'gcc': ['/Qstd=c99']}
After running this, I get the following warnings:

cl : Command line warning D9024 : unrecognized source file type 'gcc', object file assumed
cl : Command line warning D9027 : source file 'gcc' ignored

From where I assume that is basically not compiling the extra modules, but ignoring it. So, it does not show and error, but as expected, the code does not work. The error raises in FaceBoxes\utils\nms_wrapper.py :

  File "nms\cpu_nms.pyx", line 25, in nms.cpu_nms.cpu_nms
ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long'

I also tried commenting line 47 - in build.py inside FaceBoxes/utils - and uncommenting line 46, which raises the same error.

Any ideas how to solve this?
Many thanks.

@RichestYoo
Copy link

Just the same for me

@pepeballesterostel
Copy link
Author

@RichestYoo I am pretty sure I have solved the problem adding this line of code:
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
Let me know

@RichestYoo
Copy link

@pepeballesterostel
Where am I supposed to put that line in?

I put that in FaceBoxes/utils/build.py like the following failed:
ext_modules = [
Extension(
"nms.cpu_nms",
["nms/cpu_nms.pyx"],
extra_compile_args=["-Wno-cpp", "-Wno-unused-function"],
include_dirs=[numpy_include],
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
)
]

And "TRUE", instead of True seems to say that it's not a python source.

@pepeballesterostel
Copy link
Author

@RichestYoo
Put it in the main script that you are running, for example singleImage.py. I added it after the imports.
The command basically tells python that is ok to have multiple copies of the library MKL loaded into memory, which seems to be the initial compiling error.

@RichestYoo
Copy link

@pepeballesterostel
Thank you for your help, but it didn't work out for me.
After first failure, I put that in the environment variable as "os.environ" is bringing/setting PC's environment variable,
and tried again, but same error message came up.

@pepeballesterostel
Copy link
Author

@RichestYoo
Try changing your code from build.py to this code:
ext_modules = [
Extension(
"nms.cpu_nms",
["nms/cpu_nms.pyx"],
#extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
extra_compile_args=['std=c99'],
include_dirs=[numpy_include]
)
]
Does this work for you?

@RichestYoo
Copy link

@pepeballesterostel
With that, I passed the build failure you wrote at the beginning but now I'm at this "int_t" vs. 'long long' stuff...

@pepeballesterostel
Copy link
Author

pepeballesterostel commented May 5, 2023

@RichestYoo
Those changes worked for me. I suggest you try to re-do the whole process installing everything into a separate conda environment.

@RichestYoo
Copy link

@pepeballesterostel
Sure. Thank you for your sincere helps.

@HeChengHui
Copy link

@RichestYoo
did you managed to get it working?

i have added extra_compile_args=['std=c99'], to FaceBoxes build.py and os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE" to singleImage.py butstuck at 'int_t' but got 'long long' problem.

@RichestYoo
Copy link

Thank you for your help, but I'm transferred to another job and is not working on this any more.

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

No branches or pull requests

3 participants