Configure wxWidgets to use Xcode on a macOS

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
BobsTheDude
Earned a small fee
Earned a small fee
Posts: 19
Joined: Wed Mar 06, 2019 10:33 pm

Configure wxWidgets to use Xcode on a macOS

Post by BobsTheDude » Wed May 01, 2019 9:05 am

These steps work with wxWidgets compiled outside of Xcode, and allow you to build wxWidgets Applications using Xcode.

Setup:
  • macOS Mojave Version 10.14.4
    Version 10.2.1 (10E1001)
    wxWidgets-3.1.2
[*]If you are using wxWidgets installed by brew or have a version of wxWidgets already installed skip steps 1 through 4.[/*][/i]

1. Download the latest version of wxWidgets

2. Uncompress wxWidgets where you would like to build the libs.

3. Follow the wxWidgets build instructions located in <DIR_YOU_UNCOMPRESSED_WXWIDGETS>/wxWidgets-3.1.x/docs/osx/install.md

Example:

Code: Select all

cd <DIR>/wxWidgets-3.1.x
mkdir build-cocoa-osx
cd build-cocoa-osx
../configure --enable-debug --enable-unicode  --with-osx_cocoa --with-macosx-version-min=10.9 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
make -j 4 or just make
cd samples; make;cd ..
cd demos;   make;cd ..
4. After you configure and build wxWidgets successfully, verify that you will be using the correct version of wxWidgets by typing the following commands in terminal (terminal can be found in /Applications/Utilities)

Code: Select all

locate wx-config (shows all versions if installed)
which wx-config (display the location of the version you will be using)
If the version of wxWidgets you just installed matches the output from a and b, then proceed. If the which command shows a different path, then update your PATH statement in ~/.bash_profile with the correct path.

Example:

Code: Select all

vi ~/.bash_profile
WXWIDGETS_PATH=/Users/apps/application_support/wxWidgets-3.1.2/build-cocoa-osx
PATH=${WXWIDGETS_PATH}:${PATH}
export PATH
5.From terminal run

Code: Select all

wx-config –libs

capture the result for use a bit later. It should be hyphen hyphen not a single dash.
Output:

Code: Select all

-L/Users/apps/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_xrc-3.1 -lwx_osx_cocoau_html-3.1 -lwx_osx_cocoau_qa-3.1 -lwx_osx_cocoau_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1
6. From terminal run $> wx-config - -cxxflags capture the result for use a bit later. It should be hyphen hyphen cxxflags, not a single dash.
Output:

Code: Select all

-I/Users/apps/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/wx/include/osx_cocoa-unicode-3.1 -I/Users/apps/application_support/wxWidgets-3.1.2/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__
7. Download the wxWidgets Xcode template from:

Code: Select all

https://github.com/iMokhles/wxWidgets-Xcode-Template
  • This version uses the brew installed version of wxWidgets
    The script assumes you will install in /Library, not ~/Library, use ~/Library if you choose to use the script. (I do not use the script and do this step manually, starting with line 9.)
8. Change directory to where you downloaded the Xcode template wxWidgets-Xcode-Template-master.zip

9. Uncompress wxWidgets-Xcode-Template-master.zip

10. Change into the directory wxWidgets-Xcode-Template-master

11. You should see the following directories.

Code: Select all

LICENSE		
README.md	
install.sh	
screenshot.png	
simple.png	
wxm
12. Change to the Xcode developer directory run the following:

Code: Select all

cd ~/Library/Developer/Xcode
13. Test if the Templates directory already exists by running:

Code: Select all

 ls -l Templates/

If you get the following response:

Code: Select all

ls: Templates/: No such file or directory)
then create the Templates directory by running the following command:

Code: Select all

mkdir Templates
14. Verify that you created the directory by running the following command
  • ls -l Templates/
You should not receive any error messages.

15. From the wxWidgets-Xcode-Template-master directory copy the wxm directory to:

Code: Select all

~/Library/Developer/Xcode/Templates
Run the following command:

Code: Select all

cp -R wxm ~/Library/Developer/Xcode/Templates
16. Change into the new wxWidgets template directory:

Code: Select all

cd  ~/Library/Developer/Xcode/Templates
17. You should see the wxWidgets Xcode template

Code: Select all

cd  ~/Library/Developer/Xcode/Template
ls
You should see:

Code: Select all

wxm


18. Restart Xcode.

19. Start a new project and scroll all the way to the bottom and you will see the wxWidget template:

wxWidgets and the Xcode template are configured and ready to use.

Configure wxWidgets to work with Xcode.

The following section had screenshots to help follow what and where to make changes. I could not get the images inline to work so hopefully, I can explain good enough for you to follow.

1. Start Xcode, create a new project, (scroll all the way to the bottom) select wxWidget for the template, name your project and save it.

2. You will now see several files that come with the template and are configured to work with the brew installation. The template uses the brew installation of wxWidgets, we are going to change it to use our installation.

Code: Select all

main.cpp
wxmApp.cpp	
wxmView.cpp
wxmApp.hpp	
wxmView.hpp
3. Click on the Project name under Project navigator.

4. Click on the Project name under PROJECT

5. Select your macOS Deployment Target under Deployment Target-macOS Deployment Target to the minimum version the Application supports, ideally, this should match the minimum you targeted in the wxWidgetss build process.

6. Click on the Application Name under TARGETS

7. Select the General tab.

8. Change your Deployment Target under Deployment Info-Deployment Target to your minimum version the Applications supports, this should match the minimum you targeted in the wxWidgetss build process.

9. Click on the Build Settings Tab

10. Click on the Basic sub Tab and Combined sub tab.

11. Go to the Deployment Section

12. Change macOS Deployment Target (or whatever Platform you are coding for) to the minimum supported version(selectable).

13. Click both the All and Combined Tabs under Build Settings

14. Scroll to the Architectures Section

15. Change the Base SDK to macOS (or whatever Platform you are coding for) that you are building the Application on.

16. Click on the Project Name Folder under the Project Navigator

17. With the Project Name Folder selected.

18. Drag all of the wxWidgets dylibs you require to you Project Folder.
you should see something like this:

Code: Select all

Project Name
   Project Folder			
   	libwx_baseu_net-3.1.2.0.0.dylib						
	libwx_baseu_xml-3.1.2.0.0.dylib					
	libwx_osx_cocoau_core-3.1.2.0.0.dylib				
	libwx_osx_cocoau_html-3.1.2.0.0.dylib					
	libwx_osx_cocoau_qa-3.1.2.0.0.dylib	
	libwx_baseu-3.1.2.0.0.dylib		
	libwx_osx_cocoau_xrc-3.1.2.0.0.dylib
	main.cpp
	wxmApp.cpp
	wxmApp.hpp
	wxmView.cpp
	wxmView.hpp
19. Click on your Application name under TARGETS

20. Select the General Tab

21. Scroll down to Linked Frameworks and Libraries, where you should see all of the dylibs you copied into you project.

22. Scroll up to the Embedded Binaries section.

23. Click on the plus

24. Select all of the dylibs you just added to your project and click Add

25. You should have all of the dylibs added to Embedded Binaries section.

26. Click on the Application name under TARGETS, then select the Build settings tab.

27. Scroll to the Linking Section Other Linker Flags

28. Double click the Other Linker Flags section so you will get a popup. You will have to remove these parameters if you are not using brew installation of wxWidgets.(Only remove if you're not using brew’s installation). (you can permanently update this setting in the template so you do not have to add or modify every time you create a new project, which you can skip steps 28 - 39. How to at end of the document).

29. Start removing all of the items in the list until completely empty by selecting the item and clicking the (-)

30. Now take the values returned from wx-config --libs you captured earlier, or just rerun wx-config –-libs again.(2 hyphens before libs). You should have something like the following back from the command:

Code: Select all

-L/Frameworks/wxWidgets/build-cocoa-osx/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_xrc-3.1 -lwx_osx_cocoau_html-3.1 -lwx_osx_cocoau_qa-3.1 -lwx_osx_cocoau_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1
31. Double click Other Linker Flags line, press the + button.

32. Paste the values from above to into the new line.

33. Click outside of the listbox for changes to take effect. Double click again to verify. This should match your wx-config output.

34. Scroll down to the Apple Clang Custom Compiler Flags

35. Edit the Other C++ Flags section and remove any items in the listview, as you did above. Remove all existing parameters.

36. Hit the + and paste in $(OTHER_CFLAGS)

37. Hit the + and paste in the values just as they were displayed by wx-config --cxxflags. Follow the same instructions as above.

38. Click somewhere else on the page so the listbox is closed.

39. Double click the Other C++ Flags and you will see that it is configured properly.

40. Scroll to Linking group with the Runpath Search Paths.

41. Add the following 2 lines to the list view if they do not exist.
  • $(inherited)
    @executable_path/../Frameworks

Xcode is configured to use the version of wxWidgets you installed.

Now we must link wxWidgets dylibs to your Application and tell Application how to find the dylibs. Including the wxWidgets libraries with the Application and renaming them so your Application will run without crashing.

42. Build your Project - at this point, you should be able to build your Application (we need the binary for linking, at least build the Application successfully before continuing). If your Application does not build please resolve until you can build successfully without any errors.

43. Up to this point, your Application has been configured to use wxWidgets, but it needs to know how to find the libraries. I will include a complete list of sites to visit to get a better understanding of linking 3rd party dylibs for reference.

44. You have 2 options when using any 3rd party libraries with your Application. One is to have the user install the necessary libraries, which would put a burden on a normal Mac user. More than likely they would have no clue how to configure path, directories, download libraries, etc. And the second option is to include any libraries that do not exist in the default Apple installation. Best way to verify is to run your App on a non Developer macOS. Without renaming/relinking your Application will crash on a users mac

45. Now comes the fun part, you will need to link the libraries because they were built outside of XCode.

46. You need to determine which library needs to be renamed so the Application can find the libraries. You will need to do this for your binary and every library you added.

47. Select your Application name under the Project navigator.

48. Scroll down to the Products Folder.

49. Right mouse click on your Application name.

50. Click Show in Finder.

51. Click Show Package Contents

52. Double click Contents, you will see a list of names.

53. Frameworks; Holds the libraries you just added to your Application

54. macOS; holds your Application binary.

55. We are going to verify what libraries your Application requires.

56. In terminal type

Code: Select all

otool -L
57. Now, while in the macOS folder drag your Application binary to the terminal where you just added otool -L.

58. You should have something like the following to be executed:

Code: Select all

otool -L /Users/Proj/Projects/wxWidgets/Test-Instructions/DerivedData/Test-Instructions/Build/Products/Debug/Test-Instructions.app/Contents/MacOS/Test-Instructions
59. Hit enter

60. You should get something very similar to the following output from the otool -L:

Code: Select all

/Users/Proj/Projects/wxWidgets/Test-Instructions/DerivedData/Test-Instructions/Build/Products/Debug/Test-Instructions.app/Contents/MacOS/Test-Instructions:

	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/libtiff/lib/libtiff.5.dylib (compatibility version 10.0.0, current version 10.0.0)
	/usr/local/opt/jpeg/lib/libjpeg.9.dylib (compatibility version 13.0.0, current version 13.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_core-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_baseu_net-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 53.0.0, current version 53.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_baseu-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_baseu_xml-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_html-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.4.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_qa-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

61. This tells you where the Application will look for that particular library when your Application is executed. So, as you can see it is very doubtful that your client will have these directories, libs, etc:
  • • /Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib
    • /usr/local
62. Lets look at the wxWidgets dylibs and start with the first one:

Code: Select all

/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0). 
Your Application will look in that directory for the build-cocoa-osx/lib/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib dylib.

63. Lets tell the Application to look in "@executable_path/../Frameworks”, the Framework directory within your application.

64. We need to tell the library to use the Framework directory in the application bundle.

We want to change the location from:
  • /Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib
To: (This is the location within your Application bundle, you also can use any location within the bundle, I stick with Frameworks)
  • @executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib
This is telling you Application to look in Frameworks with its bundle for this dylib.

65. In Xcode under TARGETS, select your Application name.

66. Select Build phases Tab

67. If you do not have a section called “Copy Files then create a New Run Script by hitting + and select New Run Script Phase.

68. You should now have a Copy Files (0 items) Section. I have included the actual commands needed to run in the NEW RUN SCRIPT CODE at the end of this document. The following is the manual steps so you can understand what is taking place, This is where we will tell Xcode how to setup up our libs so they work as planned. There are other ways, like using an external script if you like.

69. If we look back at our otool -L results for the Application binary.

Code: Select all

otool -L /Users/Proj/Projects/wxWidgets/Test-Instructions/DerivedData/Test-Instructions/Build/Products/Debug/Test-Instructions.app/Contents/MacOS/Test-Instructions 

Results:

/Users/Proj/Projects/wxWidgets/Test-Instructions/DerivedData/Test-Instructions/Build/Products/Debug/Test-Instructions.app/Contents/MacOS/Test-Instructions:

	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/libtiff/lib/libtiff.5.dylib (compatibility version 10.0.0, current version 10.0.0)
	/usr/local/opt/jpeg/lib/libjpeg.9.dylib (compatibility version 13.0.0, current version 13.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_core-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_baseu_net-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 53.0.0, current version 53.0.0)
	/Users/ Proj /application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_baseu-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_baseu_xml-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_html-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.4.0)
	/Users/Proj/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_osx_cocoau_qa-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

70. We need to tell your Application how to find the dylibs. So we will run the install_name -change on every wxWidget dylib.

Example format:

install_name_tool -change <WX_LIB_PATH>/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" <TARGET_NAME>

Meanings of variable:
  • <WX_LIB_PATH> – The full path to the wxWidget dylib location where you compiled wxWidgets.
    <TARGET_NAME> - The full path to your application binary
    <FRAMEWORK_PATH> - This is the location within your bundle where your dylibs reside, usual /../Frameworks
    install_name_tool -change /MyDIR/wxWidgets-3.1.2/build-cocoa-osx/lib/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" /Projects/wxWidgets/Test-Instructions/DerivedData/Test-Instructions/Build/Products/Debug/Test-Instructions.app/Contents/MacOS/Test-Instructions
71. Always remember to check your results by running otool -L <TARGET_NAME>. If any are incorrect please fix before proceeding to next stage.

Results after running the install_name_tool on Application Binary and dylibs:

Code: Select all

/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 158.0.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
	/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 492.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
[code]

72. Now that all of the wxWiget dylibs are relinked to the Application Binary, we need to tell each wxWidget dylib where to find each other.

Format:
install_name_tool -change <WX_LIB_PATH>/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FRAMEWORK_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"

Basically, each dylib will be linked to each other.

73. Run install_tool on each dylib.

Example:
[code]
install_name_tool -change <FRAMEWORK_PATH>/libwx_baseu_xml-3.1.2.0.0.dylib "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" <FRAMEWORK_PATH>/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"

install_name_tool -change “${FRAMEWORK_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib” "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" “${FRAMEWORK_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
After running install_name on each wxWidget dylib, verify by running otool -L on each wxWidget dylib:

Code: Select all

@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 158.0.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
	/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 492.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 53.0.0, current version 53.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/local/opt/jpeg/lib/libjpeg.9.dylib (compatibility version 13.0.0, current version 13.0.0)
	/usr/local/opt/libtiff/lib/libtiff.5.dylib (compatibility version 10.0.0, current version 10.0.0)
	/usr/local/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.4.0)
	/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 607.1.40)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 58286.251.4)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1671.40.118)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 50.1.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1570.15.0)
	/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1251.12.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 944.3.0)
	/System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1570.15.0)
	/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
If they all have @executable_path/..yor good to go


74. NEW RUN SCRIPT CODE:
• Here is my run script, modify as needed for your project and paste into the New Run Script section. What is important is that any non Apple libs must be included with the app and relinking so your Application will run and not crash.

Just change the path variables to the locations for your libs.

WX_LIB_PATH – Location of the wxWidgets dylibs
FW_PATH - This is the location of the Frameworks directory in the Application
EX_PATH - This is the location of the Application binary file.
JPEG_LIB – location of the jpeg lib
PNG_LIB – location of the png lib
TIFF_LIB – location of the tiff lib
LZMA_LIB – location of the lzma lib

Code: Select all

WX_LIB_PATH="/Users/App/application_support/wxWidgets-3.1.2/build-cocoa-osx/lib"
FW_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks"
EX_PATH="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
JPEG_LIB="/usr/local/opt/jpeg/lib"
PNG_LIB="/usr/local/opt/libpng/lib"
TIFF_LIB="/usr/local/opt/libtiff/lib"
LZMA_LIB="/usr/local/opt/xz/lib"

install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"

install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"

install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"

install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"

install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"

install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"

install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"

install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libpng16.16.dylib "${FW_PATH}/libpng16.16.dylib"

install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libjpeg.9.dylib "${FW_PATH}/libjpeg.9.dylib"

install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/libtiff.5.dylib "${FW_PATH}/libtiff.5.dylib"

install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${EX_PATH}"
install_name_tool -id @executable_path/../Frameworks/liblzma.5.dylib "${FW_PATH}/liblzma.5.dylib"



install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu-3.1.2.0.0.dylib" "${FW_PATH}/liblzma.5.dylib"




install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_xml-3.1.2.0.0.dylib" "${FW_PATH}/liblzma.5.dylib"




install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_core-3.1.2.0.0.dylib" "${FW_PATH}/liblzma.5.dylib"



install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib" "${FW_PATH}/liblzma.5.dylib"


install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_baseu_net-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_baseu_net-3.1.2.0.0.dylib" "${FW_PATH}/liblzma.5.dylib"


install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_html-3.1.2.0.0.dylib" "${FW_PATH}/liblzma.5.dylib"



install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${WX_LIB_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "@executable_path/../Frameworks/libwx_osx_cocoau_qa-3.1.2.0.0.dylib" "${FW_PATH}/liblzma.5.dylib"


install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
#install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${PNG_LIB}/libpng16.16.dylib" "@executable_path/../Frameworks/libpng16.16.dylib" "${FW_PATH}/liblzma.5.dylib"


install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libpng16.16.dylib"
#install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${JPEG_LIB}/libjpeg.9.dylib" "@executable_path/../Frameworks/libjpeg.9.dylib" "${FW_PATH}/liblzma.5.dylib"



install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libjpeg.9.dylib"
#install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/libtiff.5.dylib"
install_name_tool -change "${TIFF_LIB}/libtiff.5.dylib" "@executable_path/../Frameworks/libtiff.5.dylib" "${FW_PATH}/liblzma.5.dylib"


install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libwx_baseu-3.1.2.0.0.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libwx_baseu_xml-3.1.2.0.0.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libwx_osx_cocoau_core-3.1.2.0.0.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libwx_osx_cocoau_xrc-3.1.2.0.0.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libwx_baseu_net-3.1.2.0.0.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libwx_osx_cocoau_html-3.1.2.0.0.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libwx_osx_cocoau_qa-3.1.2.0.0.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libpng16.16.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libjpeg.9.dylib"
install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/libtiff.5.dylib"
#install_name_tool -change "${LZMA_LIB}/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" "${FW_PATH}/liblzma.5.dylib"
Once this is done you should compile and execute the project. Warning, DO NOT RUN YOUR APP ON THE SAME MACHINE YOU DEVELOP ON! Why you say, is because all of the libs you include are installed on your machine, such as:

/usr/local/opt/libpng/lib/libpng16.16.dylib
Etc..

Run your Application on another machine to test. If it crashes on another machine do the following to get the exact error (more then likely it is a dylib issue missing)
  • a. Right mouse click you app.
    b. Click show package contents
    c. Double click Contents
    d. Double click MacOS
    e. Double click you Application name
You will see a terminal window open up with the exact error, again probably a lib you forgot to relink.

Example:

Code: Select all

Last login: Mon Mar 25 12:56:15 on ttys000
Ro-MBP:~ ro$ /Users/ro/Desktop/Config.app/Contents/MacOS/Config ; exit;
dyld: Library not loaded: /usr/local/opt/xz/lib/liblzma.5.dylib
  Referenced from: /Users/ro/Desktop/Config.app/Contents/MacOS/Config
  Reason: Incompatible library version: Config requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0
Abort trap: 6
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
In this case, the liblzma.5.dylib was not linked properly

Completed setting up Xcode, wxWidgets.


How to change the Xcode template icon for wxWidgets
  • 1. Grab one of the wxWidget icons, bigger is better.
    2. Resize one of the to width: .67 .height: 47 scale proportionally.
    3. Save the image as TemplateIcon.png
    4. Resize the original image to width: 1.33 Height: 0.93 scale proportionally.
    5. Save the image as [email protected]
    6. Now copy both image to:
    /Users/<YOUR_HOME_DIR>/Library/Developer/Xcode/Templates/wxm/ wxWidgets.xctemplate/
    7. Overwrite existing images
    8. Restart Xcode, you should see the following when creating a new project and selecting wxWidgets:


How to change the Xcode template flags for wxWidgets
  • Edit the TemplateInfo.plist file in your favorite editor, maybe vi?

    1. Find the <key>

    <key>OTHER_CPLUSPLUSFLAGS</key>

    2. Replace the <string> under <key>OTHER_CPLUSPLUSFLAGS</key>, with the results from wx-config –cxxflags

    3. Find the <key>

    <key>OTHER_CPLUSPLUSFLAGS</key>

    4. Replace the <string> under <key>OTHER_CPLUSPLUSFLAGS</key>, with the results from wx-config –libs

    Now you do not have to add that every time you make a new project

    There is much more you can do, I just covered the basics.
Reference Material

https://blogs.oracle.com/dipol/dynamic- ... and-mac-os

https://medium.com/@donblas/fun-with-rp ... e41ae86172

http://thecourtsofchaos.com/2013/09/16/ ... es-on-osx/

https://geekjutsu.wordpress.com/2015/10 ... on-bundle/

https://software.intel.com/en-us/forums ... pic/623794

https://www.mikeash.com/pyblog/friday-q ... names.html

https://www.mikeash.com/pyblog/friday-q ... names.html

If I could have added the screen captures it would be easier to follow.

Any constructive feedback or suggestions always welcome.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4357
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Configure wxWidgets to use Xcode on a macOS

Post by ONEEYEMAN » Wed May 01, 2019 2:24 pm

Hi,
No need to download anything - wxWidgets provides Xcode project ready to use in the samples/minimal directory.
Also when you configure the library keep in mind that as long as you don't run latest OSX simple:

Code: Select all

../configure --enable-debug
will suffice.

Thank you.

Post Reply