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

How do I compile wax_stdlib about 64bit #59

Closed
linmingzhi opened this issue Dec 19, 2014 · 35 comments
Closed

How do I compile wax_stdlib about 64bit #59

linmingzhi opened this issue Dec 19, 2014 · 35 comments

Comments

@linmingzhi
Copy link

My project is developmenting for more half a year in wax_hua,bug apple must support 64bit on 2015.02.01. but My project Does not support arm64 now. Now what should I do。and How do I compile wax_stdlib about 64bit。

@HuJianChong
Copy link

+1

2 similar comments
@KimReboot
Copy link

+1

@felipejfc
Copy link

+1

@maxfong
Copy link

maxfong commented Feb 5, 2015

+10086

@felipejfc
Copy link

I figured out how to compile wax_stdlib with 64bits support, take a look guys
https://github.com/felipejfc/wax_x86-64

However there is still work to do, the library is being successfully loaded but it is not working as expected yet, the method pcallUserdata on it's 5th call is making reference to a invalid address in memory and I can't figure out why yet. I invite you all to try to fix this. Later today I'll update the readme on my fork with the instructions of how I've compiled for 64 bit but you can start debugging with the precompiled one to find why it is not working and fell free to push fixes. remember to compile the projects in ARM64.

Regards

@maxfong
Copy link

maxfong commented Feb 5, 2015

i try compiled wax_stdlib.h 64-bit
https://github.com/maxfong/wax_stdlib_x64

@felipejfc
Copy link

does this work?
I can compile and load the lib but still I get a crash in method wax_fromInstance
do you got it to work?

I always get EXC_BAD_ACCESS code=1

regards

@felipejfc
Copy link

Friends, I've got it fully working on both architectures, here you go:

https://github.com/felipejfc/wax_x86-64

Regards!

@maxfong
Copy link

maxfong commented Feb 6, 2015

int size = wax_fromObjc(L, type, usedArgs); -> int size = wax_sizeOfTypeDescription(type); fix crash...

@linmingzhi
Copy link
Author

download wax_x86-64 ,in States (without wax.framework), try on iphone5 (hardware support 32bit),it run ok. but on iphone6plue (hardware support 32bit and 64bit),it crash ,in wax_helpers.m , "if ([instance isKindOfClass:[NSString class]]) {" thread 1:EXC_BAD_ACCESS(code=1,address=0x81a59408e1b9)

@felipejfc
Copy link

strange, I can run well here on iphone 6 simulator!

@linmingzhi
Copy link
Author

iphone 6 simulator run OK,but iphone 6 machine run crash 。 With the above question。

@maxfong
Copy link

maxfong commented Feb 6, 2015

@felipejfc Thanks,my wax_stdlib_x64 Only how create wax_stdlib_x64.h file;
my WaxPatch_X64 using your's wax_x86-64 find iphone6 crash, if change int size = wax_fromObjc(L, type, usedArgs); to int size = wax_sizeOfTypeDescription(type); ,Some features are not available。。。

@felipejfc
Copy link

If you change this line you'll miss some features @maxfong, I'm aware of the bug now @linmingzhi, I'm getting crash now using a device too... I'll try to figure it out! THe problem lies in grabbing va_list

@felipejfc
Copy link

I've put a description on the problem in my repo

https://github.com/felipejfc/wax_x86-64

@maxfong
Copy link

maxfong commented Feb 7, 2015

HI,@felipejfc, i test your's code,find arm64 device,lua using OC delegate run crash and wax examples run crash,thank you for your efforts :>,come on

@felipejfc
Copy link

@maxfong I'm aware of the issues, I'm currently working on a fix, I can already access the arguments but I need to fix an issue with pointers... I'm very near of fixing it, keep an eye on it

@felipejfc
Copy link

@linmingzhi @maxfong it must be fully working now, can you guys confirm?

regards!

@felipejfc
Copy link

Oh well I guess I identified another issue with multiple arguments method calls that is not covered by the tests --''
I'll be fixing it later

@felipejfc
Copy link

Ok, now I think it is really working @linmingzhi @maxfong @KimReboot @HuJianChong https://github.com/felipejfc/wax_x86-64

I managed to run tests and examples

@maxfong
Copy link

maxfong commented Feb 8, 2015

@felipejfc ,if i // for (int i = 0; i < n-2; i++) { free(sharedMemoryForArgs[i]); },it will work OK,THX

