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
Get duplicate file names when copying dll and lib files #13660
Comments
Hi @leinadme Thanks for your question Regarding your issue, it would be important to know if you have boost both as |
I'm trying to place the files in these folders so I can compile the main application which requires these libraries. Also, for Windows I copy some of these dll's to the executable folder to satisfy missing dlls when I try to run it. The folders are temporary and then deleted after the application is built and the few dlls the app needs is copied to the executable folder. In Conan 1.x I used 'def imports' and it all worked fine. |
I followed the info from this link: I'm also using requires but now trying tool_requires to see if that makes a difference. Seems like everything is rebuilding. |
Thanks for the feedback. The recommended approach for this use case wouldn't be to copy (the
If you still want to go this way, we would need some way to reproduce this. Are you able to reproduce the problem by stripping out the recipe, to just |
The entire recipe is quite small, I get error at the 'def generate' but the files do get copied so I'm wondering why? from conan.tools.files import copy
from conan.tools.cmake import CMakeDeps
import os
class app(ConanFile):
name = "my-app"
version = "1.5.4"
license = "something here"
author = "something here"
url = "something here"
description = "My Project"
topics = ("project", "MyProject")
settings = "os", "compiler", "build_type", "arch"
requires = "boost/1.80.0","qt/5.15.7","qwt/6.2.0","sqliteinterface/1.1.0","sqlite3/3.39.4","dbversion/1.0.1","qt_warning_macros/1.0.0"
default_options = {"boost/*:shared": True, "qt/*:shared": True, "qwt/*:shared": True}
generators = "CMakeDeps"
# place the generator files under the build folder
def layout(self):
self.folders.generators = "build"
# copy the libs to build/bin and build/lib folders
def generate(self):
for dep in self.dependencies.values():
if self.settings.compiler == "apple-clang":
copy(self, "*.dylib", src=dep.cpp_info.libdirs[0], dst=os.path.join(self.source_folder, "build/lib"), keep_path=False)
elif self.settings.compiler == "gcc":
copy(self, "*.so", src=dep.cpp_info.libdirs[0], dst=os.path.join(self.source_folder, "build/lib"), keep_path=False)
elif self.settings.compiler == "msvc":
copy(self, "*.lib", src=dep.cpp_info.libdirs[0], dst=os.path.join(self.source_folder,"build/lib"), keep_path=False)
copy(self, "*.dll", src=dep.cpp_info.bindirs[0], dst=os.path.join(self.source_folder,"build/bin"), keep_path=False)
def get_platform(self):
return os.environ.get('PLATFORM', None) |
I figured it out while dong the c/p. Can you see what I did wrong? but when I do the copy, I used this. Should be, remove the 'build' from 'build/bin' since build was already defined :) |
Great 😄 I was about to test it, but got stuck in:
Maybe it is your private package? In any case, happy you found the issue. I'd like to clarify that maybe it makes sense to use |
I'm sorry for driving you crazy, but as it turns out I still have the same issue. Seems that I didn't clean up properly after retrying so what I had was a legacy install which I thought did work. It works fine if I put the bin and libs in the root folder but I do want to have them in the build folder. Basically Thanks! |
Ok, now I think I have it :) def layout(self):
|
I was trying it, but then I hit some "missing" binary, so it took me a while to build dependencies from source. I think it would be clarifying in these cases to print the folders to understand what is happening: def layout(self):
self.folders.generators = "build"
self.cpp.build.libdirs = "lib" # write the .libs to the library folder under build
self.cpp.build.bindirs = "bin" # write the .dll to the bin folder under build
# copy the libs to build/bin and build/lib folders
def generate(self):
print("CWD", os.getcwd())
print("SOURCE", self.source_folder)
print("BUILD", self.build_folder)
print("LIBDIRS", self.cpp.build.libdirs)
print("BINDIRS", self.cpp.build.bindirs) If we execute this, we get:
So we can see that your above works because the Take into account that More important is that if at some point you add a Also the Thanks for the feedback, I hope the issue is now clear and everything works! :) |
Thanks a bunch for your help! |
What is your question?
Hi,
I'm using conan 2.0 on Windows 10. I'm trying to copy a bunch of dependencies such as boost, Qt, etc libs and dlls into my local build/lib and build/bin respectively. I'm using the code snippet below. It seems to work but at the end I get the following error message which is annoying. I'm not sure why I'm getting this error, the copies seem to work fine in their respective folders. Any help would be appreciated!
Thanks!
copy(self, "*.lib", src=dep.cpp_info.libdirs[0], dst=os.path.join(self.source_folder,"build/lib"))
SameFileError: 'lib\boost_atomic.lib' and 'C:\MainFolder\applicationFolder\build\lib\boost_atomic.lib' are the same file
This is the code I'm using:
The text was updated successfully, but these errors were encountered: