Closed Overdrivr closed 8 years ago
I am having a look, just some preliminary observations:
The conanfile seems incomplete, as the build method is:
def build(self):
self.run("ninja")
That is, the build will be exactly the same irrespective of the input arch
and build_type
settings. The settings are intended to change the binary being created, if they don't affect at the build at all, it is likely that they are not settings of the package.
You might be interested in using the test_package
utility. Instead of having a separate project to consume the package, you can just add it to your recipe repo and use conan test_package
which is really convenient.
The process for creating a package is not doing conan build
, that only fires the local build, it is intended for consumer projects using a conanfile.py
for convenience to automate the build too. For creating packages, it is necessary to do:
$ conan export Overdrivr/testing //from the package recipe folder
$ conan install --build //from the consumer conanfile.txt
Did you follow those steps?
@memsharded Yes I did follow these two steps.
I will try the test_package utility, I'll keep you posted.
Thanks a lot for the support !
Ok, I have made a little progress. I fixed the paths inside the package
method in my conanfile that were not pointing to anything.
Now, I have an error by running conan install --build
in my test project
Requirements
platform-kl25z/0.1.0@Overdrivr/testing from local
Packages
platform-kl25z/0.1.0@Overdrivr/testing:b71a6fd4f88aef110884340db75a662a296db
853
platform-kl25z/0.1.0@Overdrivr/testing: Installing package b71a6fd4f88aef1108843
40db75a662a296db853
platform-kl25z/0.1.0@Overdrivr/testing: WARN: Forced build from source
platform-kl25z/0.1.0@Overdrivr/testing: Building your package in C:\Users\*****
\AppData\Roaming\SPB_Data\.conan\data\platform-kl25z\0.1.0\Overdrivr\testing\bui
ld\b71a6fd4f88aef110884340db75a662a296db853
platform-kl25z/0.1.0@Overdrivr/testing: Copying sources to build folder
platform-kl25z/0.1.0@Overdrivr/testing: Generated txt created conanbuildinfo.txt
ninja: error: loading 'build.ninja': The system cannot find the file specified.
platform-kl25z/0.1.0@Overdrivr/testing: ERROR: Package 'b71a6fd4f88aef110884340d
b75a662a296db853' build failed
platform-kl25z/0.1.0@Overdrivr/testing: WARN: Build folder C:\Users\*****\AppDa
ta\Roaming\SPB_Data\.conan\data\platform-kl25z\0.1.0\Overdrivr\testing\build\b71
a6fd4f88aef110884340db75a662a296db853
ERROR: platform-kl25z: Error 1 while executing ninja
How can I investigate which files are actually copied into the build folder ? I opened the corresponding build folder and there was only the following files
/__pychache__
conanbuildinfo.txt
conanfile.py
conanmanifest.txt
I am trying this from your gitlab repo, and have realized that you dont have any exports
defined. There are two approaches to packaging:
source()
and do a git clone
or a tools.download()
in itFrom what I am seeing in your repo, you have neither. If you have done local changes, please push them so I can get them. Thanks!
Allright, I did not understood while reading the docs about the meaning of exports.
Adding
exports = "*"
Fixes this problem.
I've had another one right after
It was due to a syntax error inside my package()
function
self.copy("*.h", dst="include", src=["platform/MKL25Z4/include",
"platform/"])
Is there a ticket open for more explanatory error messages ? In this case I would have expected something more in the lines of
Syntax error parsing conanfile.py : line XXX : join() argument must be str or bytes, not 'list'
Replacing the array by two calls to self.copy
fixed it.
Now, I will try to exploit the generated conanbuildinfo.txt with a build.ninja script to see if I can compile a blinky led exemple with it.
A following question regarding my linker script.
The microcontroller vendor supplies linker files that must be used during final linking, they define, among other things, memory layout specific to the microcontroller.
conanbuildinfo.txt
contains paths to includedirs
libdirs
and bindirs
? It would belong more into a resource
directory, and even, I'm not sure that's a great idea to put it inside a specific library. What are your thoughts on this ?Also, regarding platforms and embedded architectures, I have further questions. (New section again, haha)
This library I am preparing (platform-kl25z), is specific to a KL25Z microcontroller. By extension, since the KL25Z hosts an ARM Cortex M0+ core, it is also specific to this architecture.
Now, I can see libraries being written exclusively for a Cortex M0+, but not necessarily a KL25Z (an optimized math library for instance).
There can also be libraries, like hardware-abstraction-layer, that can be compatible for a collection of platforms, like [KL25Z, KL26Z, KL45Z]
Do you have plan to support such cases ? In this context, how can conan help me select the right libraries I need given such requirements ? For instance, if I want only packages for a KL25Z, how can I make sure there won't be any sub-...-sub-dependency that is actually for a KL46Z. Or for multi-platform packages, to automatically resolve to the dependency for my current target.
So that's a lot of questions. Sorry for being a bit a pain in the **\ :grinning:
Thanks a lot for the support, cheers
Thanks to you for such detailed feedback!
Regarding the more explanatory message for self.copy("*.h", dst="include", src=["platform/MKL25Z4/include", "platform/"])
, no there is no such issue. But I encourage you to open one, the divide and conquer is much better, so small, easy to fix issues are more likely to be solved quickly, are more easy to track and not get buried in huge threads.
For the vendor providing files, the suggested strategy would be to create a package with them! No matter if they are binaries, just "exports" them, do nothing in the build, and package them. You could use the build_policy=missing
to avoid having to create a package, so the recipe will be enough. It is true that they could also be included in your package too. That is up to you. My rule of thumb is that if those files are a "reusable" component (and they should be, as they are being distributed by the vendor), probably they deserve their own package. The tradeoff is of course having to manage two packages, but that can also be convenient, for example if having to upgrade the vendor files. About the specific subfolder, any name would be ok, but if they are going to be used by the linker, then I would suggest of course add it to self.cpp_info.libdirs
About the architectures, yes we have plans, @astralien3000 is doing a fantastic job on it, unfortunately we haven't had enough time (this is a difficult issue and requires time) to help with it.
Not a pain at all!!!! :) The feedback, issues and questions are always really helpful, and they are the main thing that help to improve conan, so please keep being such a "pain", thank you!
Hello !
About where should go the linking files (is it ".ld" files ?).
My method is to make a conan package for everything related to a toolchain (in the CMake world, a "toolchain file" is a file that will configure the compilers, linkers, options, etc to build a project), and copy the interesting files in the project's build directory.
You can have an example here. Currently, the conanfile copies everything, but later, it will just copy the needed ones. You can see, I have linker scripts files in a subdirectory called "linker". These files are also copied in the project's build directory.
Cheers !
EDIT: I did not know for the build_policy=missing
, interesting !
@memsharded @astralien3000 Thanks for the feedback !
Your solution makes sense, I'll do it that way. Keep you posted on the outcome.
@astralien3000 Yes, it was released in latest 0.11: http://docs.conan.io/en/latest/changelog.html#august-2016. :) Quite useful for header only libraries, things that are not compiled as some dev-tools or when downloading binaries from the internet instead of building them in the package recipe.
I am trying to use conan for embedded code (specifically here, on a NXP KL25Z that hosts a Cortex M0+ core).
I have prepared the
platform-kl25z
module that packs all the vendor files, + a ninja build script and the conanfile.py.In this package, running
conan build
runs fine, and produces correctly the platform library.Now, I created a test project inside another repo. I've just put the following
conanfile.txt
in itRunning
conan install --build
claims the following errorThank you for your help !