Closed shlomif closed 10 years ago
Replying to myself, I'd like to note that the fc-solve git commit is 9ef34f01cae721a960dda8b9059bc7f64b0750e1 and the emscripten git commit is ada59f0a9d23d8ec19ee6a1326977ddf6e93f5f9
@kripken : hi!
I should note that after the git clone, you should do:
git checkout 9ef34f01cae721a960dda8b9059bc7f64b0750e1
Because I removed the "-O2" in the master branch, because I went on with preparing this page - http://fc-solve.shlomifish.org/js-fc-solve/text/ - (which is mostly usable but still could use more work). Perhaps I should create a separate git branch for reproducing this bug.
That put aside, I suggest you add your E-mail and/or blog address and/or homepage to https://github.com/kripken like I have on my GitHub user-page. People can always find your E-mail address from the Git commit messages.
Regards,
— Shlomi Fish
Any chance you can update with a full list of the instructions to reproduce this? The last comment says I should do some additional step, but I am not sure when in relation to the other list of instructions. Something as simple as possible so I don't need to exercise any thought when reproducing would be best ;)
@kripken : hi! Thanks for you response.
OK, here goes. run this using "bash -x reproduce-me.bash" or maybe "set -x" and "source reproduce-me.bash":
#!/bin/bash
test -d fc-solve || git clone https://bitbucket.org/shlomif/fc-solve.git
cd fc-solve
git checkout master
git pull --ff-only origin master
git checkout 9ef34f01cae721a960dda8b9059bc7f64b0750e1
cd fc-solve/source
rm -fr ./build
mkdir build
cd build
cmake -DFCS_WITH_TEST_SUITE= ..
make boards
make -f ../Makefile.to-javascript.mak SRC_DIR=..
I tested it and it appears to reproduce the bug. Sorry for being obscure at first - I'll try to keep it in mind.
Regards,
-- Shlomi Fish
I get some errors,
ack-grep: /home/alon/apps/fcs-for-pysol/share/freecell-solver: No such file or directory
~/Dev/llvmCore-3.2-rc3.install/bin/clang -O2 -I ./build -I . -m32 -std=gnu99 -emit-llvm ../main.c -c -o main.bc
In file included from ../main.c:31:
In file included from /usr/include/string.h:27:
/usr/include/features.h:324:10: fatal error: 'bits/predefs.h' file not found
#include <bits/predefs.h>
^
1 error generated.
make: *** [main.bc] Error 1
Hi @kripken , here is a somewhat more robust (and faster and still self-contained script that you can use instead (but see below for my comments):
#!/bin/bash
test -d fc-solve || git clone https://bitbucket.org/shlomif/fc-solve.git
cd fc-solve
git checkout master
git pull --ff-only origin master
git checkout 9ef34f01cae721a960dda8b9059bc7f64b0750e1
cd fc-solve/source
rm -fr ./build
mkdir build
cd build
cmake -DFCS_BUILD_DOCS= -DFCS_WITH_TEST_SUITE= -DCMAKE_INSTALL_PREFIX="$HOME/apps/fcs-for-pysol" ..
make boards install
make -f ../Makefile.to-javascript.mak SRC_DIR=..
In any case, seems like your system is missing an include that is used by string.h. Freecell Solver only includes standard ISO C headers directly - not "bits/predfs.h" or anything like that. Are you using the 3.2-rc3 version of clang and LLVM? Isn't there already 3.2-FINAL? Does a program that only does an
#include <string.h>
int main()
{
return 0;
}
work with a similar invocation? Which distribution and version are you running?
Regards,
-- Shlomi Fish
@kripken : hi, what's up? Any news? In order to help you (help me - ☺ ), I could use some more information such as what operating system, distribution and version you are running my script on, as well as if you're using a new UNIX user account, and what version of the various emcc dependencies are you using. I think you would also agree that a compiler failing in the middle of compiling "string.h" (with no particularly offending flags), which is a standard ISO C header, is indicative that something is really wrong on the host system, and I am hoping you can investigate and fix this SNAFU.
At the moment I was able to deploy the JS version of my solver on http://fc-solve.shlomifish.org/js-fc-solve/text/ , but without ant optimisations flags, which likely results in both under-performing JS code and one with a considerably larger one. Someone I talked with who used a mobile device (connected to the Internet using a cellular network) and asked to test it, testified that it took a long time to load, and so I'd prefer to remedy as much as I can, as soon as possible.
Sorry if I'm nudging you too much.
Regards,
-- @shlomif .
Sorry for the delay, I've been very busy with other stuff. Taking another look now.
First thing, you should use emcc instead of clang --emit-llvm
. The former will use the emscripten headers properly and other stuff that we need.
I built, but there is no main
function. You need to have main be in EXPORTED_FUNCTIONS if you want to call it.
@kripken : hi, thanks for your reply.
OK, after I converted clang --emit-llvm to emcc and replaced the empty OPT_FLAG with -O2, everything is working fine now. Maybe there is a way to fail more gracefully. Thanks for trying to build it, but see the commit at:
https://bitbucket.org/shlomif/fc-solve/commits/ed8fa0181abd56692aca300604d61027a00c28d0
libfreecell-solver.js is a library without a main function, and now the code on this page is working fine with -O2 : http://fc-solve.shlomifish.org/js-fc-solve/text/ . Thanks again.
Regards,
-- Shlomi Fish.
Great, glad it works now :)
Regarding failing more gracefully on that specific problem, I can't think of a good way right now. clang -emit-llvm
does generate bitcode, and we can't easily identify it as originating from a non-emcc source.
It sounds like the issue was solved, so let's close this. Feel free to reopen or post a new issue if there's something still broken!
Hi and happy new year and thanks for all your help on my previous bug report,
sorry to be the harbinger of bad news (= what seems to be a bug in this case) again, but I ran into a place where emcc throws a hard-to-understand Python exception when I use -O2 instead of -g to the opt flags. To reproduce do:
Where the emcc-build-O2.bash is:
(with emcc/clang/etc. in the path).
This gives me:
I am using Mageia Linux 3/Cauldron x86-64 with clang-3.2-2.mga3 and if I change "OPT_FLAGS" to "-g" in the Makefile.to-javascript.mak, it works fine.
Thanks again for all your work, and please look into it.
Best regards,
— Shlomi Fish
By the way, I am a packager for Mageia (a free-and-open-source Linux distribution based on Mandriva), and I wonder if you feel that emcc is ready for being packaged for Linux distributions and other operating systems. If this is the case, then it would help if it made use of a solid build system such as CMake or python's setuptools or even GNU Autools. What do you say?