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

Unable to compile on mac #10

Open
brokenbeta opened this issue Feb 13, 2017 · 12 comments
Open

Unable to compile on mac #10

brokenbeta opened this issue Feb 13, 2017 · 12 comments

Comments

@brokenbeta
Copy link

haxe 3.4.0
hxcpp 3.4.49
lime 3.7.2
openfl 4.7.3
linc_dialogs up to date with master

OSX El Capitan (10.11.4)
XCode 7.3

Compiler invocation:

haxelib run lime test mac

Output:

Link: ApplicationMain
Undefined symbols for architecture x86_64:
  "linc::dialogs::open(String, Array<Dynamic>)", referenced from:
      ui::InstrumentPanel_obj::onPressOpen() in 0d936921_InstrumentPanel.o
  "linc::dialogs::save(String, Dynamic)", referenced from:
      ui::InstrumentPanel_obj::onPressSaveAs() in 0d936921_InstrumentPanel.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've recently upgraded haxe, hxcpp, lime, basically everything I have at the top of that list to most recent version. Somewhere along the way, linc_dialogs stopped compiling for me on mac. I haven't tried upgrading OSX to Sierra yet because that potentially affects other things for me, but if it's likely to work I'll do it.

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 13, 2017

Hey, I have been using the dialogs just last night / today with no issues, but I'll take a closer look at the error you've pasted and see if I can spot any issues.

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 13, 2017

I can't seem to reproduce this issue (but I am testing on sierra).
I haven't really changed much prior to sierra though, in the code.

I'm testing on the same haxe version and same hxcpp version, and it was also working fine on haxe 3.2.1, so I'm having trouble pinpointing where the exact break down comes from.

How did you reference the library in your project file, and how are you using it in code?
You said it was working before that?

@brokenbeta
Copy link
Author

Firstly, it works fine on Windows.

There's nothing weird that I know of about the way I'm using it, I have it installed via the haxelib git command in the readme, I have <haxelib name="linc_dialogs" /> in my project.xml and I am using the Dialogs.open and save methods in a bunch of places in my code.

It's clearly not bringing in the linc_dialogs_mac.mm file into the build, but I haven't got the faintest clue why. It looks like the xcrun incovation is truncated in the output, but I do see the part which references linc_dialogs right at the start:

Compiling group: haxe
xcrun --sdk macosx10.11 clang++ -Iinclude -I/usr/local/lib/haxelib/linc_dialogs/git//linc -c -fvisibility=hidden -stdlib=libstdc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -O2 -I/usr/local/lib/haxelib/hxcpp/3,4,49/include -DHX_MACOS -m64 -Wno-parentheses -Wno-null-dereference -Wno-unused-value -Wno-format-extra-args -Wno-bool-conversion -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=331(haxe) ... tags=[haxe,static]

Is that -Iinclude part the same as what you have?

@brokenbeta
Copy link
Author

I forgot to answer your question, it was definitely working before my upgrade, but unfortunately I was forced to upgrade lime, openfl and hxcpp at once, so I don't know if it was any of those or the upgrade to haxe or something else. I'll see if I can figure out what screwed up the build.

Please call me out if there's anything stupid that I might have forgotten to do.

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 13, 2017

Hmm, well the way it works is relatively straight forward. adding -lib linc_dialogs in the hxml file would be all that's necessary and I think that would be alright if you're seeing it mentioned and haxe can see the classes.

I have one guess though - mid thought - maybe mac is no longer defined in your build. Check your hxml that lime generates for your project, the linc stuff relies on mac being defined, I think hxcpp might use macos or similar.

@brokenbeta
Copy link
Author

brokenbeta commented Feb 13, 2017

Hmm. I don't think lime is giving me -lib linc_dialogs, but rather it is giving me -cp /usr/local/lib/haxelib/linc_dialogs/git. Will that work?


My project.xml file in full is:

<?xml version="1.0" encoding="utf-8"?>
<project>
	<meta title="TileEditor" package="TileEditor" version="1.0.0" company="Chris BB" />

	<app main="Editor" file="TileEditor" path="bin" />

	<window background="#ffffff" fps="60" />
	<window width="1200" height="700" unless="mobile" />
	<window orientation="landscape" vsync="false" antialiasing="0" if="cpp" />

	<source path="src" />
	<source path="openfl_tools_src" />
	<haxelib name="openfl" />
	<haxelib name="actuate" />
	<haxelib name="format" />
	<haxelib name="linc_dialogs" />

	<icon path="assets/openfl.svg" />
	<assets path="assets/img" rename="img" />

	<haxeflag name="-D openfl-dynamic" />
