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

compile issue on iOS in Xcode #222

Closed
digitalgust opened this issue Nov 29, 2023 · 7 comments
Closed

compile issue on iOS in Xcode #222

digitalgust opened this issue Nov 29, 2023 · 7 comments

Comments

@digitalgust
Copy link

digitalgust commented Nov 29, 2023

iPhone can't using jit , but my program is cross platform application, so i need compile pass in iOS, although i've disabled jit on iOS.
the "SLJIT_UPDATE_WX_FLAGS" is not defined.
env: macOS Xcode iPhone12PM, arm

截屏2023-11-30 上午1 16 05
@zherczeg
Copy link
Owner

@carenas maybe can help to you.

So your code contains the jit compiler even if it is unusable? Why not guarding it out in some way? This sounds very inefficient since it increases the code size for nothing.

@digitalgust
Copy link
Author

Because sljitLir.h is referenced in many places, sljitLir.c needs to be compiled into the project. Therefore, I hope the entire project can be compiled successfully. When defining macros, add an #else to adapt to other architectures or CPU types.

@carenas
Copy link
Contributor

carenas commented Nov 30, 2023

When defining macros, add an #else to adapt to other architectures or CPU types.

in this case though the omission was intentional (see #156), because IMHO it is better to break the build than compile code that WILL crash if invoked.

maybe the problem for your codebase is that you are including sljitLir.h in too many places and should had instead included sljitLir.c in the single place where SLJIT is being used?

@digitalgust
Copy link
Author

sljit itself is a tool library for cross-platform and cross-architecture, so I think it would be more convenient for sljit users if it can be compiled on all platforms. Therefore, I suggest that it should be able to be compiled on the IOS platform. The early versions of sljit did not have this problem. Recently, after I updated to 0.95, the problem occurred. Although I can add a line #define SLJIT_UPDATE_WX_FLAGS(from, to, enable_exec) at line 108 of the sljitExecAllocatorApple.c file to solve the problem, as a super excellent tool, it would be better to solve such problems.

@zherczeg
Copy link
Owner

I am ok to change this. However, the problem, that the compiler will not work if you accidentally run it still persists. There is one more thing: on cpus which the compiler does not support will also throw a compiler error.

@carenas
Copy link
Contributor

carenas commented Nov 30, 2023

FWIW SLJIT could be made to work in iOS (AFAIK it does work, or at least used to in rooted devices AS-IS), and indeed the lack of this definition is an invitation to add the code that is missing to do so (see PCRE2Project/pcre2#212 for some ideas that failed to materialize).

as you pointed out, there is nothing preventing YOU to add an empty define instead and move on, as far as you understand the risks, and as @zherczeg explained, that it will be also inefficient (and maybe even a security concern) to carry extra code that is not in use.

indeed, I wouldn't be surprised if Apple will later reject your app, because it has references in the code to "dangerous" APIs that go against their stated policies.

@digitalgust
Copy link
Author

Thank you, I have excluded sljitLIr.c as a source file in the project, and it compiles successfully. However, I still thank you for the reminder and effort. sljit is indeed excellent.

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

3 participants