Giter Site home page Giter Site logo

crossbridge's Introduction

Project Status

Sadly this project is no longer being actively maintained by Adobe, if you want to contribute to improving crossbridge you might want to help out on a more active fork like the one here: https://github.com/vpmedia/crossbridge/

Crossbridge is the open-source version of Adobe FlasCC (formerly the Alchemy project). It provides a complete C/C++ development environment for targetting the Adobe Flash Runtime.
For more information about this project, please visit http://adobe-flash.github.io/crossbridge/.
To get the latest release version, please visit the http://sourceforge.net/projects/crossbridge/files/.

Features:

  • GCC 4.2 compiler with Flash backend.
  • GDB debugger that debugs your code while running in the Flash player.
  • SWIG backend that auto generates interop code allowing you to build Flash libs (SWCs) that wrap C/C++ libraries.
  • pthread based multithreading (in Flash 11.5+)

Development

The master branch contains all of the code necessary to build crossbridge 1.0.1, this is the current stable version. The future branch contains some work in progress to upgrade the toolchain to LLVM 3.2 and switch to using the Clang compiler instead of GCC.

Both the mac and cygwin SDKs are built on mac, you will need XCode and some macports packages installed to be able to build (pkg-config, glib, and mercurial).

Doing a "make" in the root directory should be sufficient to build just the mac sdk, doing "make; make win; make deliverables" should build both mac and windows and package them as dmg and zips

Future

Futures branch contains the upgrading code. Comparing to master, it will mainly has

  • Clang/LLVM 3.2 toolchain
  • Freebsd 9.1 Environment
  • Libc++ with support of c++11 std.

Start using crossbridge

Download a copy of SDK for your OS at http://sourceforge.net/projects/crossbridge/files/ Open README.html to get a basic idea of crossbridge usage.

License

The code written by adobe is all MIT licensed, but crossbridge contains many different open source projects which have different licenses, check the source files before making any assumptions.

crossbridge's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crossbridge's Issues

getting started

Hi,

I'm on win8.1 update 1, x64.

I followed the readme file, and as soon as I run run.bat, I get the following error:

  0 [main] bash 10120 find_fast_cwd: WARNING: Couldn't compute FAST_CWD pointer.  Please report this problem to the public mailing list [email protected]

I tried changing my path per this issue, without success: #54

A bunch of googling turned up the following two entries from the mailing list:
https://cygwin.com/ml/cygwin/2012-04/msg00632.html
https://cygwin.com/ml/cygwin/2013-05/msg00145.html

From the information I found there, it looks like a.) something in Windows 8 broke the CWD command, and b.) they have apparently fixed it in a later version.

Can someone help me figure out how to update the cygwin install included in crossbridge? I'd rather not install a standalone cygwin, but I will if I have to.

pthreads and workers support

Hi all,

I have recently encountered several issues with pthreads and workers in crossbridge. It looks like the pthreads/workers support is not 100% stable and becomes a pitfall for any seriouse efforts to port complex C++ code. I am basically a C++ specialist, so although I have a basic understanding of how the threads were implmeented (both from looking at source and forums), it's really hard for me to debug these issues in the crossbridge code.

I'm using Windows 8 64bit, Crossbridge 1.0.1, Flex 4.12.1, Flash debug player standalone 13.

  1. In sample 09, pthread_swc2.swf - pthread_join causes deadlock, when running the main() on the UI wroker with startAsync() - you can try the original sample code.

  2. In sample 09, after changing pthread_swc.as by Console.as (basically just running the main() in background worker) the main() works fine, however trying to call spawnThread() from UI events sometimes causes deadlock in pthread_join

Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
    at flash.concurrent::Condition/wait()
    at global/sample.pthread::threadArbCondWait()
    at global/sample.pthread::F_avm2_msleep()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:6496]
    at global/sample.pthread::F_kmsleep()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:7434]
    at global/sample.pthread__3A__5C_cygwin_5C_tmp_5C_cciMgysi_2E_lto_2E_bc_3A_77d5ac99_2D_8207_2D_44be_2D_990e_2D_0fc9c24978f7::F_do_wait()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:76497]
    at global/sample.pthread__3A__5C_cygwin_5C_tmp_5C_cciMgysi_2E_lto_2E_bc_3A_77d5ac99_2D_8207_2D_44be_2D_990e_2D_0fc9c24978f7::F___umtx_op_wait()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:71533]
    at global/sample.pthread::F_k_umtx_op()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:71338]
    at global/sample.pthread::F__umtx_op()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:2267]
    at global/sample.pthread::F__thr_umtx_wait()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:59107]
    at global/sample.pthread__3A__5C_cygwin_5C_tmp_5C_cciMgysi_2E_lto_2E_bc_3A_77d5ac99_2D_8207_2D_44be_2D_990e_2D_0fc9c24978f7::F_join_common()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:49539]
    at global/sample.pthread::F__pthread_join()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:49319]
    at global/sample.pthread::F_pthread_join_exp()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:66745]
    at global/sample.pthread::spawnThread()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:111]
    at Console/buttonClickHandler()[C:\crossbridge\samples\09_Pthreads\Console.as:132]

