Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

oneeyeman

macrumors newbie
Original poster
Nov 14, 2012
16
0
Hi, ALL,

First I want to apologize for a long post. I need to explain everything in order to get a best possible answer.

I am a developer who started working on Mac + Xcode on the OSX 10.8.
I made a project which contains a binary and couple of dylib's. On that Mac everything was working correctly. I was able to run the binaries and debug them from within Xcode.

Relatively recently I bought myself a newer Mac with the version 10.13. I installed Xcode, grab the project from the GitHub, recompiled and tried to run it.

Unfortunately it didn't run. It didn't even started. It failed somewhere in the assembly code before trying to access the very first C++ code I wrote..

I went back to the old Mac and everything is still works correctly there.

I kind of concluded that somehow during the old Xcode project transitioning to the new Xcode, it changed the placement of the dylib binaries and when I try to run it it can't load dylib's and fails to start.
WHat I also found is that I can open the Terminal, go to the build directory for the project and issue:

Code:
open my_project.app

and it runs.

But trying to debug an application from lldb inside the Terminal is very unpleasant job comparing to doing so from the Xcode.

Is there anyway to fix that, other than re-create the project from scratch on the new machine?
Is my conclusion even correct and this is the actual reason for the failure? Or there is soething else happening that prevents me from running the program from the Xcode correctly?

Any and all help will be greatly appreciated.

Thank you.
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
If you can just run the open command and it's the latest version reflecting new code changes that sounds like the project builds and links correctly but Xcode just can't find the app bundle afterwards or something weird like that. What error is Xcode spitting out exactly?

PS. LLDB and GDB are actually pretty neat once you get the hang of it. Can recommend it :) But that's of course besides the point.

Oh and is your project based around a Makefile? Make? Or "just" the Xcode build schema? And on that point is the expected build schema set inside Xcode?
 

oneeyeman

macrumors newbie
Original poster
Nov 14, 2012
16
0
If you can just run the open command and it's the latest version reflecting new code changes that sounds like the project builds and links correctly but Xcode just can't find the app bundle afterwards or something weird like that. What error is Xcode spitting out exactly?

There is no error.
It just crashing the execution and the cursor goes to some Assembly code.

PS. LLDB and GDB are actually pretty neat once you get the hang of it. Can recommend it :) But that's of course besides the point.

I am very familiar with gdb, but not lldb. ;-)
And so a lot of command is different.
Besides, I get the thing if I try to execute it.

Oh and is your project based around a Makefile? Make? Or "just" the Xcode build schema? And on that point is the expected build schema set inside Xcode?

No, it is explicitly Xcode project based on the Apple Application Bundle.
And what do you mean with the last question.

Thank you.
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
There is no error.
It just crashing the execution and the cursor goes to some Assembly code.
hm. That’s peculiar.

When the cursor jumps to the assembly, is there a yellow line with a little hamburger-menu-looking button at the very right of the line? Sometimes that can reveal more info. What kind of assembly is it faulting with? Memory access? A call to a framework/library method?

am very familiar with gdb, but not lldb. ;-)
And so a lot of command is different.
Besides, I get the thing if I try to execute it.

Ah, right, yeah. I’m most familiar with GDB too. There’s a nice little LLDB/GDB cheat-sheet online though with command conversions between the two.


No, it is explicitly Xcode project based on the Apple Application Bundle.
And what do you mean with the last question.
I’d add screenshots but unfortunately I’m in bed and only have my iPad at the moment - But in the top left of Xcode where you can select build target, you should be able to get a menu with build schemas. Like “testing”, “run”, ”profile”, etc. Based on my corrected understanding of your problem I doubt it’ll hold anything relevant, but I thought maybe it wasn’t configured properly in there.

If you select the project as a whole in the file browser on the left you should also be able to modify compiler/linker options and such, but it weirdly sounds like it’s crashing at runtime even though you can run your code fine manually.

Is this an open source project or a private GitHub repo? If it’s something you have open source anyway I’d potentially like to have a crack at it with Xcode on Big Sur to see if I can replicate the behaviour to fiddle around with myself :)
 

oneeyeman

macrumors newbie
Original poster
Nov 14, 2012
16
0
hm. That’s peculiar.

When the cursor jumps to the assembly, is there a yellow line with a little hamburger-menu-looking button at the very right of the line? Sometimes that can reveal more info. What kind of assembly is it faulting with? Memory access? A call to a framework/library method?

No, nothing like that.
See the screenshot below:

Screen Shot 2021-04-23 at 10.53.05 PM.png


As you can see it stops on dylib call.

Ah, right, yeah. I’m most familiar with GDB too. There’s a nice little LLDB/GDB cheat-sheet online though with command conversions between the two.

Yup, I saw that.
But as said - I cant even run it.

I’d add screenshots but unfortunately I’m in bed and only have my iPad at the moment - But in the top left of Xcode where you can select build target, you should be able to get a menu with build schemas. Like “testing”, “run”, ”profile”, etc. Based on my corrected understanding of your problem I doubt it’ll hold anything relevant, but I thought maybe it wasn’t configured properly in there.