@felipejfc
Copy link

@maxfong If you free then it don't work? I think it's better to free them to avoid a memory leak... It works OK here even freeing the args, can you provide a code where freeing causes problems?

@maxfong
Copy link

maxfong commented Feb 8, 2015

@felipejfc my repo:https://github.com/maxfong/WaxPatch_X64/tree/develop, run develop branch, for free sharedMemoryForArgs will crash

@felipejfc
Copy link

@maxfong it is true that it was causing a crash, I released a new commit with fix for that, the arguments needs to be freed so that no memory leak occurs. can you try it?

@linmingzhi
Copy link
Author

NSMutableString *pp = [[NSMutableString alloc] init];
NSString *dir = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:modeName];
NSArray *fileList = [fileManager contentsOfDirectoryAtPath:dir error:&error];
for (NSString *file in fileList) {
//load A lot of resources (.lua) in the file
[pp appendFormat:@"%@/?.lua;",[dir stringByAppendingPathComponent:file]];
}
[pp appendFormat:@"%@/?/%@",dir,[[dir stringByAppendingPathComponent:[dic objectForKey:@""]] stringByAppendingPathComponent:[dic objectForKey:@"Enter"]]];
setenv(LUA_PATH, [pp UTF8String], 1);
wax_start((char *)[[dic objectForKey:@"Enter"] UTF8String], nil);

then causing a crash ../stdlib/waxClass.lua:28: Can't override method with return type d .And @maxfong is a bit similar ---run develop branch, for free sharedMemoryForArgs will crash

@felipejfc
Copy link

@linmingzhi can you provide more information on this crash? what are you trying to do? are you using my last repo version? I've already solved the problem @maxfong pointed for sharedMemoryForArgs

@maxfong
Copy link

maxfong commented Feb 9, 2015

HI @linmingzhi , @felipejfc did
// for (int i = 0; i < n-2; i++) {
// free(sharedMemoryForArgs[i]);
// }
//
// free(sharedMemoryForArgs);

@felipejfc
Copy link

@maxfong @linmingzhi felipejfc@45bbb5e

To avoid memory leak!

@IPv6
Copy link

IPv6 commented Mar 8, 2015

trying to use https://github.com/felipejfc/n-wax to replace wax with 64bit-enabled one.
but i cant compile my app (

  1. build using "master branch" fails with linker error
Undefined symbols for architecture arm64:
  "_ffi_type_pointer", referenced from:
      _overrideMethod in wax_instance.o
  "_ffi_typeForTypeEncoding", referenced from:
      _overrideMethod in wax_instance.o
  "_createFFIClosure", referenced from:
      _overrideMethod in wax_instance.o
ld: symbol(s) not found for architecture arm64
  1. build with "no-ffi" branch fails with linker errors
Undefined symbols for architecture armv7:
  "_NewArgumentList", referenced from:
      _myForwardInvocation in wax_instance.o
  "_addArgument", referenced from:
      _myForwardInvocation in wax_instance.o
  "_freeArguments", referenced from:
      _myForwardInvocation in wax_instance.o
ld: symbol(s) not found for architecture armv7

in both cases i cant find this method anywhere (except bold declarations)
@felipejfc any advice? thanks for trying to keep this project up! wax is convinient indeed, it`s a pity it is dropped by probablycore //

@felipejfc
Copy link

@IPv6 I think you are not including all n-wax files in your project, check if you are including wax_ffi_closure .m and .h and also /lib/libffi files

@felipejfc
Copy link

About the no_ffi branch you are probably not including wax_arguments .m and .h. In both cases you need to add files to your project, with the hacks i made for making it work i added new files into Wax. Note that I do not know which version is more performatic /stable. With or without libffi. Ild like your feedback

@caikelun
Copy link

@felipejfc Hi, I have just tested n-wax(the newest master branch: 89f3d35), the "states example" crash on iphone6 plus hardware device(Thread1: EXC_BAD_ACCESS (code=2, address=0x104aa8490)), but run OK on iphone6 plus simulator. Bug from libffi??

@qazaaa
Copy link

qazaaa commented Apr 15, 2015

@felipejfc Hi,would you please show me some details about how to compile wax_stdlib_64.h,thanks

@maxfong
Copy link

maxfong commented Apr 15, 2015

@intheway
Copy link

wax is maintained by alibaba now, 64bit is support. see https://github.com/alibaba/wax

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

10 participants