Code Monkey home page Code Monkey logo

Comments (34)

johnno1962 avatar johnno1962 commented on May 22, 2024

Hi, have a look at running /tmp/eval.sh to see what the problem is or could you email it to me injection at johnholdsworth dot com. It seems to have found the compile command OK. Would be good to work out the problem if it used to work in InjectionApp. Are you using the new build system?

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

I have check the .sh file. It looks like all is right. I'm sorry I can't email the file to you because of security.

And I don't know what the new build system mean?

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Can you try running the file after editing off the extra cruft at end of the string? This is what the app does. “new build system” is part of Xcode 9. If you’re not ware of it you’re probably not using it.

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

I have tried to running the file in terminal after deleting the part of -o ..... . And It works fine, only warning and no error.
I use the standard build system.

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

I have email you the sh file.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

I’ve prepared a test version of the app which produces a file /tmp/command.sh which is the command actually executed after minimal processing. There must be a difference in escaping if you say the edited eval<N>.sh command works. Can you look into the differences please?

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

I'm sorry that I give you the wrong information. In fact, the eval.sh file works in the terminal without changing anything. And the ".command.sh" works in terminal too. I have compared two files and they are almost same except the time command.

I checked the code how to run shell in bundle. Maybe there is something different between execve and terminal?

I used to run shell with the below setting

    NSTask *task = [NSTask new];
    [task setLaunchPath:@"/bin/sh"];
    [task setArguments:@[self.scriptPath]];
    [task setCurrentDirectoryPath:[self lastFolderPath]];
    task.environment = @{@"LC_ALL":@"en_US.UTF-8",@"LANGUAGE":@"en_US.UTF-8",@"LANG":@"en_US.UTF-8",@"PATH":@"/usr/bin:/bin:/usr/sbin:/sbin"};

It seems that lacks the environment. I tried to add these to execve but I got errors.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

I’m beginning to get an idea what the problem might be here. Due to the new version of injection’s root being “SwiftEval” all build commands are run using execve in the simulator 😱. Everything seems to run except in the simulator filenames are case sensitive i.e. HeAdEr.h when it is #included will not be the same as Header.h on the file system. Can you check this is not the case here? The headers where precompiled on OSX but the incremental compile will be trying to open the header inside the simulator’s OS. Eventually I’ll have to change this no doubt to run builds on OSX but this could be the problem at the moment.

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

Sorry,I had no idea what you mean. Did you mean some file named Header.h, but it's inclued as HeAdEr.h? If it is your meaning, I think this not the problem with caused the error. I have checked the project . The error said that it cannot find the file named "SomeHeader.h", and I cannot find anything like "someheader,someHeader,Someheader" in my project.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

It’s precompiling in a header you don’t reference in your project at all? It’s not in a pod or something?

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

Yes, I have referenced the file somewhere. What I means is the file name and import are case equal.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Seems like I’ll have to move the compile onto OSX somehow which I was trying to avoid but it's where it should be.

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

Why you didn't want to move the compile onto OSX?

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

I have create a demo project which contain the execve code. It can build for iOS or macOS. In my test, the eval.sh works in macOS and doesn't work in iOS.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Ok, I’ve uploaded a version that compiles on OSX if you want to give it a try. It gives slightly less feedback but I can work on that if it solves your problem.

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

Still no work...
The file named "eval.log" is empty. But I get the output in console:

ld: warning: ignoring file /tmp/eval2.o, file was built for i386 which is not the architecture being linked (x86_64): /tmp/eval2.o

sometimes likes below:

dlopen() error: dlopen(/tmp/eval1.dylib, 2): Symbol not found: _OBJC_CLASS_$_XXToastView

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

At least it’s compiling now. Are you building/running 32 bit? That’s not supported in the new version.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Right, I’ve uploaded a version that supports 32 bit apps! Can you test it out?

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

It looks very strange after updating the project. The fileWatcher's callback would not be invoked, so even though I changed the files would not cause rebuilding.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Are you watching the right project? The project is taken from the active project when the app starts.

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

I found the real reson is the injection was stuck on the code bundlePath = [self readString] in InjectionServer.mm.
I noticed that the function runInBackground had removed some code. Is it right?

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Perhaps you have very long paths. I’ve moved the connection setup to the background thread. Are you building yourself or using the binary (updated) The changes are intentional. Most work is now on OSX

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

It can rebuild now. But still said symbol not found.
I found the symbol which cannot be found are in other framework or is created by runtime.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Is the symbol in a framework that is in the app bundle? It should be linking with them. Are you using Google Analytics or any other binary frameworks? The differences with InjectionApp are minimal now.

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

Yes,the framework is in the app bundle. In fact, it's a subProject and it's target is a dynamic framework. I found the setting of Symbols Hidden by Default is YES. Is it the problem?

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Could easily be. Injecting something that refers to hidden symbols inside another dynamically loaded library can be problematic. Files that don't should be OK. Did this work with the old injection?

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

I have checked . It didn't work either with the old injection. So which settings can I change? I found that only change Symbols Hidden by Default would not work.
aaa

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

By the way, the error below still exist, the injected code was in a subProject.

ld: warning: ignoring file /tmp/eval2.o, file was built for i386 which is not the architecture being linked (x86_64): /tmp/eval2.o

It seems to build on a wrong architecture.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Strange "Symbols Hidden by Default” didn’t affect the framework. I’ve pushed a new version that re-instates the filtering by target architecture when looking for the compile which should fix the last problem you mentioned. Bit by bit this is becoming the old Injection!

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

I have resolve the symbol problem by remolve the setting of Exported Symbols File. It seesms that the dylib file would not link the specific file when it was loading.
And the last problem had resolved. Now I can inject my project.
Thank you very much!

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

Great, thanks for sticking with the various iterations. Closing this now.

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

@johnno1962 I have a question that if there are a binary framework in my project, it means I cannot inject files related this framework? Have any way to resolve it?

from injectioniii.

johnno1962 avatar johnno1962 commented on May 22, 2024

What is the error?

from injectioniii.

starFelix avatar starFelix commented on May 22, 2024

such like this: dlopen() error: dlopen(/tmp/eval7.dylib, 2): Symbol not found: _OBJC_CLASS_$_CFT_F234309

In my project,the architecture like (MainProject (big dynamic Framework (somthing static library)))
when I try to inject the files which related the static libray,and these files are in framework, I will get the error.

from injectioniii.

Related Issues (20)

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.