Hi Georg,

here are some comments/answers on your questions:

On 27 Feb 2014, at 22:36 , Georg Baum <georg.b...@post.rwth-aachen.de> wrote:

> Benjamin Piwowarski wrote:
> 
>> Hi,
>> 
>> While I was trying to update a patch for LyX, I had troubles compiling LYX
>> on OS X 10.9 introduces quite some changes: - QT5 is required (as
>> discussed on the mailing list) - libc++ (instead of libstdc++) is used by
>> default systemwide
>> 
>> So here are some patches for compiling LyX on OS X 10.9 that take into
>> account the above comments:
> 
> Hi Benjamin,
> 
> many thanks for the patches. I'll comment on what I understand, others 
> hopefully can comment on the rest.
> 
>> [patch 1] is a patch for compiling with clang & libc++ that fixes those
>> [issues:
>> - in strfwd.h and debug.h, if libc++ is detected, then do not use forward
>> std declarations (they break since libc++ define some classes in an
>> anonymous namespace to provoque linking clashes when linked with
>> libstdc++)
> 
> Is <ciso646> guaranteed to exist in C++03? If yes, then this change looks 
> safe.
yes, it is guaranteed to exist with C++03

> 
>> - conversion from streams to boolean has to be explicit
> 
> We do not use C-style casts. Could you please rewrite this, e.g. like
> 
> bool const success = (os << contents) ? true : false;
> 
> and add comments why it is needed? I could do that, but I can't test whether 
> it still fixes your problem, and the chance is extremely high that I would 
> break something.
I am unsure the above solution would work, since in libc++ the conversion to 
bool() is marked as explicit - you have to either use the constuct bool(x) or 
(bool)x.
Alternatively, we could also use bool const success = !(os << 
contents).failed() 

> 
>> [patch 3] QT5 and MacOs
>> - this adds some QT components for Mac (MacExtras in qt4 and Gui in
>> support [necessary to compile Package.cpp]) - use QT_OS_MACX instead of
>> QT_WS_MACX (the latter is not defined anymore in Qt5) - in
>> GuiWorkArea.cpp, use QProxyStyle instead of QMacStyle - [all platforms
>> with cmake] during installation, create the qt.conf file + copy the
>> platform plugin (qcocoa) on Mac
> 
> I can't comment on the cmake part, but the C++ changes look good. To our Mac 
> expperts: Is there any reason why they are not already in?
I guess this is because since QT_WS_MACX was not defined anymore in QT5, the 
mac specific parts were not compiled anymore and hence did not trigger any 
problem.

> 
>> [patch 4] graceful libmagic error handling
>> This patch just report an error if the magic file detection does not work,
>> and proposes a workaround for the bug I had, related to an incorrect
>> locale setting
> 
> Well, it also sets environment variables. Dou you have any documentation why 
> this is needed? Did the fallback to the old code not work in case libmagic 
> failed?
Yes, it sets and unsets environment variables. I cannot judge for the fallback 
on the old code since I coded the tests for graceful error handling and in the 
same time the workaround. The bug is reported over there (for mac):
https://trac.macports.org/ticket/38771 (see comment 9 about the locale fix)
and there (it is related to the error code of the regex library)
http://osdir.com/ml/package-management.rpm.devel/2008-02/msg00121.html

it seems to affect only mac os though. I can modify the patch if needed to 
remove the workaround, since otherwise LyX crashes.

> 
>> Note that when bundling with cmake, the file magic database should be
>> copied within the bundle (but it isn't for the moment)
> 
> I guess this is something for later, since libmagic is not essential. First 
> we need to solve the bug below:
ok

> 
>> With all this, I was able to have a "working" LyX application (that is,
>> everything seems to work but the menu - known OS X bug)
> 
> Is it this one: http://www.lyx.org/trac/ticket/8925
> 
yes

> Do you have any pointers to documentation about this bug?
no idea - I am quite unfamiliar with QT so it would take some time. I started 
though to debug the menu generation in LyX to understand how it is expected to 
work, but did not get far yet.

Benjamin

Reply via email to