Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help required in compiling #1

Closed
evnix opened this issue May 5, 2018 · 5 comments
Closed

help required in compiling #1

evnix opened this issue May 5, 2018 · 5 comments

Comments

@evnix
Copy link

evnix commented May 5, 2018

I am basically trying to compile your code

The following is where I have reached: (I am sorry if the steps I am following may be completely wrong as I am new to C and GCC in general, I am just trying my best to bring this puzzle together)

It has two dependencies:

https://github.com/andlabs/libui
Lua from https://www.lua.org/download.html
I was able to generate two files from the above 2 projects:

liblua.a
libui.a
I was happy so far, but I am not able to figure out how to use the above .a files and compile the zhaozg/lui project.

The instructions on compiling are as follows:

gcc -shared -Isrc src/lui.c -I{LUAINCDIR} -I{LIBUVINCDIR} -lui -llua-5.1 -o luv.so
Also, I am trying to keep the compiled files locally and not have them copied all over /usr/local

So, After a few hours, I reached the following step:

gcc -shared -v -Isrc src/lui.c -I ../lua-src -I ../libui /Users/silva/Documents/test00x/lui/liblua.a /Users/silva/Documents/test00x/lui/libui.a
But now I am stuck at the following error:

gcc -shared -v -Isrc src/lui.c -I ../lua-src  -I ../libui   /Users/silva/Documents/test00x/lui/liblua.a  /Users/silva/Documents/test00x/lui/libui.a
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name lui.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 351.8 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0 -I src -I ../lua-src -I ../libui -fdebug-compilation-dir /Users/silva/Documents/test00x/lui -ferror-limit 19 -fmessage-length 129 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.13.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/ps/568797890l55qcbrzmcjd6tr0000gp/T/lui-101fc8.o -x c src/lui.c
clang -cc1 version 9.1.0 (clang-902.0.39.1) default target x86_64-apple-darwin17.5.0
#include "..." search starts here:
#include <...> search starts here:
 src
 ../lua-src
 ../libui
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
src/lui.c:152:13: warning: implicit declaration of function 'luaL_checkint' is invalid in C99 [-Wimplicit-function-declaration]
      ret = luaL_checkint(L, -1);
            ^
In file included from src/lui.c:210:
src/ldraw.c:51:3: warning: implicit declaration of function '_i64toa' is invalid in C99 [-Wimplicit-function-declaration]
  lua_pushINT64(L, evt->Held1To64);
  ^
src/ldraw.c:26:23: note: expanded from macro 'lua_pushINT64'
    lua_pushstring(L, _i64toa(n, buf, 10));          \
                      ^
src/ldraw.c:51:3: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *'
      [-Wint-conversion]
  lua_pushINT64(L, evt->Held1To64);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ldraw.c:26:23: note: expanded from macro 'lua_pushINT64'
    lua_pushstring(L, _i64toa(n, buf, 10));          \
                      ^~~~~~~~~~~~~~~~~~~
/usr/local/include/lua.h:228:65: note: passing argument to parameter 's' here
LUA_API const char *(lua_pushstring) (lua_State *L, const char *s);
                                                                ^
In file included from src/lui.c:210:
src/ldraw.c:796:9: warning: implicit declaration of function 'luaL_optint' is invalid in C99 [-Wimplicit-function-declaration]
  def = luaL_optint(L, -1, def);
        ^