And after I've removed the pthread_join(), it sometimes deadlocked in printf().

Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
    at flash.concurrent::Condition/wait()
    at global/sample.pthread::threadArbCondWait()
    at global/sample.pthread::F_avm2_msleep()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:6488]
    at global/sample.pthread::F_kmsleep()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:7426]
    at global/sample.pthread__3A__5C_cygwin_5C_tmp_5C_ccqgHCk8_2E_lto_2E_bc_3A_75e4d886_2D_039d_2D_479d_2D_bd70_2D_fe9c94c1a4e5::F__do_lock_umutex()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:74414]
    at global/sample.pthread__3A__5C_cygwin_5C_tmp_5C_ccqgHCk8_2E_lto_2E_bc_3A_75e4d886_2D_039d_2D_479d_2D_bd70_2D_fe9c94c1a4e5::F_do_lock_umutex()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:76178]
    at global/sample.pthread__3A__5C_cygwin_5C_tmp_5C_ccqgHCk8_2E_lto_2E_bc_3A_75e4d886_2D_039d_2D_479d_2D_bd70_2D_fe9c94c1a4e5::F___umtx_op_wait_umutex()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:73667]
    at global/sample.pthread::F_k_umtx_op()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:71330]
    at global/sample.pthread::F__umtx_op()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:2259]
    at global/sample.pthread::F___thr_umutex_lock()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:59556]
    at global/sample.pthread__3A__5C_cygwin_5C_tmp_5C_ccqgHCk8_2E_lto_2E_bc_3A_75e4d886_2D_039d_2D_479d_2D_bd70_2D_fe9c94c1a4e5::F_mutex_lock_common()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:53582]
    at global/sample.pthread::F__pthread_mutex_lock()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:53961]
    at global/sample.pthread::F__flockfile()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:109241]
    at global/sample.pthread::F_puts()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:97284]
    at global/sample.pthread::spawnThread()[C:\cygwin\tmp\cc5PYYGx.lto.1.as:109]
    at Console/buttonClickHandler()[C:\crossbridge\samples\09_Pthreads\Console.as:132]

Error: Error #1517: Condition cannot notifyAll if associated mutex is not owned.
    at flash.concurrent::Condition/notifyAll()
    at global/sample.pthread::threadArbCondsNotify()
    at global/sample.pthread::F_avm2_wake_one()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:4287]
    at global/sample.pthread__3A__5C_cygwin_5C_tmp_5C_cciMgysi_2E_lto_2E_bc_3A_77d5ac99_2D_8207_2D_44be_2D_990e_2D_0fc9c24978f7::F_uiThunkTickProc()[C:\cygwin\tmp\ccYVhlkk.lto.1.as:7350]
    at sample.pthread::CModule$/callI()
    at sample.pthread::CModule$/serviceUIRequests()
    at Console/enterFrame()[C:\crossbridge\samples\09_Pthreads\Console.as:219]

I will really appritiate any suggestions and will be glad to assist, as right now this is the major pitfall of our porting efforts.

Thanks!

'make win' does not work out of the box

According to the readme, "make; make win; make deliverables should build both mac and windows and package them as dmg and zips"

However, in reality:

$ make win
Couldn't locate cygwin mac directory, please invoke make with "make CYGWINMAC=/path/to/cygwinmac/sdk/usr/bin ..."
make: *** [win] Error 1

It's not immediately obvious how to proceed, the root folders contains a cygwinmac directory, but it has no sdk subdirectory.

compilation fail

Hi,

I try to compile the crossbridge-master project on 10.7.5, but I have this error :

Failed to build: extratools
make[1]: *** [all_with_local_make] Error 1
make: *** [all] Error 2

and in the extratools log file :

Making init.c
ar: creating archive libgdb.a
mkdir ./python
mkdir ./python/gdb
mkdir ./python/gdb/command
make[2]: *** [extratools] Error 2

Do you have an idea to compile it ?

Best regards,
Philippe

Futures status ?

Hi,

Could the owner of the project tell us if the status of Futures branch has progressed ?
No changes for 5 months, just being curious.

Linker gets out of memory

Hi,
I'm trying to build our project using crossbridge, but linking goes over 32bit memory limit.

Do you know any mean to link in several steps or some settings that lower the need for so much memory?

The project is not huge, so any advices would be great

Thanks

Malloc RangeError: The specified range is invalid

Hi,

In side a loop, I use malloc to allocate some domain memory, and free it at the end of a loop. It works well for a while, then I received lots of RangeError.

RangeError: Error #1506: The specified range is invalid.

var pcmPtr:int = CModule.malloc(FRAME_SIZE_BYTE * CHANNEL);

I've seen this https://github.com/adobe-flash/crossbridge/wiki/Memory-Fragmentation, but I don't understand why malloc and free at the same time in init function.

