I agree! Very very cool!
Hi @sergey.lerg
Well, I couldn’t really spot an error.
In my own example, I didn’t need to put “libc++” in the linkFlags setting, but in the flags setting.
Also, as you mentioned, the HLuaBuffer was added this release, but seems to have fallen out of the documentation.
Here is what it is looks like (so you don’t have to cast it!):
/*# Lua wrapper for a buffer
*
* Holds info about the buffer and who owns it
*/
struct LuaHBuffer
{
dmBuffer::HBuffer m_Buffer;
bool m_UseLuaGC; //!< If true, Lua will delete the buffer in the Lua GC phase
};
And also, cool demo!
I will release it on github when I make the extension a bit more usable. At the moment it doesn’t provide much control over the sound sources.
It doesn’t work this way for me either. I’ll provide more details on the build errors soon.
And thanks for the LuaHBuffer definition! Now I see why casting surprisingly worked, pure luck.
@Mathias_Westerdahl, so to recap the libc++ issue.
I want to use for instance unordered_map. I write #include <unordered_map>
and get this error:
Description Resource Path Location Type
clang++ -c -arch x86_64 -target x86_64-apple-darwin11 -isysroot /opt/MacOSX.sdk/ -m64 -O2 -g -mmacosx-version-min=10.7 -DDM_PLATFORM_OSX -I/tmp/upload8882111693246949285/openal/include -F/tmp/upload8882111693246949285/openal/lib/x86_64-osx -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/include -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/sdk/include /tmp/upload8882111693246949285/openal/src/extension.cpp -o/var/extender/builds/build8151566694450167681/extension.cpp_0.o
In file included from /tmp/upload8882111693246949285/openal/src/extension.cpp:12:
/tmp/upload8882111693246949285/openal/src/openal.h:7:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
^
1 error generated.
openal.h /extension-openal/content/openal/src line 1 Problem
fatal error: 'unordered_map' file not found openal.h /extension-openal/content/openal/src line 7 Problem
Fair enough, now I need to specify that I want libc++ during the compilation. I add it to the flags
section.
name: "openal"
platforms:
x86_64-osx:
context:
flags: ["-std=c++11", "-stdlib=libc++"]
frameworks: []
linkFlags: []
libs: []
And get the same error:
Description Resource Path Location Type
clang++ -c -arch i386 -target x86_64-apple-darwin11 -isysroot /opt/MacOSX.sdk/ -m32 -O2 -g -mmacosx-version-min=10.7 -DDM_PLATFORM_OSX -DLUA_BYTECODE_ENABLE -I/tmp/upload3097681066102365404/openal/include -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/include -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/sdk/include /tmp/upload3097681066102365404/openal/src/extension.cpp -o/var/extender/builds/build4031484822964348167/extension.cpp_0.o
In file included from /tmp/upload3097681066102365404/openal/src/extension.cpp:12:
/tmp/upload3097681066102365404/openal/src/openal.h:7:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
^
1 error generated.
openal.h /extension-openal/content/openal/src line 1 Problem
fatal error: 'unordered_map' file not found openal.h /extension-openal/content/openal/src line 7 Problem
For some reason I don’t see the specified flags in the command output.
But if I add to linkFlags.
name: "openal"
platforms:
x86_64-osx:
context:
flags: ["-std=c++11", "-stdlib=libc++"]
frameworks: []
linkFlags: ["-stdlib=libc++"]
libs: []
The error message changes
Description Resource Path Location Type
clang++ -c -arch x86_64 -target x86_64-apple-darwin11 -isysroot /opt/MacOSX.sdk/ -m64 -O2 -g -mmacosx-version-min=10.7 -DDM_PLATFORM_OSX -std=c++11 -stdlib=libc++ -I/tmp/upload691423238232034599/openal/include -F/tmp/upload691423238232034599/openal/lib/x86_64-osx -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/include -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/sdk/include /tmp/upload691423238232034599/openal/src/extension.cpp -o/var/extender/builds/build3582109968007015917/extension.cpp_0.o
clang++ -c -arch x86_64 -target x86_64-apple-darwin11 -isysroot /opt/MacOSX.sdk/ -m64 -O2 -g -mmacosx-version-min=10.7 -DDM_PLATFORM_OSX -std=c++11 -stdlib=libc++ -I/tmp/upload691423238232034599/openal/include -F/tmp/upload691423238232034599/openal/lib/x86_64-osx -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/include -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/sdk/include /tmp/upload691423238232034599/openal/src/openal.cpp -o/var/extender/builds/build3582109968007015917/openal.cpp_1.o
llvm-ar rcs /var/extender/builds/build3582109968007015917/lib27f64f14-e0c6-439f-8a45-f3cc3eec2a6b.a /var/extender/builds/build3582109968007015917/extension.cpp_0.o /var/extender/builds/build3582109968007015917/openal.cpp_1.o
clang++ -c -arch x86_64 -target x86_64-apple-darwin11 -isysroot /opt/MacOSX.sdk/ -m64 -O2 -g -mmacosx-version-min=10.7 -DDM_PLATFORM_OSX -std=c++11 -stdlib=libc++ -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/include -I/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/sdk/include /var/extender/builds/build3582109968007015917/main.cpp -o/var/extender/builds/build3582109968007015917/main_tmpc1e02db3-f348-47f4-b805-ab40b742aa18.o
clang++ -arch x86_64 -target x86_64-apple-darwin11 -isysroot /opt/MacOSX.sdk/ -m64 -O2 -g -mmacosx-version-min=10.7 -o /var/extender/builds/build3582109968007015917/dmengine -stdlib=libc++ -L/var/extender/builds/build3582109968007015917 -L/tmp/upload691423238232034599/openal/lib/x86_64-osx -l27f64f14-e0c6-439f-8a45-f3cc3eec2a6b -F/var/extender/builds/build3582109968007015917 -F/tmp/upload691423238232034599/openal/lib/x86_64-osx -F/tmp/upload691423238232034599/openal/lib/x86_64-osx -framework Foundation -framework AppKit -framework Cocoa -framework OpenGL -framework OpenAL -framework AGL -framework IOKit -framework Carbon -framework CoreVideo -L/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/lib/x86_64-darwin -L/var/extender/sdk/1afccdb2cd42ca3bc7612a0496dfa6d434a8ebf9/defoldsdk/ext/lib/x86_64-darwin -lengine -ladtruthext -lfacebookext -liapext -lpushext -liacext -lrecord -lgameobject -lddf -lresource -lgamesys -lgraphics -lphysics -lBulletDynamics -lBulletCollision -lLinearMath -lBox2D -lrender -lscript -llua -lextension -lhid -linput -lparticle -lrig -ldlib -ldmglfw -lgui -ltracking -lcrashext -lsound -ltremolo -lvpx -lliveupdate /var/extender/builds/build3582109968007015917/main_tmpc1e02db3-f348-47f4-b805-ab40b742aa18.o
Undefined symbols for architecture x86_64:
"__ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base", referenced from:
__ZNSt8_Rb_treeIySt4pairIKyjESt10_Select1stIS2_ESt4lessIyESaIS2_EE16_M_insert_uniqueESt17_Rb_tree_iteratorIS2_ERKS2_ in libddf.a(ddf_loadcontext_5.o)
__ZNSt8_Rb_treeIySt4pairIKyjESt10_Select1stIS2_ESt4lessIyESaIS2_EE16_M_insert_uniqueERKS2_ in libddf.a(ddf_loadcontext_5.o)
"__ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base", referenced from:
__ZNSt8_Rb_treeIySt4pairIKyjESt10_Select1stIS2_ESt4lessIyESaIS2_EE16_M_insert_uniqueESt17_Rb_tree_iteratorIS2_ERKS2_ in libddf.a(ddf_loadcontext_5.o)
"__ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_", referenced from:
__ZNSt8_Rb_treeIySt4pairIKyjESt10_Select1stIS2_ESt4lessIyESaIS2_EE16_M_insert_uniqueESt17_Rb_tree_iteratorIS2_ERKS2_ in libddf.a(ddf_loadcontext_5.o)
__ZNSt8_Rb_treeIySt4pairIKyjESt10_Select1stIS2_ESt4lessIyESaIS2_EE16_M_insert_uniqueERKS2_ in libddf.a(ddf_loadcontext_5.o)
ld: symbol(s) not found for architecture x86_64
clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
ext.manifest /extension-openal/content/openal line 1 Problem
This time the compiler flags are present, but linking fails due to some incompatibility with libddf? What is it, anyway?
I know these C++ features are not super crucial, but they make coding easier.
For some reason I don’t see the specified flags in the command output.
The thing here is that we build both 32/64 bit executables, so if you add the corresponding part for x86-osx, it should have given you the same result.
As for the final linker error, it seems we actually had a rogue “#include <map>” in our code, and they’ll clash. I’ve added ticket DEF-2594 for this.
In the meantime, as a workaround, you could perhaps use std::map without C++1) (It’s not a huge loss in performance, since they’re both pretty slow)
Yeah, I used std::map
. C++11 can be useful later on.
Currently, I’ve exposed the most of OpenAL features in the extension. Pitch control, doppler effect, sound direction, etc.
Now I need to make a better example of how it all works and write a simple documentation.
After that I’ll try exposing effects (reverb) and filters. I haven’t tried yet, but I hope they are present in the binary.
Released the first version of the extension. Details are here
I want to try adding flags for the compiler on Android, but I am getting “Internal Server Error”, even with empty flags list.
name: "openal"
platforms:
armv7-android:
context:
flags: []
frameworks: []
linkFlags: []
libs: []
Description Resource Path Location Type
Internal Server Error ext.manifest /extension-openal/content/openal line 1 Problem
I guess that’s not normal?
@Mathias_Westerdahl, can you please confirm that the above behaviour is not normal? And if I could use compile flags on Android any time soon. Thanks!
HI @sergey.lerg!
It certainly doesn’t sound normal, I’ve used the flags without problems before, there’s no special treatment that way between platforms. I suspect the “Internal Server Error” comes from something else (not sure what yet).
I’m not entirely sure, but I think @mikael.lothman mentioned something the other day about the manifest not being able to handle mixed white spaces? Could that be something?
On a related note, the empty setup you show in your last post is the default setup, so you can omit it.
When you receive that error, the error is set on the first line of the ext.manifest, right? What can you see if you hover on that error with that file open? I suspect it could also be another linker error?
Huh. Looks like something indeed was wrong with the whitespace. Thanks.
However the optimization flag is ignored and individual optimization flags like -finline-small-functions
or -fprefetch-loop-arrays
are rejected as invalid.
I want to experiment with them and find one that optimizes hash functions for strings (to use with the switch statement).
Can they be whitelisted?
Description Resource Path Location Type
Invalid flag in extension 'openal' - 'flags': '-finline-small-functions' ext.manifest /extension-openal/content/openal line 1 Problem
Ah, great that it worked!
(@mikael.lothman did we create a ticket for that issue? I know I forgot to do it ;))
Yes we can whitelist them (I’m away on vacation right now, but perhaps @sven can add them?)
Also, regarding compiler optimisations, I can highly recommend https://godbolt.org/ for testing implementations and flags, in order to see what gives the best output (disassembly). I use it a lot
The manifest format is YAML, and YAML doesn’t support tabs. If you mix tabs and spaces for indentation in the same file, it’s hard to interpret that file in a safe way. I think the best solution would be to alert in the editor if you try to use tabs in YAML-files. @sergey.lerg I will follow up on this and let you know once we have agreed on a solution.
Holy crap! That’s a cool service!
That’s an amazing tool! Thanks to it I now understand that there is a deeper problem. Turns out x86 gcc optimizes the string hashing without even blinking, but arm gcc seems to be failing no matter what optimization level is chosen. That’s disappointing, if I don’t find a way I will have to change the code.
We have now released a fix giving you better feedback from the build server if you use tabs instead of spaces in ext.manifest files.
Another build error for Android showed up. “Build failed: Failed to copy classes.dex”.
Wasn’t there before.
eclipse.buildId=unknown
java.version=1.8.0_05
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments: -keyring /Users/lerg/.eclipse_keyring -showlocation
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -keyring /Users/lerg/.eclipse_keyring -showlocation
Error
Fri Apr 07 22:02:06 YEKT 2017
Unable to bundle application
org.eclipse.core.internal.resources.ResourceException: Errors occurred during the build.
at org.eclipse.core.internal.resources.Project$1.run(Project.java:620)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.dynamo.cr.editor.handlers.AbstractBundleHandler$BundleRunnable.buildProject(AbstractBundleHandler.java:63)
at com.dynamo.cr.editor.handlers.AbstractBundleHandler$BundleRunnable.run(AbstractBundleHandler.java:72)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Contains: Errors running builder 'Content Builder' on project 'extension-openal'.
org.eclipse.core.runtime.CoreException: Build failed: Failed to copy classes.dex to /Applications/Defold/branches/59862/30136/main/build/armv7-android/classes.dex
at com.dynamo.cr.editor.builders.ContentBuilder.buildLocal(ContentBuilder.java:176)
at com.dynamo.cr.editor.builders.ContentBuilder.build(ContentBuilder.java:80)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.dynamo.cr.editor.handlers.AbstractBundleHandler$BundleRunnable.buildProject(AbstractBundleHandler.java:63)
at com.dynamo.cr.editor.handlers.AbstractBundleHandler$BundleRunnable.run(AbstractBundleHandler.java:72)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: com.dynamo.bob.CompileExceptionError: Failed to copy classes.dex to /Applications/Defold/branches/59862/30136/main/build/armv7-android/classes.dex
at com.dynamo.bob.bundle.BundleHelper.buildEngineRemote(BundleHelper.java:246)
at com.dynamo.bob.Project.buildEngine(Project.java:540)
at com.dynamo.bob.Project.doBuild(Project.java:589)
at com.dynamo.bob.Project.build(Project.java:329)
at com.dynamo.cr.editor.builders.ContentBuilder.buildLocal(ContentBuilder.java:134)
... 13 more
Contains: Build failed: Failed to copy classes.dex to /Applications/Defold/branches/59862/30136/main/build/armv7-android/classes.dex
com.dynamo.bob.CompileExceptionError: Failed to copy classes.dex to /Applications/Defold/branches/59862/30136/main/build/armv7-android/classes.dex
at com.dynamo.bob.bundle.BundleHelper.buildEngineRemote(BundleHelper.java:246)
at com.dynamo.bob.Project.buildEngine(Project.java:540)
at com.dynamo.bob.Project.doBuild(Project.java:589)
at com.dynamo.bob.Project.build(Project.java:329)
at com.dynamo.cr.editor.builders.ContentBuilder.buildLocal(ContentBuilder.java:134)
at com.dynamo.cr.editor.builders.ContentBuilder.build(ContentBuilder.java:80)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.dynamo.cr.editor.handlers.AbstractBundleHandler$BundleRunnable.buildProject(AbstractBundleHandler.java:63)
at com.dynamo.cr.editor.handlers.AbstractBundleHandler$BundleRunnable.run(AbstractBundleHandler.java:72)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
A work in progress for the Android packaging?
Hmm, I’m looking into it!
EDIT: The classes.dex issue was found and fixed and we should be able to restart the build server some time during the day.
EDIT 2: We have now restarted the server and I’ve just verified that the fix is in. Test it by changing something in your code (to make it ignore the local cache, which is located at “project_name/.internal/cache/.buildcache”)
Just tested, the build error has gone, thanks!
DEF-2594 was resolved in Defold 1.2.102.