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

Tips on when building on Mac fails #10

Open
mastef opened this issue Feb 10, 2017 · 2 comments
Open

Tips on when building on Mac fails #10

mastef opened this issue Feb 10, 2017 · 2 comments

Comments

@mastef
Copy link

mastef commented Feb 10, 2017

On my system I was failing to compile a mac project with - some pointers if anybody runs into the same issues.

$ lime test mac -Ddebug -debug -Dlegacy --no-inline
Creating /export/mac64/cpp/obj/obj/darwin64-debug/__pch/haxe/hxcpp.h.gch...
 - Link : ApplicationMain-debug
Called from webm.Webm::boot webm/Webm.hx line 159
Called from cpp.Lib::load /usr/local/lib/haxe/std/cpp/Lib.hx line 38
Error : Could not load module openfl-webm@hx_vpx_codec_iface_name__0

1. Make all .sh and configure files executable

$ cd /usr/local/lib/haxe/lib/openfl-webm/0,0,4
$ find . -type f -name "configure" | xargs chmod +x
$ find . -type f -name "*.sh" | xargs chmod +x

2. Build the libs

$ cd /usr/local/lib/haxe/lib/openfl-webm/0,0,4/libs
$ ./build_mac.sh

Initially I got the error that Toolchain is unable to link executables, which was fixed by changing gcc to 64 bit in /libs/build_mac.sh

- export CC="gcc -m32"
+ export CC="gcc -m64"

3. Build the project

In the extension root folder run the other build_mac.sh

$ cd /usr/local/lib/haxe/lib/openfl-webm/0,0,4
$ ./build_mac.sh

When first time trying to build the extension on Mac, I got 1 error and 2 warnings :

$ cd /usr/local/lib/haxe/lib/openfl-webm/0,0,4
$ ./build_mac.sh
/usr/local/lib/haxe/lib/openfl-webm/0,0,4/project /usr/local/lib/haxe/lib/openfl-webm/0,0,4
 - Compiling group 'common' with flags -Iinclude -Ilibogg/include -Ilibvorbis/include -Ilibvorbis/lib -I../libs.src/libvpx -c -fvisibility=hidden -stdlib=libstdc++ -O2 -I/usr/local/lib/haxe/lib/hxcpp/git/include -DHX_MACOS -m64 -Wno-parentheses -Wno-unused-value -Wno-format-extra-args -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=0(haxe) tags=[haxe,static]
 - Compile : common/ExternalInterface.cpp
Error: While running :g++ -Iinclude -Ilibogg/include -Ilibvorbis/include -Ilibvorbis/lib -I../libs.src/libvpx -c -fvisibility=hidden -stdlib=libstdc++ -O2 -I/usr/local/lib/haxe/lib/hxcpp/git/include -DHX_MACOS -m64 -Wno-parentheses -Wno-unused-value -Wno-format-extra-args -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=0 -x c++ -frtti -Wno-invalid-offsetof ./common/ExternalInterface.cpp -o/usr/local/lib/haxe/lib/openfl-webm/0,0,4/project/obj/darwin64/36447d21_ExternalInterface.o
./common/ExternalInterface.cpp:80:5: error: use of undeclared identifier 'va_start'
    va_start(ap, fmt);
    ^
./common/ExternalInterface.cpp:634:101: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
                                printf("Vorbis: version:%d, channels:%d, rate:%d\n", mVorbisInfo.version, mVorbisInfo.channels, mVorbisInfo.rate);
                                                                              ~~                                                ^~~~~~~~~~~~~~~~
                                                                              %ld
./common/ExternalInterface.cpp:842:72: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
                                                printf("\t\tAddio Private Data\t: %p, %d\n", privateDataPointer, privateDataSize);
                                                                                      ~~                         ^~~~~~~~~~~~~~~
                                                                                      %lu
2 warnings and 1 error generated.
/usr/local/lib/haxe/lib/openfl-webm/0,0,4

2 warnings

You can ignore the 2 warnings, or fix them as the error message shows by changing the last %d on lines 634 and 842 to %ld and %lu.

- printf("Vorbis: version:%d, channels:%d, rate:%d\n", mVorbisInfo.version, mVorbisInfo.channels, mVorbisInfo.rate);
+ printf("Vorbis: version:%d, channels:%d, rate:%ld\n", mVorbisInfo.version, mVorbisInfo.channels, mVorbisInfo.rate);

and

- printf("\t\tAddio Private Data\t: %p, %d\n", privateDataPointer, privateDataSize);
+ printf("\t\tAddio Private Data\t: %p, %lu\n", privateDataPointer, privateDataSize);

va_start error

More importantly, to fix the va_start error add #include <stdarg.h> around line 17

Now you should be able to compile your Mac project.

@ivodopiviz
Copy link

I don't know how I found this very thanks a lot!

@mastef
Copy link
Author

mastef commented Nov 12, 2018

@ivodopiviz welcome! It seems it's fixed already however if you use the git version ( not the haxelib version, which is outdated ) based on this PR #6 - 3ce4668

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