pkulchenko / wxlua

wxlua: Lua bindings for wxWidgets cross-platform GUI toolkit; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and wxWidgets 3.x
306 stars 59 forks source link

Compiling wxlua on OSX 10.15 #91

Closed ivq001 closed 3 years ago

ivq001 commented 3 years ago

Howdy,

Do I have to download a generic gcc version to be able to compile wxlua on OSX 10.15, or can I use the default OSX gcc, which really is clang?

I ask as I am getting linker errors when trying to build wxlua, and not sure if this has to do with something I have done wrong, to do with a few warnings I had in CMake, or the fact that OSX calls clang and it is not 100% compatible with gcc flags.

(I am mostly illiterate with compile/link/cmake/make functionality so if Google can't help me, I am quickly lost! wxWidgets compiled fine and was tested using one of the sample apps )

cmake 3.19.6 wxWidgets 3.1.4 wxlua 3.1.0.0

The cmake warnings I get are:

CMake Deprecation Warning at CMakeLists.txt:20 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

WARNING: Unable to find requested wxWidgets component : adv

Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)

CMake Warning (dev): Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake --help-policy CMP0042" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

MACOSX_RPATH is not specified for the following targets:

LuaLib LuaLibShared wxLuaBindLib wxLuaDebugLib wxLuaDebuggerLib wxLuaLib wxLuaModule

This warning is for project developers. Use -Wno-dev to suppress it.

and the linker errors I am getting when I execute 'make' are:

[ 94%] Building CXX object modules/luamodule/CMakeFiles/wxLuaModule.dir/__/wxlua/wxlua_bind.cpp.o [ 94%] Linking CXX shared library ../../lib/Debug/libwx.dylib Undefined symbols for architecture x86_64: "_luaL_argerror", referenced from: _fieldargs in lbitlib.c.o wxLuaState::luaL_ArgError(int, char const) in wxlstate.cpp.o wxLuaState::luaL_ArgCheck(bool, int, char const) in wxlstate.cpp.o "_luaL_callmeta", referenced from: wxLuaState::luaL_CallMeta(int, char const*) in wxlstate.cpp.o "_luaL_checkany", referenced from: wxLuaState::luaL_CheckAny(int) in wxlstate.cpp.o "_luaL_checkinteger", referenced from: _b_arshift in lbitlib.c.o _b_lrot in lbitlib.c.o _b_lshift in lbitlib.c.o _b_rrot in lbitlib.c.o _b_rshift in lbitlib.c.o _fieldargs in lbitlib.c.o wxLuaState::luaL_CheckInteger(int) in wxlstate.cpp.o ...

MANY MORE ERRORS...

"_lua_typename", referenced from: wxlua_luaL_typename(lua_State, int) in wxllua.cpp.o wxLuaState::lua_TypeName(int) const in wxlstate.cpp.o wxLua_function_type(lua_State) in wxlua_bind.cpp.o "_lua_xmove", referenced from: wxLuaState::lua_XMove(wxLuaState const&, int) in wxlstate.cpp.o "_lua_yield", referenced from: wxLuaState::lua_Yield(int) in wxlstate.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [lib/Debug/libwx.dylib] Error 1 make[1]: [modules/luamodule/CMakeFiles/wxLuaModule.dir/all] Error 2 make: *** [all] Error 2

Any ideas/help appreciated, am looking forward to getting wxlua working so that I can use it with lua.

Thanks...IanQ

pkulchenko commented 3 years ago

Do I have to download a generic gcc version to be able to compile wxlua on OSX 10.15, or can I use the default OSX gcc, which really is clang?

The default one should be sufficient, as this is what I'm using for ZeroBrane Studio builds without issues.

Undefined symbols for architecture x86_64:

This seems to point to the wxwidgets library not compiled for x86_64. You are not showing the configure command that was used to build wxwidgets, but it needs to include --enable-macosx_arch=x86_64 to build a 64-bit version.

If you are using precompiled wxwidgets libraries, you need to make sure you use 64-bit libraries.

Any ideas/help appreciated, am looking forward to getting wxlua working so that I can use it with lua.

If everything fails, you can grab the wxlua library compiled for macOS (Lua 5.1).

ivq001 commented 3 years ago

Undefined symbols for architecture x86_64:

This seems to point to the wxwidgets library not compiled for x86_64. You are not showing the configure command that was used to build wxwidgets, but it needs to include --enable-macosx_arch=x86_64 to build a 64-bit version.

I used the configure command noted in section 2.6 of the wxlua installation instructions. The config log notes this:

