On 07/06/2012 07:11, Logan Bell wrote:
Devs,

This last weekend I was attempting to build Lucy from trunk but was
failing. My console was being flooded with these sorts of errors:

./charmony.h:292:31: note: expanded from macro 'CHY_EXPORT'
#define CHY_EXPORT __declspec(dllexport)
                               ^
In file included from ../core/Lucy/Index/SegLexicon.c:18:
In file included from ../core/Lucy/Util/ToolSet.h:40:
autogen/include/Lucy/Object/BitVector.h:349:8: warning: unknown attribute
'dllexport' ignored [-Wattributes]
extern CHY_EXPORT size_t Lucy_BitVec_Is_A_OFFSET;

After doing some spelunking through the charmonizer code I found that we're
doing some probing in src/Charmonizer/Probe/SymbolVisibility.c to set some
macros CHY_EXPORT/CHY_IMPORT based on if some code fragments can compile.
The problem is that this probe is failing for my version of clang,
charmonizer believes my platform is windows. Reading through the clang
documentation it looks like clang will by default drop the Microsoft
specific "__declspec(dllexport)" constructs, thus making the test true in
this instance. Further, it appears that clang does support most of the gcc
specific attributes. So as a hack and potential fix I reversed the logic in
this code. This made the build happy with no errors. I have yet to commit
this since I'm a bit new to charmonizer and to the various macros it
creates and would appreciate any feedback to this patch.

The patch is attached to JIRA 237:
https://issues.apache.org/jira/browse/LUCY-237

Yes, the symbol visibility probe still needs some work. The problem is that GCC and as it seems also clang only warn about unsupported function attributes.

Unfortunately, your patch will break GCC on Windows which relies on the old order of probes. For a better solution we'll have to extend Charmonizer so that it can either detect compiler warnings or support tests that create DLLs and link against them.

Nick

Reply via email to