rcsD<target>.a<file>.o
The changes appeared to be picked by by Blaze, but the .param file got a bit mangled in the process:feature {name: 'archiver_flags'flag_set {action: 'c++-link-static-library'action: 'c++-link-alwayslink-static-library'action: 'c++-link-pic-static-library'action: 'c++-link-alwayslink-pic-static-library'flag_group {flag: 'cru'}}}
<file>.ocru
feature {name: 'archiver_flags'expand_if_all_available: 'output_execpath'flag_set {action: 'c++-link-static-library'action: 'c++-link-alwayslink-static-library'action: 'c++-link-pic-static-library'action: 'c++-link-alwayslink-pic-static-library'flag_group {flag: 'cru'flag: '%{output_execpath}'}}}
<file>.ocru<file>.a
Heya Marcel!Ha! Good club to be in ;) Thanks for the reply. To be clear: I'm just trying to get the xtensa-lx106 toolchain up since I loathe the Arduino IDE workflow, so it's just a hobby for now :) I had some success back in March getting the xtensa-lx6 toolchain working and managed to flash a few ESP32 chips, so I know it's at least was possible to do! :)
1. Happy to share the CROSSTOOL file, but let me get it in a non-hacky place before I do. Since I posted, I ended up going... a bit deeper than I intended, heh. I looked at cc_configure and ended up writing a skylark rule that generates the CROSSTOOL file automatically a la windows_cc_configure. This automatically generates the CROSSTOOL features and action_configs based on the specifications of the cpu specified by the --cpu flag. I've gotten it working to the point where I can generate elf/bin files, but they're slightly different than the ones produced by the standard SDK - specifally the .rodata.str1.1 sections of the resulting binaries - but I think that's in my court to figure out.
2. Yup, figured that out, but I also had to disable another feature that's on by default to keep it from using it earlier (exactly which one escapes me at the moment).3. Not sure if the internal google package repo for bazel that's screwed up or the 0.5.2 release itself, but it appears it doesn't include the actionsAreConfigured change that skips the default actions if "c++" is defined somewhere. Cloning and building at HEAD picked up the change. And don't worry about breakage; this is me just toying around with it and it looks like CROSSTOOL is going to be under pretty heavy flux in the next quarter or so. If I can just it working for now, I'll just stay at that bazel release for a while until the CROSSTOOL changes settle down.
So given that I got it (somewhat) working, the only real headaches I've had when writing/generating the CROSSTOOL are:a) There's no built-in rule to read in a file as a string. I had to do a combination of cepository_ctx.execute, cat, and stripping/returning stdout.
b) Finding external include directories. repository_ctx has the "path" function, but only supports either relative paths to the current repository or labels to another target. This makes it painful on two fronts: it's impossible to get a path to a directory where another label is located e.g. for compiler includes since the compiler is actually in its own WORKSPACE rule, and you can't depend on a filegroup() rule declared in the external compiler's new_http_rule since bazel includes the full subpath. The latter can be solved by adding a new cc_library() that includes only the header files and a strip_prefix argument, but that complicates the new_http_archive's BUILD rules quite a bit. The former requires targeting a single file within the desired directory and the running a "dirname" command on it; also less than ideal
c) Templates must be written to a file; there's no way to read a file, template it, and store it as a string. I've combined the rule from a) with a .format() call, but it'd be nice to have that baked into repository_ctx.
d) Pretty sure I'd sell my soul for a regex string-matching function in [repository_]ctx... ;)
So onto more CROSSTOOL questions!- The old CROSSTOOL "docs"* suggest writing wrappers to include things like ld_library_path, etc. Do you expect these to be necessary down the road, given that more and more of the configuration will be in the CROSSTOOL file itself?
- I found out about output_execpath via rooting around j/c/g/devtools/build/lib/rules/cpp, and there appear to be a bunch of others sprinkled around those source files like "libraries_to_link", the various compilation stages like "c++-header-parsing","c++-module-compile" and "preprocess-assemble", etc. Is there a list somewhere? If not, mind generating one or pointing me to which files have important templated vars?
- Is there a way to get bazel to dump the entire, post-templated, post-processed, this-is-the-final-proto-its-using-to-compile-all-the-things CROSSTOOL file?
Thanks, and keep up the great work!-Tim* Sorry, couldn't help a tease... ;) Even crosstool_config.proto razzes on the lack of docs, though with CROSSTOOL changing rapidly in the near future I totally understand not wanting to write them until they're stable :)
feature {
name: 'archiver_flags'
flag_set {
action: 'c++-link-static-library'
action: 'c++-link-alwayslink-static-library'
action: 'c++-link-pic-static-library'
action: 'c++-link-alwayslink-pic-static-library'
flag_group {
flag: '-r'
flag: '%{output_execpath}'
}
expand_if_all_available: 'output_execpath'
expand_if_all_available: "uses_action_configs_for_cc_archiving"
}
}
It results in ar <object>.o -r <archive>.a. And I have no features iterates over 'libraries_to_link'. I guess this may have a default feature, but I tried to put my archiver_flags in the front of my toolchain definition section, nothing changes.
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/5dc118b1-8b79-4f95-9b19-d37054054534%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/59d10644-c5d2-4a10-95f5-b0edf20b7ad5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
feature { name: 'archiver_flags' enabled: true
flag_set { action: 'c++-link-static-library' action: 'c++-link-alwayslink-static-library' action: 'c++-link-pic-static-library' action: 'c++-link-alwayslink-pic-static-library'
flag_group { expand_if_all_available: 'output_execpath' flag: '-the_flag_you_need_there' flag: '%{output_execpath}' }flag_group { flag_group { expand_if_all_available: "libraries_to_link" iterate_over: "libraries_to_link" flag_group { expand_if_equal { variable: "libraries_to_link.type" value: "object_file" } flag: "%{libraries_to_link.name}" } flag_group { expand_if_equal { variable: "libraries_to_link.type" value: "object_file_group" } iterate_over: "libraries_to_link.object_files" flag: "%{libraries_to_link.object_files}" } } } } }
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/5132bf1b-e889-4615-86fd-4a52b4614a31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.