protected function init(e:Event):void
{
var p:int=CModule.malloc(1024_1024_256);//pre-allocate a block domain memory, the size should be according to your project
if (!p)
throw(new Error("You have opened too many pages, close some of them or restart your browser!"));
CModule.malloc(1);//take up the domain memory
CModule.free(p);//release the pre-allocated memory so that it can be used for new C/C++ Object
...
}

Can preallocated memory fix RangeError issue?

Many thanks,
Trung

GDB.

Any idea why when I try to invoke GDB with all the correct environment variables i get 'LocalHost:6666: operation not permitted' ?

invalid forward reference to function '__cxa_atexit' with wrong type

Description:
When generating abc code of libc++, llc prompts error at below line for thread.cpp:
%7 = tail call i32 @cxa_atexit(void (i8) bitcast (void (%"class.std::__1::__thread_specific_ptr") @ZNSt3__121__thread_specific_ptrINS_15__thread_structEED1Ev to void (i8)_), i8* bitcast (%"class.std::__1::__thread_specific_ptr"* @_ZZNSt3__119__thread_local_dataEvE3__p to i8*), i8 0) nounwind

By comparing to the prototype:
int __cxa_atexit( void (*f)(void *), void *p, void *d)

It seems the generated code wrongly passes the 3rd argument where it should be a i8*. Meanwhile the gen'ed bitcode targeting x86 is correct.

I haven't found the root cause yet.
Looking forward to your solution and contribution. :D

Steps:
1 get the latest codebase
2 make all (two extra libs will fail now.)
3 make libcxx
4 make libcxx.abc

Question: Futures branch compile size large

clang does not accept the -04 optimization flag. -0s / -02 / -03 create large filesizes for the HelloWorld app, the default size is 326kb or else the size becomes 400kb. The stable branch with gcc it's 70kb.

Is there a way to get this down even further or is 70kb the standard ?

Will Crossbridge be supported officially by Adobe continuously?

Hi, I’d like to make sure Crossbridge will be supported officially by Adobe continuously or not. My team is using FlasCC to develop some modules in our Flash 3D engine & game projects. Since FlasCC became open source project, we’re a little worried about Adobe may not develop/maintain it in the future. Is there any official announcements (websites or official blogs) can help us clarify?
Thank you.
Shao ([email protected])

Failing to build

Log after doing a "make" in the root directory on master branch:

stopiccot-macbook:crossbridge stopiccot$ make

-  base
-  make
-  cmake
-  abclibs
-  basictools
  Failed to build: basictools
  make[1]: **\* [all_with_local_make] Error 1
  make: **\* [all] Error 2

Cannot 'make' twice in a row

Doing 'make' once works as expected:

$ make
~~~ Crossbridge ~~~
- base
- make
- cmake
- abclibs
- basictools
- llvm
- binutils
- plugins
- gcc
- bmake
- stdlibs
- gcclibs
- as3wig
- abcstdlibs
- sdkcleanup
- tr
- trd
- extralibs
- extratools
- finalcleanup
- submittests

However, should the user (for some reason) do it again, without invoking 'make clean' first:

$ make
~~~ Crossbridge ~~~
- base
- make
- cmake
- abclibs
Failed to build: abclibs
make[1]: *** [all_with_local_make] Error 1
make: *** [all] Error 2

build/mac/locs/abclibs.txt says:

mv: rename /Users/kkotajarvi/git/crossbridge/build/apidocs/tempdita to /Users/kkotajarvi/git/crossbridge/build/tempdita: Directory not empty
make[3]: *** [abclibs_asdocs] Error 1
make[3]: *** Waiting for unfinished jobs....

getting started

I'm no novice, but I've been unable to get the samples to compile or find any active support forum.

On Windows 7, the complaint is
LLVM ERROR: Error: Unable to launch the Java Virtual Machine.
I have about a dozen JVMs installed, the default is 64 bit java 1.8_05

It would help if there were some FAQ about specifying explicitly what JVM to use.
Or a more visible community forum. The adobe forum is essentially unused.

Failing to build (futures, llvm 3.2)

Sorry for another one but I really need that C++11 features). As was suggested in issue #2 I replaced 2.9 with 3.2 in root makefile. I've got many errors in gcc target but it is probably not supposed to build with 3.2 anyways, so I've removed it from build. Next target to fail was stdlibs with error:

/Users/stopiccot/code/flash/crossbridge/sdk/usr/bin/clang -emit-llvm -DSTRIP_FBSDID -O2 -pipe  -I/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/csu/avm2/../common  -I/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/csu/avm2/../../libc/include -std=gnu99  -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wno-pointer-sign -c crt1_c.c
In file included from crt1_c.c:35:
/Users/stopiccot/code/flash/crossbridge/sdk/usr/include/stdlib.h:90:7: error: incompatible redeclaration of library function 'calloc' [-Werror]
void    *calloc(size_t, size_t) __malloc_like;
         ^