Configured wxWidgets 3.1.4 for `x86_64-apple-darwin19.6.0'

Note that wxWidgets appeared to compile correctly for me, I was able to run the wxWidgets sample program without issue on OSX, I would think that would have failed too if the wxWidgets compile was incorrect.

../configure --prefix=$PWD \ --with-osx-cocoa \ --enable-unicode \ --disable-shared \ --enable-optimise=no \ --enable-mem_tracing=no \ --enable-profile=no \ --with-dmalloc=no \ \ --enable-debug \ --enable-debug_flag \ --enable-debug_info \ --enable-debug_gdb \ --enable-debug_cntxt \ \ --with-opengl \ --enable-sound \ --enable-mediactrl \ --enable-graphics_ctx \ --enable-controls \ --enable-dataviewctrl 2>&1 | tee configure-osx2ud.log

Would this not be an issue when building wxlua, that is when the error occurs. I followed the wxlua installation instructions so not sure where I went wrong.

How about the cmake warnings?

WARNING: Unable to find requested wxWidgets component : adv

Any idea why it states it cannot find adv? In the lib folder for wxWdigets is a file libwx_osx_cocoau_adv-3.1.a. (I did notice that the adv lib file is only about 1kb in size, seems rather small compared to the others. Again, wxWidgets did compile and I was able to run wxWidgets sample programs without issue.

IanQ

pkulchenko commented 3 years ago

Configured wxWidgets 3.1.4 for `x86_64-apple-darwin19.6.0' Note that wxWidgets appeared to compile correctly for me, I was able to run the wxWidgets sample program without issue on OSX, I would think that would have failed too if the wxWidgets compile was incorrect.

I agree, but the configuration still may be different.

WARNING: Unable to find requested wxWidgets component : adv

I wouldn't be concerned about this one; I get the same warning, but I think it's the result of reorganization on the wxwidgets side, which no longer produces the adv library.

Can you try building wxwidgets with --enable-macosx_arch=x86_64? It looks like x86_64-apple-darwin19.6.0 should produce the compatible binary, but I don't see any other issue.

ivq001 commented 3 years ago

Can you try building wxwidgets with --enable-macosx_arch=x86_64? It looks like x86_64-apple-darwin19.6.0 should produce the compatible binary, but I don't see any other issue.

I did try, same error.

Added --enable-macosx_arch=x86_64 \ to the configure-osxud.sh script, and from what I can glean from the makefile and config.log, it used -arch x86_64 everywhere.

IanQ

ivq001 commented 3 years ago

I decided to try to build wxlua on my other iMac, and am getting a different error at the same spot where I got the previous error.

[ 92%] Building CXX object modules/luamodule/CMakeFiles/wxLuaModule.dir//wxlua/wxlstate.cpp.o [ 93%] Building CXX object modules/luamodule/CMakeFiles/wxLuaModule.dir//wxlua/wxlua_bind.cpp.o [ 93%] Linking CXX shared library ../../lib/Debug/libwx.dylib ld: framework not found -lAVKit clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [lib/Debug/libwx.dylib] Error 1 make[1]: [modules/luamodule/CMakeFiles/wxLuaModule.dir/all] Error 2 make: *** [all] Error 2

Any ideas where I am going wrong?

IanQ

pkulchenko commented 3 years ago

@ivq001, I'm not sure what's going on and I've never seen these errors.

Could you try cloning ZeroBrane Studio (https://github.com/pkulchenko/ZeroBraneStudio) and building using its build script: cd build; bash build-maxos.sh lua wxwidgets wxlua? It does build the same (3.1.4) version of wxwidgets, and I'm curious if you run into any errors with that script.

ivq001 commented 3 years ago

@ivq001, I'm not sure what's going on and I've never seen these errors.

Could you try cloning ZeroBrane Studio (https://github.com/pkulchenko/ZeroBraneStudio) and building using its build script: cd build; bash build-maxos.sh lua wxwidgets wxlua? It does build the same (3.1.4) version of wxwidgets, and I'm curious if you run into any errors with that script.

This worked on one of my iMacs, the one that got the error about not finding the AVKit. The other iMac had errors, so sounds to me like I should concentrate on the machine that built this properly. ... [ 93%] Building CXX object modules/luamodule/CMakeFiles/wxLuaModule.dir//wxlua/wxlobject.cpp.o [ 95%] Building CXX object modules/luamodule/CMakeFiles/wxLuaModule.dir//wxlua/wxlstate.cpp.o [ 97%] Building CXX object modules/luamodule/CMakeFiles/wxLuaModule.dir/__/wxlua/wxlua_bind.cpp.o [100%] Linking CXX shared library ../../lib/MinSizeRel/libwx.dylib [100%] Built target wxLuaModule Install the project... -- Install configuration: "MinSizeRel" -- Installing: /Users/ian/tmp/ZeroBraneStudio-master/build/deps/lib/libwx.dylib Build has been successfully completed

As for not finding AVKit, have no idea why it is getting this, I did make sure the Xcode command line tools were installed, and even re-installed the tools. From searching, I can find the AVKit framework...is this error just a wild goose chase?

IanQ

pkulchenko commented 3 years ago

I'm not familiar with AVKit, but maybe it's used for media component that may be included by default, but is not included in my build configuration (so you don't get the error).

I'm closing this one, as I don't see any issue I could fix. Feel free to update if you find what's breaking the build on your other machine.