You still in bed or already in bed? ;-)
Anyway, below is the screenshot of my Xcode workspace:

Screen Shot 2021-04-23 at 11.02.54 PM.png


What "schema" menu you are talking about?

If you select the project as a whole in the file browser on the left you should also be able to modify compiler/linker options and such, but it weirdly sounds like it’s crashing at runtime even though you can run your code fine manually.

It is crashing at runtime during during dlopen() call.


Is this an open source project or a private GitHub repo? If it’s something you have open source anyway I’d potentially like to have a crack at it with Xcode on Big Sur to see if I can replicate the behaviour to fiddle around with myself :)
If you are not scared of little compiling... ;-)
My project depends on wxWidgets (I use latest version), iODBC, mySQL connectior and pqsql.

Thank you.
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
No, nothing like that.
See the screenshot below:

View attachment 1763023

As you can see it stops on dylib call.



Yup, I saw that.
But as said - I cant even run it.



You still in bed or already in bed? ;-)
Anyway, below is the screenshot of my Xcode workspace:

View attachment 1763025

What "schema" menu you are talking about?



It is crashing at runtime during during dlopen() call.



If you are not scared of little compiling... ;-)
My project depends on wxWidgets (I use latest version), iODBC, mySQL connectior and pqsql.

Thank you.

Hi, just woke up again. I'll probably try compiling it myself later,
Can I have a link? I tried googling dbhandler but found what I assumed to be other projects instead.


In the mean time, try this

If that works the issue is that some of the libraries your app depends on need to be code signed to work without the entitlement.

Regarding what I was saying about schema, it's apparently just called scheme. My bad.
1619264002695.png

It's the menu with your app's name, but I doubt there's any answers to be found there anymore. It would more have been if it were a build-error. Like if it just didn't know what to do when you hit build-and-run
 

oneeyeman

macrumors newbie
Original poster
Nov 14, 2012
16
0
Hi, just woke up again. I'll probably try compiling it myself later,
Can I have a link? I tried googling dbhandler but found what I assumed to be other projects instead.

Probably.
Let me know when u can spend couple of hours doing the compilation and I will give you an instructions.

In the mean time, try this

I presume it should be inside info.plist?
Screen Shot 2021-04-24 at 10.33.50 AM.png


Should I add it there?
Let me know...

If that works the issue is that some of the libraries your app depends on need to be code signed to work without the entitlement.

Regarding what I was saying about schema, it's apparently just called scheme. My bad. View attachment 1763115
It's the menu with your app's name, but I doubt there's any answers to be found there anymore. It would more have been if it were a build-error. Like if it just didn't know what to do when you hit build-and-run

Yes, probably not.

Thank you.
 

Senor Cuete

macrumors 6502
Nov 9, 2011
429
31
Your screen shot shows a red stop sign in the top bar. This shows two errors. You can't build the project until you fix these errors. Click on this icon and the left pane will show the build errors. Correct them and build the project with command B. When it shows the assembly code it's showing where the error occurred. Set a break point in the code, maybe even starting at main(), and step through, or into, the code until you see where it crashes. Fix it.
 

Senor Cuete

macrumors 6502
Nov 9, 2011
429
31
Also the yellow warning triangle shows 148 warnings. The project will build with these but it's likely that it will crash when the offending lines of code are executed. Click on the yellow icon and they will be displayed in the left pane. It's likely that these are similar or identical problems. Fix them.
 

oneeyeman

macrumors newbie
Original poster
Nov 14, 2012
16
0
@Senor Cuete ,

Please re-read what I wrote in the OP and then come back.

Project is building fine as I can run it thru the terminal open command. The 2 errors you see is from the post compile script that copies all dylibs into the bundle and reminds them. They won't stop the program from running.

Warnings are just warnings. I'm aware of them. They will be fixed in time. But they will not prevent the code from running.

Now do you know how to fix the dlopen failure or not?

Thank you.
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
What I mentioned about the code signing should go into your entitlements file. This is my HexHelper tool's entitlements file.
1619306618542.png

1619306681263.png


An alternative way of testing the theory would just be to code sign the libraries you're using with your developer ID/local testing ID
 

Senor Cuete

macrumors 6502
Nov 9, 2011
429
31
I understood what you wrote. It seems weird. You probably don't have to add the libraries with a post build script. You could try to go to the target settings and add them to the Build Phases list of libraries in Link Binary With Libraries list. When you add the libraries with a post-build script and XCode gives you an error it makes me think that the libraries aren't properly linked and that's why the crash.

What errors does XCode display when you click on the red stop sign icon?

You are wrong about warnings in XCode/Cocoa. These can be warnings of trivial things that you can ignore but often, particularly with Ojective C or Swift methods, they usually will crash the program. In XCode you should treat these the same as as errors.

It looks like you don't have the lower right pane split. If this is visible you should see variables in the left half and logged messages and errors in the right.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.