On Feb 18, 2016, at 8:56 AM, Stephan Beal <sgb...@googlemail.com> wrote: > > i'll just leave this here…
You might want to add a short explanation of s2 near the top of the libfossil page. I had to go on a fairly long journey to figure that out. You can’t expect readers of that page or browsers of the source tree to just know that. The historical tie to th1ish didn’t help. Might I suggest that you remove all references to it and remove it from the trunk of the libfossil repo, so people don’t go off on dead-end trails? > (Source: http://fossil.wanderinghorse.net/r/libfossil) It doesn’t build cleanly under Clang, which affects OS X and FreeBSD 10+. OS X has additional problems due to its uncommon dynamic linkage system. $ ./configure && make ... CC [fsl_utf8.o] fsl_utf8.c:182:12: error: implicit declaration of function 'fossil_strdup' [-Werror,-Wimplicit-function-declaration] zOut = fossil_strdup(zFilename); ^ fsl_utf8.c:182:12: note: did you mean 'fsl_strdup'? ../include/fossil-scm/fossil-util.h:1395:19: note: 'fsl_strdup' declared here FSL_EXPORT char * fsl_strdup( char const * src ); ^ fsl_utf8.c:182:10: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Werror,-Wint-conversion] zOut = fossil_strdup(zFilename); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ 2 errors generated. $ vi +182 src/fsl_utf8.c # fix as suggested by Clang $ make ... LD [libfossil.so] clang: error: unsupported option '-static-libgcc’ Diking that out of shakenmake.make results in: $ make ... LD [libfossil.so] Undefined symbols for architecture x86_64: "_iconv", referenced from: _fsl_filename_to_utf8 in fsl_utf8.o "_iconv_close", referenced from: _fsl_filename_to_utf8 in fsl_utf8.o "_iconv_open", referenced from: _fsl_filename_to_utf8 in fsl_utf8.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Adding -liconv to the EXTRA_LIBS line in src/Makefile.in fixes that. You’re probably getting away without this on Linux due to the Linux linker’s ability to chase dependencies through other libraries. That is, if you link to some other library that links to libiconv, you don’t need to mention it explicitly on Linux. The BSD linker won’t chase dependencies like that. Having gotten libfossil to build, I then tried to build the s2 shell: $ cd s2 $ make ... CC [s2_amalgamation.o] s2_amalgamation.c:18429:23: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] i+1, p->entryCount ); ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ /usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ s2_amalgamation.c:18485:27: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] i+1, p->entryCount ); ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ /usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ That is, it is pointing out that typeof(uint16_t + int) = int, not uint16_t. Changing the two format specifiers it’s complaining about to %d fixes this. $ make ... CC [s2_amalgamation.o] LINK [f-s2sh] Undefined symbols for architecture x86_64: "xport-dynamic", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [f-s2sh] Error 1 Removing the -export-dynamic line in the Makefile fixes this. Apparently this is a GCC-specific flag. $ make ... LD [cgimod.so] Undefined symbols for architecture x86_64: "_cwal_array_append", referenced from: _s2_cgi_import_path_info in s2_cgi.o _s2_cgi_parse_param_list in s2_cgi.o "_cwal_array_get", referenced from: _s2_cgi_path_part in s2_cgi.o "_cwal_array_unref", referenced from: _s2_cgi_import_path_info in s2_cgi.o ... I’m not sure what it was trying to build, but since it did build f-s2sh, I gave up there and started playing with S2, my actual goal in downloading this: $ ./f-s2sh dyld: Library not loaded: libfossil.so Referenced from: /usr/local/src/fossil/libfossil/s2/./f-s2sh Reason: image not found Trace/BPT trap: 5 That happens because OS X’s dyld linker doesn’t search for libraries in the same way that Linux’s ldd does. There are at least two possible fixes. First, the one-off interactive method: $ DYLD_LIBRARY_PATH=.. ./f-s2sh Second, a build-time fix: $ install_name_tool -change libfossil.so \ @executable_path/../libfossil.so f-s2sh That is to say, the OS X dynamic linker uses editable paths in the executable to find libraries, not a library cache or a hard-coded list of common locations as ldd on Linux does. When you install the executable, you have to remember to update the path again, this time to something like: $ install_name_tool -change libfossil.so \ @executable_path/../lib/libfossil.so f-s2sh …assuming a common $prefix/{bin,lib} scheme. > [stephan@host:~/cvs/fossil/libfossil/s2]$ ./f-s2sh -v Idea: Rename it to fosh, the Fossil Shell. Downsides: Confusable with fish(1). Alternate idea: Keeping the nautical theme of cwal, rename it to focsle, the Fossil CWAL/S2 Laboratory Environment. Downsides: Longer, more fraught backronym which is impossible to simultaneously spell and pronounce correctly. ;) > s2 interactive shell. All commands run in the current scope. Use your > platform's EOF sequence on an empty line to exit. (Ctrl-D on Unix, Ctrl-Z(?) > on Windows.) Ctrl-C might work, too. It’s DEL on SysV. :) You might want to make that text conditional based on the build platform so you’re only listing the legal platform alternatives. > s2> var c = new Fossil.Context() I’m a JavaScript fan, warts notwithstanding. (Bjarne Stroustrup once observed that there are the languages everyone complains about and the languages no one uses. :) ) I’m glad that you’ve fixed several JS warts, though, including automatic semicolon insertion, the needless second way of declaring a function, and “with”. Good job! My skim of the docs did not make clear to me how your “new” differs from JS’s, but I hope it is not as bad as the massive impedance mismatch between JS and C++. It’s no good when two languages have the same keyword with such little overlap in meaning. It might be better if the language didn’t have it at all, given how different the JS/S2 object models are from C++. Having a “new” keyword promises a kind of false equivalency. Given that you’ve removed automatic semicolon insertion, why does the REPL not require one on the line quoted above? I also notice that it sometimes requires one after a closing curly brace, and sometimes doesn’t, apparently inheriting one of the more confusing areas of C/C++ syntax: var f = function(x) { return { x: x } }; Do you have any interest in either making automatic semicolon insertion happen in this case only, or making the semicolon required? Is there a way to type such an example into the REPL without putting it all on a single line? That is, it would be nice if the REPL would let me continue typing on several lines until the curly braces are balanced. Lacking that feature, I had to figure out the s2.import() syntax and then figure out how to “export” f from that file by adding a bare “f;” at the end, then re-binding the result to a local f: s2> var f = s2.import(‘example.s2’) I’d rather have something more like C’s #include, which in this case would evaluate a file, adding all symbols it defines to the current scope. > ...ad nauseam... Ad saturitatem! _______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users