/Users/stopiccot/code/flash/crossbridge/sdk/usr/include/stdlib.h:90:7: note: 'calloc' is a builtin with type 'void *(unsigned long, unsigned long)'
/Users/stopiccot/code/flash/crossbridge/sdk/usr/include/stdlib.h:97:7: error: incompatible redeclaration of library function 'malloc' [-Werror]
void    *malloc(size_t) __malloc_like;
         ^
/Users/stopiccot/code/flash/crossbridge/sdk/usr/include/stdlib.h:97:7: note: 'malloc' is a builtin with type 'void *(unsigned long)'
/Users/stopiccot/code/flash/crossbridge/sdk/usr/include/stdlib.h:104:7: error: incompatible redeclaration of library function 'realloc' [-Werror]
void    *realloc(void *, size_t);
         ^
/Users/stopiccot/code/flash/crossbridge/sdk/usr/include/stdlib.h:104:7: note: 'realloc' is a builtin with type 'void *(void *, unsigned long)'
In file included from crt1_c.c:38:
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/csu/avm2/../common/crtbrand.c:46:35: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma
} abitag __attribute__ ((section (ABI_SECTION), aligned(4))) __used = {
                                  ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/csu/avm2/../common/crtbrand.c:32:21: note: expanded from macro 'ABI_SECTION'
#define ABI_SECTION     ".note.ABI-tag"
                        ^
4 errors generated.
*** Error code 1

Stop.
bmake: stopped in /Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/csu/avm2
make[3]: *** [csu] Error 1
make[2]: *** [stdlibs] Error 2

CAS for bool?

When attempting to use atomic operation: __sync_bool_compare_and_swap(...), I'm getting:

FlasCC does not support CAS on a non-32bit values..

My first assumption was that this meant "nothing over 32-bit," but alas I'm mistaken. I could simply use an int as a work around, but are you planning on adding support for this?

nanosleep blocks thread forever

Hi there,

I tried to use nanosleep to sleep for 1 milliseconds. But it blocks my thread forever. sleep works but it cannot be used to sleep less than a second.

const struct timespec ts = { 0, 1000000 };
nanosleep (&ts, NULL);

Any idea is appreciated.

Cheers,
Trung

Building with -O4 or -emit-llvm ignores -flto-api=exports.txt

As a result it's impossible to use -O4 or -emit-llvm with Console.as:

ReferenceError: Error #1065: Variable __start1 is not defined.
at com.adobe.flascc::CModule$/start()
at com.adobe.flascc::CModule$/startAsync()
at com.adobe.flascc::Console/init()
at com.adobe.flascc::Console()
at com.adobe.flascc.preloader::DefaultPreloader/onPreloaderComplete()

10_MessageChannel built into a 2.9MB swf file

Hi,

I tried to run make in sample 10_MessageChannel, and the output file is 2.9MB. It seems to be quite big compared to a very small cpp file.

I am wondering, is there any way to reduce its size?

Best,
Trung

performance aspects of crossbridge code

I have an unexpected (to me) result, comparing native C code with the same
code executed by crossbridge, to the same code manually translated to actionscript.

The relative speeds are

2.043 native windows code
6.707 crossbridge compiled native code
25.3 native actionscript code

Losing a factor of 3.7 going from native C to SWC is not too bad, but I'm totally
shocked that the carefully written actionscript, using exactly the same algorithm,
should be a factor of 10 slower than native C. The code in question is crunching
numbers with doubles (in C) vs. with :Number in actionscript.

Native C:
double m = min (nr, min (ng, nb));
double nm = nv-m;
double ns = ns = nm / nv ;
double r1 = (nv - nr) / nm ;
double g1 = (nv - ng) / nm ;
double b1 = (nv - nb) / nm ;
double nh;

if (nv == nr)
{
    if (m == ng)
        nh = 5.0 + b1 ;
    else
        nh = 1.0 - g1 ;
}

else if (nv == ng)
{
    if (m == nb)
        nh = 1.0 + r1 ;
    else
        nh = 3.0 - b1 ;
}

else if (nv == nb)
{
    if (m == nr)
        nh = 3.0 + g1 ;
    else
        nh = 5.0 - r1 ;
}

Actionscript:

var m:Number = (nr<ng) ? ((nr<nb) ? nr : nb) : ((ng<nb) ? ng : nb);
var mm:Number = (nv - m);
var ns:Number = mm / nv ;
var r1:Number = (nv - nr) / mm ;   
var g1:Number = (nv - ng) / mm ;
var b1:Number = (nv - nb) / mm ;
var nh:Number =
    (nv==nb)
        ? ((m == nr) ? (3.0 + g1) : (5.0 - r1)) 
        : ((nv == ng)
            ? ((m == nb) ? (1.0 + r1) : (3.0 - b1))
            : ((m == ng) ? (5.0 + b1) : (1.0 - g1)));

Futures branch LLVM compile error on 10.8.4 (and patch)

Futures branch does not compile on stock 10.8.4 OS X.
Provided the asdoc fix (begging for 32 bit JVM), there is another error during LLVM compilation spawn by
llvm-3.2/lib/target/AVM2/AVM2AsmPrinter.cpp
line 480 just patch
struct dword {
to
struct {
because Apple LLVM latest version does not allow declaring types in anonymous unions.

Hope it helps, please merge this tiny patch to futures branch ;)

Many compilation errors in libc

Even with experimental va_args support (it may not work in runtime but at least compiles) there are too many errors while compiling libc. A lot of errors with __weak_reference macro. And there a lot of errors in gen/sem.c file. Many there are some broken files\headers?

/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/sys/sigwait.c:34:1: error: use of undeclared identifier '_sigwait'; did you mean 'sigwait'?
__weak_reference(__sigwait, sigwait);

/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:95:30: error: member reference type 'sem_t' (aka 'struct _sem') is not a pointer; maybe you meant to use '.'?
        if ((sem != NULL) && ((*sem)->magic == SEM_MAGIC))
                              ~~~~~~^~
                                    .
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:95:32: error: no member named 'magic' in 'struct _sem'; did you mean '_magic'?
        if ((sem != NULL) && ((*sem)->magic == SEM_MAGIC))
                                      ^~~~~
                                      _magic
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/../../include/semaphore.h:40:13: note: '_magic' declared here
        __uint32_t      _magic;
                        ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:107:29: error: member reference type 'sem_t' (aka 'struct _sem') is not a pointer; maybe you meant to use '.'?
        _pthread_mutex_destroy(&sem->lock);
                                ~~~^~
                                   .
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:107:31: error: no member named 'lock' in 'struct _sem'
        _pthread_mutex_destroy(&sem->lock);
                                ~~~  ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:108:28: error: member reference type 'sem_t' (aka 'struct _sem') is not a pointer; maybe you meant to use '.'?
        _pthread_cond_destroy(&sem->gtzero);
                               ~~~^~
                                  .
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:108:30: error: no member named 'gtzero' in 'struct _sem'
        _pthread_cond_destroy(&sem->gtzero);
                               ~~~  ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:109:5: error: member reference type 'sem_t' (aka 'struct _sem') is not a pointer; maybe you meant to use '.'?
        sem->magic = 0;
        ~~~^~
           .
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:109:7: error: no member named 'magic' in 'struct _sem'; did you mean '_magic'?
        sem->magic = 0;
             ^~~~~
             _magic
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/../../include/semaphore.h:40:13: note: '_magic' declared here
        __uint32_t      _magic;
                        ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:109:13: error: expression is not assignable
        sem->magic = 0;
        ~~~~~~~~~~ ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:110:7: error: passing 'sem_t' (aka 'struct _sem') to parameter of incompatible type 'void *'
        free(sem);
             ^~~
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/../../include/stdlib.h:93:18: note: passing argument to parameter here
void     free(void *);
                    ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:120:10: error: returning 'void *' from a function with incompatible result type 'sem_t' (aka 'struct _sem')
                return (NULL);
                       ^~~~~~
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:123:8: error: used type 'sem_t' (aka 'struct _sem') where arithmetic or pointer type is required
        sem = (sem_t)malloc(sizeof(struct sem));
              ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:124:10: error: invalid operands to binary expression ('sem_t' (aka 'struct _sem') and 'void *')
        if (sem == NULL) {
            ~~~ ^  ~~~~
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:126:10: error: returning 'void *' from a function with incompatible result type 'sem_t' (aka 'struct _sem')
                return (NULL);
                       ^~~~~~
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:129:5: error: member reference type 'sem_t' (aka 'struct _sem') is not a pointer; maybe you meant to use '.'?
        sem->count = (u_int32_t)value;
        ~~~^~
           .
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:129:7: error: no member named 'count' in 'struct _sem'
        sem->count = (u_int32_t)value;
        ~~~  ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:130:5: error: member reference type 'sem_t' (aka 'struct _sem') is not a pointer; maybe you meant to use '.'?
        sem->nwaiters = 0;
        ~~~^~
           .
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:130:7: error: no member named 'nwaiters' in 'struct _sem'
        sem->nwaiters = 0;
        ~~~  ^
/Users/stopiccot/code/flash/crossbridge/build/mac/lib/src/lib/libc/gen/sem.c:131:5: error: member reference type 'sem_t' (aka 'struct _sem') is not a pointer; maybe you meant to use '.'?
        sem->magic = SEM_MAGIC;
        ~~~^~
       .

Compilation error in abcstdlibs_more

Thanks to recent commits SDK becomes more stable but here is another error.
This time I have no idea what is going on because it seems to be a segfault in llvm internals.

===-------------------------------------------------------------------------===
                         Miscellaneous Ungrouped Timers
===-------------------------------------------------------------------------===

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   0.0001 (100.0%)   0.0006 (100.0%)   0.0007 (100.0%)   1.1180 (100.0%)  Run Command /usr/bin/java
   0.0001 (100.0%)   0.0006 (100.0%)   0.0007 (100.0%)   1.1180 (100.0%)  Total

0  llc               0x0000000105c1ec63 PrintStackTrace(void*) + 51
1  llc               0x0000000105c1f21d SignalHandler(int) + 333
2  libsystem_c.dylib 0x00007fff90e7594a _sigtramp + 26
3  libsystem_c.dylib 0x000000000000ebc0 _sigtramp + 18446603338085143184
4  llc               0x00000001052482cf getPhysicalRegisterVT(llvm::SDNode*, unsigned int, llvm::TargetInstrInfo const*) + 31
5  llc               0x0000000105255287 (anonymous namespace)::ScheduleDAGRRList::PickNodeToScheduleBottomUp() + 2351
6  llc               0x0000000105255a78 (anonymous namespace)::ScheduleDAGRRList::ListScheduleBottomUp() + 320
7  llc               0x0000000105255dec (anonymous namespace)::ScheduleDAGRRList::Schedule() + 456
8  llc               0x0000000105262745 llvm::ScheduleDAGSDNodes::Run(llvm::SelectionDAG*, llvm::MachineBasicBlock*) + 107
9  llc               0x0000000105332b4c llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 3184
10 llc               0x00000001053351f3 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) + 281
11 llc               0x0000000105336266 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 4204
12 llc               0x000000010533688f llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 597
13 llc               0x00000001054f19a6 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 104
14 llc               0x0000000105aa57e0 llvm::FPPassManager::runOnFunction(llvm::Function&) + 384
15 llc               0x0000000105aa04c6 llvm::FPPassManager::runOnModule(llvm::Module&) + 130
16 llc               0x0000000105aa51ff llvm::MPPassManager::runOnModule(llvm::Module&) + 635
17 llc               0x0000000105aa91ee llvm::PassManagerImpl::run(llvm::Module&) + 150
18 llc               0x0000000105aa9293 llvm::PassManager::run(llvm::Module&) + 39
19 llc               0x0000000104e20d20 main + 7344
20 libdyld.dylib     0x00007fff8dc3d7e1 start + 0
21 libdyld.dylib     0x0000000000000008 start + 18446603338137741351
Stack dump:
0.  Program arguments: /Users/stopiccot/code/flash/crossbridge/sdk/usr/bin/llc -gendbgsymtable -jvm=/usr/bin/java -falcon-parallel -filetype=obj /Users/stopiccot/code/flash/crossbridge/sdk/usr/lib/libm.o -o /Users/stopiccot/code/flash/crossbridge/sdk/usr/lib/stdlibs_abc/libm.o 
1.  Running pass 'Function Pass Manager' on module '/Users/stopiccot/code/flash/crossbridge/sdk/usr/lib/libm.o'.
2.  Running pass 'AVM2 DAG->DAG Pattern Instruction Selection' on function '@__divmoddi4'
make[3]: *** [abcstdlibs_more] Segmentation fault: 11
make[3]: *** Waiting for unfinished jobs....
===-------------------------------------------------------------------------===
                         Miscellaneous Ungrouped Timers
===-------------------------------------------------------------------------===

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   0.0001 (100.0%)   0.0006 (100.0%)   0.0007 (100.0%)  66.3638 (100.0%)  Run Command /usr/bin/java
   0.0001 (100.0%)   0.0006 (100.0%)   0.0007 (100.0%)  66.3638 (100.0%)  Total

make[2]: *** [abcstdlibs] Error 2

Building the SDK

As noted elsewhere, I constructed a minimal PATH variable to exclude random unix-like tools from the tool chain. That got me a ways through the "make".

My current stumble is in make "make"

checking whether the C compiler works... no
configure: error: in `/cygdrive/c/crossbridge-master/build/win/make':
configure: error: C compiler cannot create executables

Compiling on Mac OS 10.8.4 fails at abclibs

Building crossbridge using $ make fails on Mac OS 10.8.4. I keep seeing this error and haven't had much success debugging.

    -  abclibs
    Failed to build: abclibs
    make[1]: *** [all_with_local_make] Error 1
    make: *** [all] Error 2

abclibs log doesn't contain munch info:

    Updating goal targets....
     File `abclibs_compile' does not exist.
    Must remake target `abclibs_compile'.
    Invoking recipe from Makefile:944 to update target `abclibs_compile'.
     File `abclibs_asdocs' does not exist.
    Must remake target `abclibs_asdocs'.
    Invoking recipe from Makefile:169 to update target `abclibs_asdocs'.
    /Users/Catalin/crossbridge/build
    make[3]: *** [abclibs_asdocs] Error 1
    make[3]: *** Waiting for unfinished jobs....
    found 328 syscalls
    generated 91 syscalls
    DefaultPreloader.swf, 2215 bytes written
      ./Exit.abc, 159 bytes written in 0.550 seconds
    ...
    ./PlayerKernel.abc, 13594 bytes written in 1.705 seconds
    make[2]: *** [abclibs] Error 2

I found this in asdoc log, but not sure if it's related. The package lists 64-bit Java JVM as a requirement.

    Error: This Java instance does not support a 32-bit JVM.
    Please install the desired version.

Hello world milestion for clang toolchain

Simple hello world application

#include <stdio.h>

int main() {
    printf("flascc test\n");
    return 0;
}

Compilation

 stopiccot$ .../crossbridge/sdk/usr/bin/clang++ main.cpp -emit-swf -o ~/output.swf
 compiling for C++
 .../crossbridge/sdk/usr/bin/ld: error: cannot open /stdlibs_abc/libstdc++.a: No such file or directory
 .../crossbridge/sdk/usr/bin/ld: error: cannot open /stdlibs_abc/libsupc++.a: No such file or directory
 .../crossbridge/sdk/usr/bin/ld: error: cannot open /stdlibs_abc/libcHack.o: No such file or directory
 .../crossbridge/sdk/usr/bin/ld: error: cannot open /stdlibs_abc/libm.o: No such file or directory
 .../crossbridge/sdk/usr/bin/ld: error: cannot open /stdlibs_abc/libc.a: No such file or directory
 .../crossbridge/sdk/usr/bin/ld: error: cannot find -lstdc++
 .../crossbridge/sdk/usr/bin/../../usr/lib/CModule.abc: error: undefined reference to '_malloc'
 .../crossbridge/sdk/usr/bin/../../usr/lib/CModule.abc: error: undefined reference to '_free'
 .../crossbridge/sdk/usr/bin/../../usr/lib/CModule.abc: error: undefined reference to '_flascc_uiTickProc'
 /var/folders/gy/5rs8cgt96sj_1bf1qxcpqmtw0000gn/T/main-qco5Ry.o: error: undefined reference to '_printf'
 .../crossbridge/sdk/usr/bin/../../usr/lib//stdlibs_abc/crt1_c.o: error: undefined reference to '_atexit'
 .../crossbridge/sdk/usr/bin/../../usr/lib//stdlibs_abc/crt1_c.o: error: undefined reference to '__init_tls'
 .../crossbridge/sdk/usr/bin/../../usr/lib//stdlibs_abc/crt1_c.o: error: undefined reference to '__fini'
 .../crossbridge/sdk/usr/bin/../../usr/lib//stdlibs_abc/crt1_c.o: error: undefined reference to '__init'
 .../crossbridge/sdk/usr/bin/../../usr/lib//stdlibs_abc/crt1_c.o: error: undefined reference to '_exit'
 Warning: Multiply defined: Qname: PlayerKernel::{PackageNs:"com.adobe.flascc.kernel"}
 Warning: Multiply defined: Qname: createRawWorker::{PackageNs:"C_Run"}
 Warning: Multiply defined: Qname: createflasccWorker::{PackageNs:"C_Run"}
 clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Crossbridge is not support the cygwin 64-bit?

Crossbridge is not support the cygwin 64-bit?

when i run the command:

$fred ~/Downloads/Crossbridge_1.0.1/samples/01_HelloWorld
$../../sdk/usr/bin/gcc hello.c -emit-swf -o hello.swf
$echo $?
127

it just return.

i use the echo $? to check the return code. it is 127

New pthread should not duplicate VFS memory

If I create an embedable VFS of significant size (ie: 128mb), and then create a new pthread, memory consumption will increase 128mb, and an additional 128mb for each pthread created after that.

Based on my reading here: https://github.com/adobe-flash/crossbridge/wiki/The-memory-usage-of-threads , the non-domain memory is copied each time a pthread is created. Since any file IO operations are thunked back to the main thread, there is no reason the file system should ever be copied. Additionally, the VFS is made up of mostly ByteArrays, which are sharable between workers, which I would assume would also be exempt from being copied.

This single issue renders pthreads useless in a real application/game which requires the use of a VFS.

Because there is no obvious reason for any ByteArray objects in the AS3 domain to ever be copied, I would definitely label this as a major bug.

Cannot build master branch on Windows platform using Cygwin

I need help to be able to build crossbridge sdk (master branch) on windows with cygwin.

I've ran make with -i flag to ignore errors, the following file contains all of the build logs:
https://dl.dropboxusercontent.com/u/1375050/crossbridge-logs-win-1.zip

I think it would help contribution if the development would be not restricted to mac only (I do NOT own one)

I've updated the docs for windows users about what I'd figured out:
https://github.com/vpmedia/crossbridge/blob/master/BUILDING.md
https://github.com/vpmedia/crossbridge/blob/master/CHANGES.md

License?

What license is crossbridge released under?

LLVM/clang support

Hello,

we're working on the C++ port of Minko (http://minko.io) to bring a bit more awesomeness to the Flash platform. Crossbridge is our dream come true!

But we're using C++ 2011 and I guess support for LLVM/clang 3.2+ is required to build properly. I'm creating this issue to have some feedback about the availability of such feature which as far as I understand is currently under development in the "future" branch.

Please also indicate how we can help: we have some C++ 2011 code base and we would be pleased to dedicate some C++ developers to make your work easier on this.

Thanks for the awesome work! :)

pthread support

Hello,

great project! Open sourcing this is incredible and I hope you'll enjoy what the community will make out of it :)

Anyway, I read that starting at Flash 11.5 the x-compiler will support threading by binding pthreads. Is it working ?

As Flash has workers but no real threads, what are the limitations or does any pthread app. run properly when x-compiled?

Thank you for your help,

crossbridge for linux?

Is there an opportunity to build this SDK for linux? Or there are any problems with it?

Failing to build (futures)

After successfully building master branch I'm trying to build futures branch. It fails for me while building "base" target. Here is build log:

rsync -az --no-p --no-g --chmod=ugo=rwX --exclude 'iconv.h' avm2_env/usr/include/ /Users/stopiccot/code/flash/crossbridge/sdk/usr/include
rsync -az --no-p --no-g --chmod=ugo=rwX avm2_env/usr/lib/ /Users/stopiccot/code/flash/crossbridge/sdk/usr/lib
rsync: change_dir "/Users/stopiccot/code/flash/crossbridge//avm2_env/usr/lib" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1122) [sender=3.0.9]
make[1]: *
* [base] Error 23

There is really no /avm2_env/usr/lib forlder in futures branch. Can someone upload missing folder?

Automatically generated exports passed to -flto-api not working

We're having problems with our automatically generated exports.txt file. We are producing the file dynamically exactly as outlined here:

http://www.adobe.com/devnet/games/articles/using-cplusplus-code-path-finding.html

The problem is that the nm command (and grep/sed/awk commands) emits C symbols with a preceding underscore. e.g. a global variable named "foo" shows up in the exports file as "_foo". When we try and access foo from action script like so:

var foo:int = CModule.read32(CModule.getPublicSymbol("foo"))

we get an exception of this sort:

ReferenceError: Error #1065: Variable _foo is not defined.
    at com.adobe.flascc::CModule$/getPublicSymbol()
    at com.adobe.flascc::Console/enterFrame()

If we manually remove the underscore from _foo in the exports.txt file, the issue goes away.

In Alex Mac's OpenCV example, he includes a statically generated exports.txt file which references a global variable called "imageData". The exports.txt file contains "imageData" not "_imageData". If we run the nm/grep/sed/awk command on his OpenCV faceTracker.cpp file, the exports.txt generated has "_imageData" and his face tracker demo fails to work.

Any idea what we should be doing here?

Merge codebase to the official SWIG project

I've made a feature request to merge this codebase (or parts) with the official swig project:
https://sourceforge.net/p/swig/feature-requests/94/
Not sure that this would lead to somewhere, but it would be great if other users would vote on that, because i would like this project to be kept alive.
Also donating to the apache foundation (maybe flex project) would be an option, if the original developers are not able to keep the project alive (no commits since 5(?) months, also no feedbacks for tickets)

C++11 support

Hello,

I am currently trying to provide cross-compilation for a c++ 3d engine to flash. This engines uses a lot of C++11 features.

Sadly, crossbridge beiing built on gcc 4.3, it have no support for these features. I was wondering what amount of changes would be necessarry to build crossbridge on gcc 4.8 with c++11 support.

I see that the llvm-gcc frontend is not supported anymore by llvm. It means I will need to port the changes to dragonegg. Are there other tools that would not be compatibles with a new version of gcc/llvm?

Undefined references in thread lib.

After upgrading to Freebsd 9.1 libs, libthr now needs extra APIs to work.

/Users/yeli/repos/cb-futures/sdk/usr/bin/../../usr/lib//stdlibs_abc/libthr.a: error: undefined reference to '___sys_setcontext'
/Users/yeli/repos/cb-futures/sdk/usr/bin/../../usr/lib//stdlibs_abc/libthr.a: error: undefined reference to '___sys_swapcontext'
/Users/yeli/repos/cb-futures/sdk/usr/bin/../../usr/lib//stdlibs_abc/libthr.a: error: undefined reference to '___sys_sigreturn'
/Users/yeli/repos/cb-futures/sdk/usr/bin/../../usr/lib//stdlibs_abc/libthr.a: error: undefined reference to '_getcontext'
/Users/yeli/repos/cb-futures/sdk/usr/bin/../../usr/lib//stdlibs_abc/libthr.a: error: undefined reference to '_check_suspend'

These APIs seem newly involved in thread lib in Freebsd 9.1 and yet to be implemented (mock?) in crossbridge.

Anyone who would like to give a try is appreciated!

Steps:
1 get the newest code base
2 make all (dmalloc and libsdl now will fail)
3 build the hello world sample with option -pthread
[opt] for a better investigation, download Freebsd 9.1
4 svn co http://svn.freebsd.org/base/release/9.1.0/ freebsd-9.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.