</project>

The hxml file that I'm looking at is bin/mac64/cpp/release/haxe/final.hxml -- hopefully that's the right one. (There are debug.hxml and release.hxml files in there, but they're only marginally different.) I've cleared all other builds to avoid confusing myself further.

The way lime produced this file is:

-main ApplicationMain 
--macro openfl._internal.utils.ExtraParams.include()
-cp /usr/local/lib/haxelib/openfl/4,7,3
-D openfl=4.7.3
--macro lime.Lib.extraParams()
-cp /usr/local/lib/haxelib/lime/3,7,2
-D lime=3.7.2
-cp /usr/local/lib/haxelib/actuate/1,8,7
-D actuate=1.8.7
-cp /usr/local/lib/haxelib/format/3,2,1
-D format=3.2.1
-cp /usr/local/lib/haxelib/linc_dialogs/git
-D linc_dialogs=0.0.0
-cp src
-cp openfl_tools_src
-D lime-openal
-D tools=3.7.2
-D lime-cairo
-D no-compilation
-D lime-opengl
-D macos
-D native
-D lime-native
-D lime-vorbis
-D MACOSX_DEPLOYMENT_TARGET=10.6
-D lime-curl
-D openfl-native
-D lime-cffi
-D mac
-D desktop
--remap flash:openfl
-D openfl-dynamic
-cp bin/mac64/cpp/release/haxe
-cpp bin/mac64/cpp/release/obj/
--macro keep("Editor")
-D final

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 13, 2017

I think the -cp should work fine.
do you reference the dialogs.Dialogs.open directly, or do you import dialogs.Dialogs; it up top?

What really happens is a simple chain of events;

So the fact you're seeing some include paths for linc_dialogs, means it is making it down almost to the end. The fact it's not hitting the mac file was why I wondered, but it seems you have mac defined.

I can't see anything obvious, you should enable verbose flags for hxcpp, try a clean build, and watch for the linc_dialogs_mac.mm to check it's being roped into the build. If not you can try sticking <error name="does it hit this line?"/> inside the node and see what you find.

@brokenbeta
Copy link
Author

It's an import

import dialogs.Dialogs;

and lower down

public function onPressOpen(): Void
{
    var filter: FileFilter = {
        ext: "json",
        desc: "JSON file"
    };
    var result = Dialogs.open("Open level", [ filter ]);

    if (result != null && result != "")
    {
        // stuff
    }
}

It looks like linc_dialogs_mac.mm is not in the build, so I'm fiddling with adding <error> tags to linc_dialogs.xml:

  • If I add an <error> at the top just underneath the initial <xml> tag, it works (i.e. it breaks the build).
  • If I add it just underneath <files id="linc_dialogs">, it does nothing.
  • If I add it just underneath <target id="haxe">, it does nothing.

What does it mean that the <target id="haxe"> tag is not in effect?

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 13, 2017

that is strange, especially since it's working on windows and was working before. I honestly can't think of anything. Does the test case in the folder run? haxe build.hxml

@brokenbeta
Copy link
Author

The test case does build ok ... it does seem to stall halfway when you run it (the second dialog for saving never appears), but it builds fine.

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 13, 2017

Yea the running lacks a proper run loop in a console app so it gets weird. That it builds would be the test. Did you try an empty project that has no history and reference -> use it to see if it's maybe somehow cached state?

@brokenbeta
Copy link
Author

brokenbeta commented Feb 14, 2017

I have an empty sample project set up at https://github.com/brokenbeta/linc_dialog_test/

It doesn't compile for me. Could you try it?


> haxelib run lime test mac

Creating /Users/cburtbrown/Projects/LincTest/bin/mac64/cpp/release/obj/obj/darwin64/__pch/haxe/hxcpp.h.gch...

Compiling group: haxe
xcrun --sdk macosx10.11 clang++ -Iinclude -I/usr/local/lib/haxelib/linc_dialogs/git//linc -c -fvisibility=hidden -stdlib=libstdc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -O2 -I/usr/local/lib/haxelib/hxcpp/3,4,49/include -DHX_MACOS -m64 -Wno-parentheses -Wno-null-dereference -Wno-unused-value -Wno-format-extra-args -Wno-bool-conversion -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=331(haxe) ... tags=[haxe,static]
 - src/lime/utils/AssetCache.cpp  [haxe,release]
Link: ApplicationMain
Undefined symbols for architecture x86_64:
  "linc::dialogs::open(String, Array<Dynamic>)", referenced from:
      TestMain_obj::__construct() in f505ff26_TestMain.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

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