Good morning!
> I am quite new in fbuild, while having some (not very much) experience
> with scons and read something about waf.
> AFAIK, __pycache__ is newly introduced in python3. I dunno how things
> worked before, but I particularily don't like the __pycache__ folder
> (or any .pyc files) to clutter my project folder (yes, I know about
> svn:ignore and so on, I just don't like it, is a supplimentary clutter
> and stress). I hate to say it, but scons, while also written in
> python, does not put any __pycache__ or .pyc files into the project
> folder.
> So, my first question: could the __pycache__/.pyc be put somewhere
> else, let's say in the fbuild installation folder or in the /tmp
> folder of the machine?
Unfortunately it looks like the __pycache__ directories can't be moved
around. I may be able to do what scons/waf does, and allow for the
starter file to be "fbuildroot" instead of "fbuildroot.py", which I
think will not generate the __pycache__ file. I'll look into it.
> Second, on my machine I have both gcc and clang installed. For some
> reason (namely, support of designated initializers in clang++), I
> would like to sometime force using clang over gcc/g++ when building.
> Currently, I use:
> static = fbuild.builders.c.guess_static(ctx)
> to construct the builder, and this finds gcc or g++ and sticks with
> it.
> So, my second question: it is possible to force using clang/clang++
> over gcc/g++ in fbuild and, if yes, how?
It is! Or at least it will be. I was actually just in the middle of
adding clang support, which I just pushed out.
To use it, you can either call fbuild.builders.c.clang.static
directly, or you can extend the platform set to consider using clang
if it's available. You can do that by:
platform = fbuild.builders.platform.guess_platform(ctx)
platform = platform.union(['clang', 'clang++'])
static = fbuild.builders.c.guess_static(ctx)
and if clang exists and doesn't fail to configure, it will prefer it
over the system compiler. Please let me know if that doesn't work for
you.
> Thanks!
>
> Felix (no, is not a joke)
:) Thanks for trying out fbuild!
Hm, maybe you're pointing at a different github page? What does "git
remote -v" say? It should say something like:
Oops, I missed a function rename in fbuild.builders.c.guess_static.
Could you try again?
Oh! I know, you're installing fbuild, not running it out of the
checkout directory. I forgot to add clang to the MANIFEST. I just
fixed that. Also, can also just call $FBUILD_GIT_DIR/fbuild-light and
it should run fine without needing installation if you plan on
tracking the git repository.
Let me know if you're still having problems.
-e
I think I finally tracked down what was going on, and pushed a fix.
Thanks for your patience.
> OTOH, while tryng to run ./fbuild-light (from the git folder), I
> encountered:
>
>>>./fbuild-light
> /usr/bin/env: python3.1: No such file or directory
>
> which is true, since I use python3.2 (Ubuntu Natty).
>
> However, for the last error (the one with fbuild-light) there is a
> proposed patch at:
>
> https://github.com/felix-lang/fbuild/pull/4
>
> Many thanks again.
>
> I should also add that I am not in hurry, so take your time.
And thanks for the patches! I committed them, with a slight
modification for the install location. http://github.com/felix-lang is
now the official parent project so I just removed references to
http://github.com/erickt.
Unfortunately, it still seems not being fixed (see below).
Before of that, some comments:
1. AFAIR, fbuild-light used to come with the "+x" attribute enabled,
now is not and must be enabled manually.
2. The new official path (http://github.com/felix-lang) does just
partially appear into the README.markdown file. The specific problem
that I encountered was not about the "erickt" part, but about the
protocol (git:// vs. http:// or https://). My firewall forbids me
accessing the git:// protocol. The first does not work, while the last
two work:
git clone git://github.com/felix-lang/fbuild.git
git clone http://github.com/felix-lang/fbuild.git
git clone https://github.com/felix-lang/fbuild.git
3. Just after cloning, I run:
cd fbuild
sudo python3 setup.py install
in order to install fbuild, but I also tried with fbuild-light from
the fbuild/ directory.
Now, back to the bug:
===fbuildroot.py===
def build(ctx):
static = fbuild.builders.c.clang.static(ctx)
===============
>>fbuild #trying fbuild
Traceback (most recent call last):
File "/usr/local/bin/fbuild", line 156, in <module>
sys.exit(main())
File "/usr/local/bin/fbuild", line 132, in main
result = build(ctx)
File "/usr/local/bin/fbuild", line 82, in build
target.function(ctx)
File "/home/USER/eclipse-workspace/PROJECT/fbuildroot.py", line 28, in build
static = fbuild.builders.c.clang.static(ctx)
AttributeError: 'module' object has no attribute 'clang'
>>/home/.common/_develop/fbuild/fbuild-light #trying fbuild-light
Traceback (most recent call last):
File "/home/.common/_develop/fbuild/fbuild-light", line 13, in <module>
exec(compile(f.read(), fbuild_exename, 'exec'))
File "/home/.common/_develop/fbuild/bin/fbuild", line 156, in <module>
sys.exit(main())
File "/home/.common/_develop/fbuild/bin/fbuild", line 132, in main
result = build(ctx)
File "/home/.common/_develop/fbuild/bin/fbuild", line 82, in build
target.function(ctx)
File "/home/USER/eclipse-workspace/PROJECT/fbuildroot.py", line 28, in build
static = fbuild.builders.c.clang.static(ctx)
AttributeError: 'module' object has no attribute 'clang'
>>clang #test if clang is really installed
clang: error: no input files
Please, take into account that I new to both python and fbuild and, as
such, I could make a mistake when installing (although I follow the
instructions).
Cordially,
Felix
How odd. I fixed it. You may need to manually change the attribute
though on fbuild-light and bin/fbuild because it looks like git pull
isn't updating it for me.
> 2. The new official path (http://github.com/felix-lang) does just
> partially appear into the README.markdown file. The specific problem
> that I encountered was not about the "erickt" part, but about the
> protocol (git:// vs. http:// or https://). My firewall forbids me
> accessing the git:// protocol. The first does not work, while the last
> two work:
> git clone git://github.com/felix-lang/fbuild.git
> git clone http://github.com/felix-lang/fbuild.git
> git clone https://github.com/felix-lang/fbuild.git
Good point, I'll just point everyone to the http instead.
> Now, back to the bug:
>
> ===fbuildroot.py===
> def build(ctx):
> static = fbuild.builders.c.clang.static(ctx)
Is this your full fbuildroot? Are you also doing any imports? Is it
anything more than this?
import fbuild.builders.c.clang
def build(ctx):
static = fbuild.builders.c.clang.static(ctx)
----
Oh, maybe I reproduced your situation. Are you doing this?
import fbuild.builders.c
def build(ctx):
static = fbuild.builders.c.clang.static(ctx)
Notice the import doesn't have clang or gcc at the end of it. If so,
that's the problem :) Just change it to "fbuild.builders.c.clang" and
it should hopefully work.
Ack, I forgot to push. I just did and it should *hopefully* be
executable now. I'm sorry about that.
> Yes! That was the problem, I had an import of fbuild.builders.c
> (without any final .clang or .gcc). I assumed that will import
> everything inside the fbuild.builders.c module, but it seems I am
> wrong. A Python expected behavior?
Not necessarily. You can do that in python, but I think most people
don't to avoid cluttering up the namespace (which is why I'm not doing
it).
> You are right! Changing into import fbuild.builders.c.clang did the
> trick!
>
> Many thanks and sorry for being so inexact in my description.
Great! I'm glad it's working for you now. Please let me know if you need help.
> I look forward for new versions of fbuild and, if I can help, I will
> always give a helping hand (unfortunately I am not a Python guru...).
Thanks for the offer. I'd appreciate the help :) Please let me know if
you run into more problems.