In file included from src/lui.c:211:
src/lentry.c:1:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewEntry(lua_State *L)
~~~~~~ ^
src/lentry.c:10:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewPasswordEntry(lua_State *L)
~~~~~~ ^
src/lentry.c:19:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewSearchEntry(lua_State *L)
~~~~~~ ^
src/lentry.c:28:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiEntryText(lua_State *L)
~~~~~~ ^
src/lentry.c:51:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiEntryReadOnly(lua_State *L)
~~~~~~ ^
In file included from src/lui.c:220:
src/lmultiline.c:1:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewMultilineEntry(lua_State *L)
~~~~~~ ^
src/lmultiline.c:10:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewNonWrappingMultilineEntry(lua_State *L)
~~~~~~ ^
src/lmultiline.c:19:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiMultilineEntryText(lua_State *L)
~~~~~~ ^
src/lmultiline.c:30:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiMultilineEntryAppend(lua_State *L)
~~~~~~ ^
src/lmultiline.c:48:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiMultilineEntryReadOnly(lua_State *L)
~~~~~~ ^
14 warnings generated.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -dylib -arch x86_64 -macosx_version_min 10.13.0 -o a.out /var/folders/ps/568797890l55qcbrzmcjd6tr0000gp/T/lui-101fc8.o /Users/silva/Documents/test00x/lui/liblua.a /Users/silva/Documents/test00x/lui/libui.a -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "_CFArrayAppendValue", referenced from:
      _addCTFeatureEntry in libui.a(libui-combined.o)
  "_CFArrayCreateMutable", referenced from:
      _uiprivOpenTypeFeaturesToCTFeatures in libui.a(libui-combined.o)
  "_CFArrayGetCount", referenced from:
      _matchStyle in libui.a(libui-combined.o)
      _uiprivMakeVariationAxisDict in libui.a(libui-combined.o)
  "_CFArrayGetValueAtIndex", referenced from:
      _matchStyle in libui.a(libui-combined.o)
      _uiprivMakeVariationAxisDict in libui.a(libui-combined.o)
  "_CFAttributedStringBeginEditing", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
  "_CFAttributedStringCreate", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
  "_CFAttributedStringCreateMutableCopy", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
  "_CFAttributedStringEndEditing", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
  "_CFAttributedStringGetAttribute", referenced from:
      _applyFontAttributes in libui.a(libui-combined.o)
      _addFontAttributeToRange in libui.a(libui-combined.o)
  "_CFAttributedStringGetLength", referenced from:
      _applyFontAttributes in libui.a(libui-combined.o)
      -[uiprivTextFrame initWithLayoutParams:] in libui.a(libui-combined.o)
  "_CFAttributedStringRemoveAttribute", referenced from:
      _applyFontAttributes in libui.a(libui-combined.o)
  "_CFAttributedStringSetAttribute", referenced from:
      _processAttribute in libui.a(libui-combined.o)
      _applyFontAttributes in libui.a(libui-combined.o)
      _addFontAttributeToRange in libui.a(libui-combined.o)
      _addBackgroundAttribute in libui.a(libui-combined.o)
  "_CFDataGetBytePtr", referenced from:
      _trySecondaryOS2Values in libui.a(libui-combined.o)
      _avarExtract in libui.a(libui-combined.o)
  "_CFDataGetLength", referenced from:
      _trySecondaryOS2Values in libui.a(libui-combined.o)
  "_CFDictionaryAddValue", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
  "_CFDictionaryCreate", referenced from:
      _uiprivCTFontDescriptorAppendFeatures in libui.a(libui-combined.o)
      _addCTFeatureEntry in libui.a(libui-combined.o)
  "_CFDictionaryCreateMutable", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
  "_CFDictionaryGetValue", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
      _extractAxisDictValue in libui.a(libui-combined.o)
      _uiprivMakeVariationAxisDict in libui.a(libui-combined.o)
      _tryAxis in libui.a(libui-combined.o)
  "_CFEqual", referenced from:
      _trySecondaryOS2Values in libui.a(libui-combined.o)
  "_CFNumberCreate", referenced from:
      _processAttribute in libui.a(libui-combined.o)
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
      _addCTFeatureEntry in libui.a(libui-combined.o)
  "_CFNumberGetValue", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
      _extractAxisDictValue in libui.a(libui-combined.o)
      _tryAxis in libui.a(libui-combined.o)
  "_CFRelease", referenced from:
      -[uiprivCombinedFontAttr toCTFontWithDefaultFont:] in libui.a(libui-combined.o)
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
      _processAttribute in libui.a(libui-combined.o)
      _applyFontAttributes in libui.a(libui-combined.o)
      _mkcolor in libui.a(libui-combined.o)
      _addBackgroundAttribute in libui.a(libui-combined.o)
      -[uiprivTextFrame dealloc] in libui.a(libui-combined.o)
      ...
  "_CFRetain", referenced from:
      -[uiprivFontStyleData initWithFont:] in libui.a(libui-combined.o)
      -[uiprivFontStyleData initWithDescriptor:] in libui.a(libui-combined.o)
      _matchStyle in libui.a(libui-combined.o)
  "_CFStringCreateWithCString", referenced from:
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
      _otfArrayForEachOT in libui.a(libui-combined.o)
  "_CFStringCreateWithCharacters", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
  "_CFStringCreateWithCharactersNoCopy", referenced from:
      _uiprivNewGraphemes in libui.a(libui-combined.o)
  "_CFStringFind", referenced from:
      _guessItalicOblique in libui.a(libui-combined.o)
  "_CFStringFindWithOptions", referenced from:
      _testTTFOTFSubfamilyName in libui.a(libui-combined.o)
  "_CFStringGetLength", referenced from:
      _testTTFOTFSubfamilyName in libui.a(libui-combined.o)
  "_CFStringGetRangeOfComposedCharactersAtIndex", referenced from:
      _uiprivNewGraphemes in libui.a(libui-combined.o)
  "_CGAffineTransformConcat", referenced from:
      _uiDrawMatrixMultiply in libui.a(libui-combined.o)
  "_CGAffineTransformEqualToTransform", referenced from:
      _uiDrawMatrixInvertible in libui.a(libui-combined.o)
      _uiDrawMatrixInvert in libui.a(libui-combined.o)
  "_CGAffineTransformIdentity", referenced from:
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
  "_CGAffineTransformInvert", referenced from:
      _uiDrawMatrixInvertible in libui.a(libui-combined.o)
      _uiDrawMatrixInvert in libui.a(libui-combined.o)
  "_CGAffineTransformRotate", referenced from:
      _uiDrawMatrixRotate in libui.a(libui-combined.o)
  "_CGAffineTransformScale", referenced from:
      _uiDrawMatrixScale in libui.a(libui-combined.o)
  "_CGAffineTransformTranslate", referenced from:
      _uiDrawMatrixTranslate in libui.a(libui-combined.o)
      _uiDrawMatrixScale in libui.a(libui-combined.o)
      _uiDrawMatrixRotate in libui.a(libui-combined.o)
  "_CGColorCreate", referenced from:
      _mkcolor in libui.a(libui-combined.o)
  "_CGColorSpaceCreateWithName", referenced from:
      _mkcolor in libui.a(libui-combined.o)
      _fillGradient in libui.a(libui-combined.o)
  "_CGColorSpaceRelease", referenced from:
      _fillGradient in libui.a(libui-combined.o)
  "_CGContextAddPath", referenced from:
      _uiDrawFill in libui.a(libui-combined.o)
      _uiDrawClip in libui.a(libui-combined.o)
  "_CGContextClip", referenced from:
      _fillGradient in libui.a(libui-combined.o)
      _uiDrawClip in libui.a(libui-combined.o)
  "_CGContextConcatCTM", referenced from:
      _uiDrawTransform in libui.a(libui-combined.o)
  "_CGContextDrawLinearGradient", referenced from:
      _fillGradient in libui.a(libui-combined.o)
  "_CGContextDrawRadialGradient", referenced from:
      _fillGradient in libui.a(libui-combined.o)
  "_CGContextEOClip", referenced from:
      _fillGradient in libui.a(libui-combined.o)
      _uiDrawClip in libui.a(libui-combined.o)
  "_CGContextEOFillPath", referenced from:
      _fillSolid in libui.a(libui-combined.o)
  "_CGContextFillPath", referenced from:
      _fillSolid in libui.a(libui-combined.o)
  "_CGContextGetTextMatrix", referenced from:
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
  "_CGContextRestoreGState", referenced from:
      _fillGradient in libui.a(libui-combined.o)
      _uiDrawRestore in libui.a(libui-combined.o)
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
  "_CGContextSaveGState", referenced from:
      _fillGradient in libui.a(libui-combined.o)
      _uiDrawSave in libui.a(libui-combined.o)
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
  "_CGContextScaleCTM", referenced from:
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
  "_CGContextSetRGBFillColor", referenced from:
      _fillSolid in libui.a(libui-combined.o)
  "_CGContextSetTextMatrix", referenced from:
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
  "_CGContextTranslateCTM", referenced from:
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
  "_CGGradientCreateWithColorComponents", referenced from:
      _fillGradient in libui.a(libui-combined.o)
  "_CGGradientRelease", referenced from:
      _fillGradient in libui.a(libui-combined.o)
  "_CGPathAddArc", referenced from:
      _uiDrawPathArcTo in libui.a(libui-combined.o)
  "_CGPathAddCurveToPoint", referenced from:
      _uiDrawPathBezierTo in libui.a(libui-combined.o)
  "_CGPathAddLineToPoint", referenced from:
      _uiDrawPathLineTo in libui.a(libui-combined.o)
  "_CGPathAddRect", referenced from:
      _uiDrawPathAddRectangle in libui.a(libui-combined.o)
  "_CGPathCloseSubpath", referenced from:
      _uiDrawPathCloseFigure in libui.a(libui-combined.o)
  "_CGPathCreateCopyByDashingPath", referenced from:
      _uiDrawStroke in libui.a(libui-combined.o)
  "_CGPathCreateCopyByStrokingPath", referenced from:
      _uiDrawStroke in libui.a(libui-combined.o)
  "_CGPathCreateMutable", referenced from:
      _uiDrawNewPath in libui.a(libui-combined.o)
  "_CGPathCreateWithRect", referenced from:
      -[uiprivTextFrame initWithLayoutParams:] in libui.a(libui-combined.o)
  "_CGPathMoveToPoint", referenced from:
      _uiDrawPathNewFigure in libui.a(libui-combined.o)
      _uiDrawPathNewFigureWithArc in libui.a(libui-combined.o)
  "_CGPathRelease", referenced from:
      _uiDrawFreePath in libui.a(libui-combined.o)
      _uiDrawStroke in libui.a(libui-combined.o)
  "_CGPointZero", referenced from:
      -[uiprivTextFrame initWithLayoutParams:] in libui.a(libui-combined.o)
  "_CTFontCopyFontDescriptor", referenced from:
      -[uiprivFontButton getfontdesc:] in libui.a(libui-combined.o)
      -[uiprivFontStyleData initWithFont:] in libui.a(libui-combined.o)
  "_CTFontCopyName", referenced from:
      -[uiprivFontStyleData fontName:] in libui.a(libui-combined.o)
  "_CTFontCopyPostScriptName", referenced from:
      -[uiprivFontStyleData postScriptName] in libui.a(libui-combined.o)
  "_CTFontCopyTable", referenced from:
      -[uiprivFontStyleData table:] in libui.a(libui-combined.o)
  "_CTFontCopyVariationAxes", referenced from:
      -[uiprivFontStyleData variationAxes] in libui.a(libui-combined.o)
  "_CTFontCreateWithFontDescriptor", referenced from:
      -[uiprivCombinedFontAttr toCTFontWithDefaultFont:] in libui.a(libui-combined.o)
      -[uiprivFontStyleData ensureFont] in libui.a(libui-combined.o)
  "_CTFontDescriptorCopyAttribute", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
      -[uiprivFontStyleData styleName] in libui.a(libui-combined.o)
      -[uiprivFontStyleData variation] in libui.a(libui-combined.o)
      _uiprivFontDescriptorFromCTFontDescriptor in libui.a(libui-combined.o)
  "_CTFontDescriptorCreateCopyWithAttributes", referenced from:
      _uiprivCTFontDescriptorAppendFeatures in libui.a(libui-combined.o)
  "_CTFontDescriptorCreateMatchingFontDescriptors", referenced from:
      _matchStyle in libui.a(libui-combined.o)
  "_CTFontDescriptorCreateWithAttributes", referenced from:
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
  "_CTFontGetSize", referenced from:
      -[uiprivFontButton getfontdesc:] in libui.a(libui-combined.o)
  "_CTFrameDraw", referenced from:
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
  "_CTFrameGetLines", referenced from:
      -[uiprivTextFrame lines] in libui.a(libui-combined.o)
  "_CTFramesetterCreateFrame", referenced from:
      -[uiprivTextFrame initWithLayoutParams:] in libui.a(libui-combined.o)
  "_CTFramesetterCreateWithAttributedString", referenced from:
      -[uiprivTextFrame initWithLayoutParams:] in libui.a(libui-combined.o)
  "_CTFramesetterSuggestFrameSizeWithConstraints", referenced from:
      -[uiprivTextFrame initWithLayoutParams:] in libui.a(libui-combined.o)
  "_CTParagraphStyleCreate", referenced from:
      _mkParagraphStyle in libui.a(libui-combined.o)
  "_NSApp", referenced from:
      -[applicationClass terminate:] in libui.a(libui-combined.o)
      _uiInit in libui.a(libui-combined.o)
      _uiUninit in libui.a(libui-combined.o)
      _uiMain in libui.a(libui-combined.o)
      ___uiMain_block_invoke in libui.a(libui-combined.o)
      _uiMainSteps in libui.a(libui-combined.o)
      _mainStep in libui.a(libui-combined.o)
      ...
  "_NSAppKitVersionNumber", referenced from:
      _stepperYDelta in libui.a(libui-combined.o)
  "_NSCalibratedRGBColorSpace", referenced from:
      _uiImageAppend in libui.a(libui-combined.o)
  "_NSDefaultRunLoopMode", referenced from:
      _uiMainStep in libui.a(libui-combined.o)
  "_NSDisableScreenUpdates", referenced from:
      _minMaxAutoLayoutSizes in libui.a(libui-combined.o)
  "_NSEnableScreenUpdates", referenced from:
      _minMaxAutoLayoutSizes in libui.a(libui-combined.o)
  "_NSEndMapTableEnumeration", referenced from:
      _mapWalk in libui.a(libui-combined.o)
  "_NSEnumerateMapTable", referenced from:
      _mapWalk in libui.a(libui-combined.o)
  "_NSEventTrackingRunLoopMode", referenced from:
      _doManualMove in libui.a(libui-combined.o)
      _doManualResize in libui.a(libui-combined.o)
  "_NSFontAttributeName", referenced from:
      _finishMultilineEntry in libui.a(libui-combined.o)
  "_NSLog", referenced from:
      _uiprivRealBug in libui.a(libui-combined.o)
      -[appDelegate applicationShouldTerminate:] in libui.a(libui-combined.o)
      _loadUndocumented in libui.a(libui-combined.o)
  "_NSMapGet", referenced from:
      _mapGet in libui.a(libui-combined.o)
  "_NSMapInsert", referenced from:
      _mapSet in libui.a(libui-combined.o)
  "_NSMapRemove", referenced from:
      _mapDelete in libui.a(libui-combined.o)
  "_NSNextMapEnumeratorPair", referenced from:
      _mapWalk in libui.a(libui-combined.o)
  "_NSResetMapTable", referenced from:
      _mapReset in libui.a(libui-combined.o)
  "_NSWindowWillCloseNotification", referenced from:
      -[colorButton activate:] in libui.a(libui-combined.o)
      -[colorButton deactivate] in libui.a(libui-combined.o)
      -[uiprivFontButton activateFontButton] in libui.a(libui-combined.o)
      -[uiprivFontButton deactivateFontButton:] in libui.a(libui-combined.o)
  "_NSZeroPoint", referenced from:
      -[applicationClass terminate:] in libui.a(libui-combined.o)
  "_NSZeroRect", referenced from:
      _uiNewArea in libui.a(libui-combined.o)
      -[boxView initWithVertical:b:] in libui.a(libui-combined.o)
      _uiNewButton in libui.a(libui-combined.o)
      _uiNewCheckbox in libui.a(libui-combined.o)
      _uiNewColorButton in libui.a(libui-combined.o)
      _uiNewCombobox in libui.a(libui-combined.o)
      _finishNewDateTimePicker in libui.a(libui-combined.o)
      ...
  "_NSZeroSize", referenced from:
      _makeIndependent in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSAlert", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSApplication", referenced from:
      _OBJC_CLASS_$_applicationClass in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSArrayController", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSAutoreleasePool", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSBitmapImageRep", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSBox", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSButton", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
      _OBJC_CLASS_$_uiprivFontButton in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSColor", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSColorPanel", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSColorSpace", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSColorWell", referenced from:
      _OBJC_CLASS_$_colorButton in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSComboBox", referenced from:
      _OBJC_CLASS_$_libui_intrinsicWidthNSComboBox in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSDate", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSDatePicker", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSDictionary", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSEvent", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSFont", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSFontManager", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSFontPanel", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
      _OBJC_CLASS_$_uiprivNonModalFontPanel in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSGraphicsContext", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSImage", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSLayoutConstraint", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSMapTable", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSMenu", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSMenuItem", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSMutableArray", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSMutableDictionary", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSMutableString", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSNotificationCenter", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSNumber", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSNumberFormatter", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSObject", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
      _OBJC_CLASS_$_uiprivCombinedFontAttr in libui.a(libui-combined.o)
      _OBJC_CLASS_$_boxChild in libui.a(libui-combined.o)
      _OBJC_CLASS_$_buttonDelegateClass in libui.a(libui-combined.o)
      _OBJC_CLASS_$_checkboxDelegateClass in libui.a(libui-combined.o)
      _OBJC_CLASS_$_comboboxDelegateClass in libui.a(libui-combined.o)
      _OBJC_CLASS_$_uiprivDrawTextBackgroundParams in libui.a(libui-combined.o)
      ...
  "_OBJC_CLASS_$_NSOpenPanel", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSPopUpButton", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSProcessInfo", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSProgressIndicator", referenced from:
      _OBJC_CLASS_$_intrinsicWidthNSProgressIndicator in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSSavePanel", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSScrollView", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSSearchField", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
      _OBJC_CLASS_$_libui_intrinsicWidthNSSearchField in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSSecureTextField", referenced from:
      _OBJC_CLASS_$_libui_intrinsicWidthNSSecureTextField in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSSlider", referenced from:
      _OBJC_CLASS_$_libui_intrinsicWidthNSSlider in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSStepper", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSString", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSTabView", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSTabViewItem", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSTextField", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
      _OBJC_CLASS_$_libui_intrinsicWidthNSTextField in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSTextView", referenced from:
      _OBJC_CLASS_$_intrinsicSizeTextView in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSTimer", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSTrackingArea", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSValue", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
  "_OBJC_CLASS_$_NSView", referenced from:
      objc-class-ref in libui.a(libui-combined.o)
      _OBJC_CLASS_$_areaView in libui.a(libui-combined.o)
      _OBJC_CLASS_$_boxView in libui.a(libui-combined.o)
      _OBJC_CLASS_$_formChild in libui.a(libui-combined.o)
      _OBJC_CLASS_$_formView in libui.a(libui-combined.o)
      _OBJC_CLASS_$_gridChild in libui.a(libui-combined.o)
      _OBJC_CLASS_$_gridView in libui.a(libui-combined.o)
      ...
  "_OBJC_CLASS_$_NSWindow", referenced from:
      _OBJC_CLASS_$_libuiNSWindow in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSApplication", referenced from:
      _OBJC_METACLASS_$_applicationClass in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSButton", referenced from:
      _OBJC_METACLASS_$_uiprivFontButton in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSColorWell", referenced from:
      _OBJC_METACLASS_$_colorButton in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSComboBox", referenced from:
      _OBJC_METACLASS_$_libui_intrinsicWidthNSComboBox in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSFontPanel", referenced from:
      _OBJC_METACLASS_$_uiprivNonModalFontPanel in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSObject", referenced from:
      _OBJC_METACLASS_$_areaView in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_uiprivCombinedFontAttr in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_boxChild in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_boxView in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_buttonDelegateClass in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_checkboxDelegateClass in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_colorButton in libui.a(libui-combined.o)
      ...
  "_OBJC_METACLASS_$_NSProgressIndicator", referenced from:
      _OBJC_METACLASS_$_intrinsicWidthNSProgressIndicator in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSSearchField", referenced from:
      _OBJC_METACLASS_$_libui_intrinsicWidthNSSearchField in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSSecureTextField", referenced from:
      _OBJC_METACLASS_$_libui_intrinsicWidthNSSecureTextField in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSSlider", referenced from:
      _OBJC_METACLASS_$_libui_intrinsicWidthNSSlider in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSTextField", referenced from:
      _OBJC_METACLASS_$_libui_intrinsicWidthNSTextField in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSTextView", referenced from:
      _OBJC_METACLASS_$_intrinsicSizeTextView in libui.a(libui-combined.o)
  "_OBJC_METACLASS_$_NSView", referenced from:
      _OBJC_METACLASS_$_areaView in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_boxView in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_formChild in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_formView in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_gridChild in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_gridView in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_libui_spinbox in libui.a(libui-combined.o)
      ...
  "_OBJC_METACLASS_$_NSWindow", referenced from:
      _OBJC_METACLASS_$_libuiNSWindow in libui.a(libui-combined.o)
  "___CFConstantStringClassReference", referenced from:
      CFString in libui.a(libui-combined.o)
      CFString in libui.a(libui-combined.o)
      CFString in libui.a(libui-combined.o)
      CFString in libui.a(libui-combined.o)
      CFString in libui.a(libui-combined.o)
      CFString in libui.a(libui-combined.o)
      CFString in libui.a(libui-combined.o)
      ...
  "___objc_personality_v0", referenced from:
      _otfArrayForEachAAT in libui.a(libui-combined.o)
      _doManualMove in libui.a(libui-combined.o)
      _doManualResize in libui.a(libui-combined.o)
      Dwarf Exception Unwind Info (__eh_frame) in libui.a(libui-combined.o)
      Dwarf Exception Unwind Info (__eh_frame) in libui.a(libui-combined.o)
  "__i64toa", referenced from:
      _l_uiAreaMouseEvent_2_table in lui-101fc8.o
  "__objc_empty_cache", referenced from:
      _OBJC_CLASS_$_areaView in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_areaView in libui.a(libui-combined.o)
      _OBJC_CLASS_$_uiprivCombinedFontAttr in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_uiprivCombinedFontAttr in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_boxChild in libui.a(libui-combined.o)
      _OBJC_CLASS_$_boxChild in libui.a(libui-combined.o)
      _OBJC_CLASS_$_boxView in libui.a(libui-combined.o)
      ...
  "__objc_empty_vtable", referenced from:
      _OBJC_CLASS_$_areaView in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_areaView in libui.a(libui-combined.o)
      _OBJC_CLASS_$_uiprivCombinedFontAttr in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_uiprivCombinedFontAttr in libui.a(libui-combined.o)
      _OBJC_METACLASS_$_boxChild in libui.a(libui-combined.o)
      _OBJC_CLASS_$_boxChild in libui.a(libui-combined.o)
      _OBJC_CLASS_$_boxView in libui.a(libui-combined.o)
      ...
  "_kCFAllocatorNull", referenced from:
      _uiprivNewGraphemes in libui.a(libui-combined.o)
  "_kCFCopyStringDictionaryKeyCallBacks", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
      _uiprivCTFontDescriptorAppendFeatures in libui.a(libui-combined.o)
      _addCTFeatureEntry in libui.a(libui-combined.o)
  "_kCFTypeArrayCallBacks", referenced from:
      _uiprivOpenTypeFeaturesToCTFeatures in libui.a(libui-combined.o)
  "_kCFTypeDictionaryValueCallBacks", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
      _uiprivCTFontDescriptorAppendFeatures in libui.a(libui-combined.o)
      _addCTFeatureEntry in libui.a(libui-combined.o)
  "_kCGColorSpaceSRGB", referenced from:
      _mkcolor in libui.a(libui-combined.o)
      _fillGradient in libui.a(libui-combined.o)
  "_kCTFontAttributeName", referenced from:
      _applyFontAttributes in libui.a(libui-combined.o)
  "_kCTFontFamilyNameAttribute", referenced from:
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
      _uiprivFontDescriptorFromCTFontDescriptor in libui.a(libui-combined.o)
  "_kCTFontFamilyNameKey", referenced from:
      -[uiprivFontStyleData familyName] in libui.a(libui-combined.o)
  "_kCTFontFeatureSelectorIdentifierKey", referenced from:
      ___otfArrayForEachAAT_block_invoke in libui.a(libui-combined.o)
  "_kCTFontFeatureSettingsAttribute", referenced from:
      _uiprivCTFontDescriptorAppendFeatures in libui.a(libui-combined.o)
  "_kCTFontFeatureTypeIdentifierKey", referenced from:
      ___otfArrayForEachAAT_block_invoke in libui.a(libui-combined.o)
  "_kCTFontFormatAttribute", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
  "_kCTFontFullNameKey", referenced from:
      -[uiprivFontStyleData fullName] in libui.a(libui-combined.o)
  "_kCTFontRegistrationScopeAttribute", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
  "_kCTFontSizeAttribute", referenced from:
      _uiprivFontDescriptorToCTFontDescriptor in libui.a(libui-combined.o)
  "_kCTFontStyleNameAttribute", referenced from:
      -[uiprivFontStyleData styleName] in libui.a(libui-combined.o)
  "_kCTFontSubFamilyNameKey", referenced from:
      -[uiprivFontStyleData subFamilyName] in libui.a(libui-combined.o)
  "_kCTFontSymbolicTrait", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
  "_kCTFontTraitsAttribute", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
  "_kCTFontVariationAttribute", referenced from:
      -[uiprivFontStyleData variation] in libui.a(libui-combined.o)
  "_kCTFontVariationAxisDefaultValueKey", referenced from:
      -[fvarAxis initWithIndex:dict:avarTable:] in libui.a(libui-combined.o)
  "_kCTFontVariationAxisIdentifierKey", referenced from:
      _uiprivMakeVariationAxisDict in libui.a(libui-combined.o)
  "_kCTFontVariationAxisMaximumValueKey", referenced from:
      -[fvarAxis initWithIndex:dict:avarTable:] in libui.a(libui-combined.o)
  "_kCTFontVariationAxisMinimumValueKey", referenced from:
      -[fvarAxis initWithIndex:dict:avarTable:] in libui.a(libui-combined.o)
  "_kCTFontWeightTrait", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
  "_kCTFontWidthTrait", referenced from:
      -[uiprivFontStyleData prepare] in libui.a(libui-combined.o)
  "_kCTForegroundColorAttributeName", referenced from:
      _processAttribute in libui.a(libui-combined.o)
  "_kCTParagraphStyleAttributeName", referenced from:
      _uiprivAttributedStringToCFAttributedString in libui.a(libui-combined.o)
  "_kCTUnderlineColorAttributeName", referenced from:
      _processAttribute in libui.a(libui-combined.o)
  "_kCTUnderlineStyleAttributeName", referenced from:
      _processAttribute in libui.a(libui-combined.o)
  "_luaL_checkint", referenced from:
      _l_uiAreaSetSize in lui-101fc8.o
      _l_uiAreaBeginUserWindowResize in lui-101fc8.o
      _l_uiAttributedStringInsertAtUnattributed in lui-101fc8.o
      _l_uiAttributedStringDelete in lui-101fc8.o
      _l_uiAttributedStringSetAttribute in lui-101fc8.o
      _l_uiAttributedStringByteIndexToGrapheme in lui-101fc8.o
      _l_uiAttributedStringGraphemeToByteIndex in lui-101fc8.o
      ...
     (maybe you meant: _luaL_checkinteger)
  "_objc_autoreleasePoolPop", referenced from:
      -[uiprivCombinedFontAttr hash] in libui.a(libui-combined.o)
      _uiInit in libui.a(libui-combined.o)
      _uiUninit in libui.a(libui-combined.o)
      _mainStep in libui.a(libui-combined.o)
      _newItem in libui.a(libui-combined.o)
      _uiNewMenu in libui.a(libui-combined.o)
  "_objc_autoreleasePoolPush", referenced from:
      -[uiprivCombinedFontAttr hash] in libui.a(libui-combined.o)
      _uiInit in libui.a(libui-combined.o)
      _uiUninit in libui.a(libui-combined.o)
      _mainStep in libui.a(libui-combined.o)
      _newItem in libui.a(libui-combined.o)
      _uiNewMenu in libui.a(libui-combined.o)
  "_objc_enumerationMutation", referenced from:
      _uninitAlloc in libui.a(libui-combined.o)
      -[boxView onDestroy] in libui.a(libui-combined.o)
      -[boxView syncEnableStates:] in libui.a(libui-combined.o)
      -[boxView establishOurConstraints] in libui.a(libui-combined.o)
      -[boxView setPadded:] in libui.a(libui-combined.o)
      -[boxView nStretchy] in libui.a(libui-combined.o)
      -[uiprivTextFrame draw:textLayout:at:y:] in libui.a(libui-combined.o)
      ...
  "_objc_getProperty", referenced from:
      -[formChild label] in libui.a(libui-combined.o)
      -[formChild baseline] in libui.a(libui-combined.o)
      -[formChild leading] in libui.a(libui-combined.o)
      -[formChild top] in libui.a(libui-combined.o)
      -[formChild trailing] in libui.a(libui-combined.o)
      -[formChild bottom] in libui.a(libui-combined.o)
      -[gridChild leadingc] in libui.a(libui-combined.o)
      ...
  "_objc_msgSend", referenced from:
      _initAlloc in libui.a(libui-combined.o)
      _uninitAlloc in libui.a(libui-combined.o)
      _uiprivAlloc in libui.a(libui-combined.o)
      _uiprivRealloc in libui.a(libui-combined.o)
      _uiprivFree in libui.a(libui-combined.o)
      -[areaView initWithFrame:area:] in libui.a(libui-combined.o)
      -[areaView drawRect:] in libui.a(libui-combined.o)
      ...
  "_objc_msgSendSuper2", referenced from:
      -[areaView initWithFrame:area:] in libui.a(libui-combined.o)
      -[areaView setFrameSize:] in libui.a(libui-combined.o)
      -[areaView intrinsicContentSize] in libui.a(libui-combined.o)
      -[uiprivCombinedFontAttr init] in libui.a(libui-combined.o)
      -[uiprivCombinedFontAttr dealloc] in libui.a(libui-combined.o)
      -[boxView initWithVertical:b:] in libui.a(libui-combined.o)
      -[buttonDelegateClass init] in libui.a(libui-combined.o)
      ...
  "_objc_msgSend_stret", referenced from:
      -[areaView drawRect:] in libui.a(libui-combined.o)
      -[areaView setupNewTrackingArea] in libui.a(libui-combined.o)
      -[areaView doMouseEvent:] in libui.a(libui-combined.o)
      -[intrinsicSizeTextView intrinsicContentSize] in libui.a(libui-combined.o)
      _uiWindowContentSize in libui.a(libui-combined.o)
      _makeIndependent in libui.a(libui-combined.o)
      _doManualMove in libui.a(libui-combined.o)
      ...
  "_objc_setProperty_atomic", referenced from:
      -[formChild setLabel:] in libui.a(libui-combined.o)
      -[formChild setBaseline:] in libui.a(libui-combined.o)
      -[formChild setLeading:] in libui.a(libui-combined.o)
      -[formChild setTop:] in libui.a(libui-combined.o)
      -[formChild setTrailing:] in libui.a(libui-combined.o)
      -[formChild setBottom:] in libui.a(libui-combined.o)
      -[gridChild setLeadingc:] in libui.a(libui-combined.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@evnix
Copy link
Author

evnix commented May 5, 2018

OK, now I made a little more progress, with the following command:

gcc -shared -v -framework Foundation -framework AppKit -Isrc src/lui.c -I ../lua-src  -I ../libui   /Users/silva/Documents/test00x/lui/liblua.a  /Users/silva/Documents/test00x/lui/libui.a 
gcc -shared -v -framework Foundation -framework AppKit -Isrc src/lui.c -I ../lua-src  -I ../libui   /Users/silva/Documents/test00x/lui/liblua.a  /Users/silva/Documents/test00x/lui/libui.a 
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name lui.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 351.8 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0 -I src -I ../lua-src -I ../libui -fdebug-compilation-dir /Users/silva/Documents/test00x/lui -ferror-limit 19 -fmessage-length 129 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.13.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/ps/568797890l55qcbrzmcjd6tr0000gp/T/lui-1a6531.o -x c src/lui.c
clang -cc1 version 9.1.0 (clang-902.0.39.1) default target x86_64-apple-darwin17.5.0
#include "..." search starts here:
#include <...> search starts here:
 src
 ../lua-src
 ../libui
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
src/lui.c:152:13: warning: implicit declaration of function 'luaL_checkint' is invalid in C99 [-Wimplicit-function-declaration]
      ret = luaL_checkint(L, -1);
            ^
In file included from src/lui.c:210:
src/ldraw.c:51:3: warning: implicit declaration of function '_i64toa' is invalid in C99 [-Wimplicit-function-declaration]
  lua_pushINT64(L, evt->Held1To64);
  ^
src/ldraw.c:26:23: note: expanded from macro 'lua_pushINT64'
    lua_pushstring(L, _i64toa(n, buf, 10));          \
                      ^
src/ldraw.c:51:3: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *'
      [-Wint-conversion]
  lua_pushINT64(L, evt->Held1To64);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ldraw.c:26:23: note: expanded from macro 'lua_pushINT64'
    lua_pushstring(L, _i64toa(n, buf, 10));          \
                      ^~~~~~~~~~~~~~~~~~~
/usr/local/include/lua.h:228:65: note: passing argument to parameter 's' here
LUA_API const char *(lua_pushstring) (lua_State *L, const char *s);
                                                                ^
In file included from src/lui.c:210:
src/ldraw.c:796:9: warning: implicit declaration of function 'luaL_optint' is invalid in C99 [-Wimplicit-function-declaration]
  def = luaL_optint(L, -1, def);
        ^
In file included from src/lui.c:211:
src/lentry.c:1:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewEntry(lua_State *L)
~~~~~~ ^
src/lentry.c:10:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewPasswordEntry(lua_State *L)
~~~~~~ ^
src/lentry.c:19:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewSearchEntry(lua_State *L)
~~~~~~ ^
src/lentry.c:28:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiEntryText(lua_State *L)
~~~~~~ ^
src/lentry.c:51:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiEntryReadOnly(lua_State *L)
~~~~~~ ^
In file included from src/lui.c:220:
src/lmultiline.c:1:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewMultilineEntry(lua_State *L)
~~~~~~ ^
src/lmultiline.c:10:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiNewNonWrappingMultilineEntry(lua_State *L)
~~~~~~ ^
src/lmultiline.c:19:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiMultilineEntryText(lua_State *L)
~~~~~~ ^
src/lmultiline.c:30:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiMultilineEntryAppend(lua_State *L)
~~~~~~ ^
src/lmultiline.c:48:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static l_uiMultilineEntryReadOnly(lua_State *L)
~~~~~~ ^
14 warnings generated.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -dylib -arch x86_64 -macosx_version_min 10.13.0 -o a.out -framework Foundation -framework AppKit /var/folders/ps/568797890l55qcbrzmcjd6tr0000gp/T/lui-1a6531.o /Users/silva/Documents/test00x/lui/liblua.a /Users/silva/Documents/test00x/lui/libui.a -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "__i64toa", referenced from:
      _l_uiAreaMouseEvent_2_table in lui-1a6531.o
  "_luaL_checkint", referenced from:
      _l_uiAreaSetSize in lui-1a6531.o
      _l_uiAreaBeginUserWindowResize in lui-1a6531.o
      _l_uiAttributedStringInsertAtUnattributed in lui-1a6531.o
      _l_uiAttributedStringDelete in lui-1a6531.o
      _l_uiAttributedStringSetAttribute in lui-1a6531.o
      _l_uiAttributedStringByteIndexToGrapheme in lui-1a6531.o
      _l_uiAttributedStringGraphemeToByteIndex in lui-1a6531.o
      ...
     (maybe you meant: _luaL_checkinteger)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@evnix
Copy link
Author

evnix commented May 5, 2018

ok some more progress,
looks like this library isn't tested with Lua 5.3 as it says.
I replaced "luaL_checkint" with "luaL_checkinteger" and now I have only one error message which I am trying to solve.

Undefined symbols for architecture x86_64:
  "__i64toa", referenced from:
      _l_uiAreaMouseEvent_2_table in lui-b93227.o
ld: symbol(s) not found for architecture x86_64

@evnix
Copy link
Author

evnix commented May 5, 2018

ok __i64toa is not a standard function and hence doesn't work on most compilers.
I just copy pasted the implementation of __i64toa(from WINE) and it worked perfectly

now I have a lui.so using the following command

gcc  -o lui.so  -shared  -framework Foundation -framework AppKit -fPIC -Isrc src/lui.c -I ../lua-src  -I ../libui  -L . -llua -lui 

but when I import it, I get the following error

lua: multiple Lua VMs detected
stack traceback:
	[C]: in ?
	[C]: in function 'require'
	controlgallery.lua:3: in main chunk

@squeek502
Copy link

squeek502 commented May 5, 2018

On Unix you shouldn't link the Lua library when building.

See here:

Do Not Link Modules to the Lua Core Libraries

Although it may be tempting to link modules against the static libraries containing the Lua core (lua*.a), this is not a good idea.

Essentially you are adding a copy of the whole Lua core (or at least large parts of it) to every module. Apart from being a waste of space this may lead to very difficult to diagnose problems. The different instances of the core code don't know anything about each other and may not necessarily be in sync.

In case you built a shared library containing the Lua core (*), please do not link any modules against it, too. I.e. do not specify the name of the Lua core library on the linker line (Windows DLLs are an exception). This makes a hard forward dependency where you really want a lazy backward dependency. Loading this module with a statically linked Lua interpreter would essentially drag in a 2nd Lua core and you get the same problems mentioned above.

In 5.3, you get that multiple Lua VMs detected error. In 5.1, you'd just get really weird behavior and crashes.

EDIT: Also, on Mac, you should add the compiler flags -undefined dynamic_lookup (see the Mac OS X shared libraries (Lua 5.1.3 and later) section in the link above)

@evnix
Copy link
Author

evnix commented May 5, 2018

Aha!
That worked perfectly!
Thanks a Million!!! I spent my entire day on this.

for everyone else, the command for Mac/Unix is:
gcc -o lui.so -shared -framework Foundation -framework AppKit -fPIC -Isrc src/lui.c -I ../lua-src -I ../libui -L . -lui -undefined dynamic_lookup

@zhaozg zhaozg closed this as completed in f8b7683 May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants