pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.62k stars 518 forks source link

build-macosx.sh fails on Mojave (10.14) #982

Closed Oozlum closed 4 years ago

Oozlum commented 5 years ago

I'm trying to build on Mojave and I am encountering a succession of errors. So far I have had to make the following modifications to build-macosx.sh:

MACOSX_ARCH="x86_64" MACOSX_VERSION="10.14" MACOSX_SDK_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"

wxWidgets configuration: --disable-mediactrl CXXFLAGS=-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1

While I'm waiting for the compilation to fail at the next step, I'd appreciate it knowing if someone else has managed to build under 10.14.

pkulchenko commented 5 years ago

@Oozlum, I've been able to compile x64 version on macOS, but I'm using 10.9.sdk and 10.7 MACOSX_VERSION values. You'll have to apply couple more changes, which I'll push shortly, buy I'm curious what issues you ran into.

Oozlum commented 5 years ago

I had to give up on this because I ran out of time to resolve it myself. I believe the last issue I ran into was a problem with CMake's insistence on using a particular version of libc that it had determined was correct for the host platform, but was in fact incorrect. I'm not proficient in CMake, but I did Google the problem and determined that it was a known issue without a workaround.

My last thought was to abuse one of the CMake variables that appear later in the command line to try and override it, but I didn't get around to trying it.

pkulchenko commented 5 years ago

I haven't seen the libc issue, but I plan to have both the updated makefile and the generated libraries available in the separate branch later this week, so you should be able to test them on 10.14.

pkulchenko commented 5 years ago

@Oozlum, I pushed the changes to https://github.com/pkulchenko/ZeroBraneStudio/tree/wxwidgets-upgrade-313 branch (64bit binaries along with the updated build file) and expect them to work on 10.14. Let me know if you have a chance to try them.

Oozlum commented 5 years ago

I've just tried this and I am getting the same errors as previously:

$ cd build $ ./build-macosx.sh all

[ snipped ... ] inflating: scintillua_3.6.5-1/Makefile clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated] warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] 1 warning generated. warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] ../wxWidgets/src/stc/scintilla/lexlib/PropSetSimple.cxx:14:10: fatal error: 'string' file not found

include

     ^~~~~~~~

1 warning and 1 error generated.

pkulchenko commented 5 years ago

@Oozlum, try with ./build-macosx.sh lua wxwidgets wxlua (lexlpeg is already a universal binary and doesn't need to be recompiled). Also, what version of clang are you using?

Have you tried running the binaries in the upgrade branch? I'd be interested to see if you run into any issues on 10.14.

pkulchenko commented 5 years ago

@Oozlum, one more thing: can you try changing MACOSX_VERSION="10.7" at the top of the file to MACOSX_VERSION="10.9"? I suspect that may remove libc++ warnings and related errors.

Oozlum commented 5 years ago

Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

./build-macosx.sh lua wxwidgets wxlua fails when configuring wxwidgets:

checking if C compiler (gcc -mmacosx-version-min=10.7) works with SDK/version options... yes checking if C++ compiler (g++ -mmacosx-version-min=10.7) works with SDK/version options... configure: error: in '/Users/chris/src/git/ZeroBraneStudio/build/wxWidgets': configure: error: no. Try a different SDK See 'config.log' for more details make: *** No targets specified and no makefile found. Stop. Error: failed to build wxWidgets

config.log

Changing to MACOSX_VERSION="10.9" results in the libc error when compiling wxlua. Output

The pre-built binaries seem to work fine, which is to say that the ZBS main window appears, looks good, responds normally and closes down fine. I haven't tested beyond that.

pkulchenko commented 5 years ago

I expect to have access to a machine with 10.14, so will try to figure out how to address this. I suspect this may be fixed by adding -stdlib=libc++ to the build instructions, but don't want to send you on a wild goose chase...

Thank you for confirming that the pre-built binaries are working.

Oozlum commented 5 years ago

The problem I had was that the conventional places to specify such a flag are placed on the command line before CMake puts its own -stdlib, thus overriding it. The only way I could think around this was to abuse a completely unrelated variable that appears towards the end of the command line.

pkulchenko commented 5 years ago

@Oozlum, it turned out there was an (obsolete) workaround in Cmake that was explicitly inserting libstdc++; I removed it and pushed the changes to wxlua: https://github.com/pkulchenko/wxlua/commit/244c5f157619522101b7c0346605daedaeafae8f

Also, these changes were sufficient for me to compile with libc++ (on top of https://github.com/pkulchenko/ZeroBraneStudio/tree/wxwidgets-upgrade-313 branch):

diff --git a/build/build-macosx.sh b/build/build-macosx.sh
index 1a704e11..d2da0749 100755
--- a/build/build-macosx.sh
+++ b/build/build-macosx.sh
@@ -263,6 +263,7 @@ if [ $BUILD_WXWIDGETS ]; then
   fi
   ./configure --prefix="$INSTALL_DIR" $WXWIDGETSDEBUG --disable-shared --enable-unicode \
     --enable-compat30 \
+    --with-cxx=11 \
     --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=no --with-expat=no \
     --with-zlib=builtin --disable-richtext \
     --enable-macosx_arch=$MACOSX_ARCH --with-macosx-version-min=$MACOSX_VERSION $MINSDK \
@@ -300,6 +301,7 @@ if [ $BUILD_WXLUA ]; then
   cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" -DCMAKE_BUILD_TYPE=$WXLUABUILD -DBUILD_SHARED_LIBS=FALSE \
     -DCMAKE_OSX_ARCHITECTURES=$MACOSX_ARCH -DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_VERSION $MINSDK \
     -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DwxWidgets_CONFIG_EXECUTABLE="$INSTALL_DIR/bin/wx-config" \
+    -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" \
     -DwxWidgets_COMPONENTS="stc;gl;html;aui;adv;core;net;base" \
     -DwxLuaBind_COMPONENTS="stc;gl;html;aui;adv;core;net;base" -DwxLua_LUA_LIBRARY_USE_BUILTIN=FALSE \
     -DwxLua_LUA_INCLUDE_DIR="$INSTALL_DIR/include" -DwxLua_LUA_LIBRARY="$INSTALL_DIR/lib/liblua.dylib" .
Oozlum commented 5 years ago

Marvellous, that works for me.