20 Replies
      Latest reply on Oct 11, 2015 10:06 AM by jordibartolome
      satibasti Level 1 Level 1 (0 points)

        Hi,

         

        First off all, sorry for my English.

         

        I've updraded Yosemite to El Capitan and installed XCode 7.0. My app uses MySQL and it ran ok on Yosemite. Now, when I start it, XCode gives me this error:

         

         

        dyld: Library not loaded: libmysqlclient.18.dylib

          Referenced from: /Users/jose/Library/Developer/Xcode/DerivedData/SaDPeMAC-dvophlqioihoungqcdkihvpzskee/Build/Products/Debug/SaDPeMAC.app/Contents/MacOS/SaDPeMAC

          Reason: image not found

         

        Don't know what to do. Could anyone help me?

        • Re: osx 10.11 El Capitan and MySQL
          KaneHau Level 2 Level 2 (25 points)

          Backup any data you have and reinstall mySQL.

            • Re: osx 10.11 El Capitan and MySQL
              satibasti Level 1 Level 1 (0 points)

              I have just done it. I erased a disk, and I reinstall everything from scratch. I still have the same error. Any ideas?

                • Re: osx 10.11 El Capitan and MySQL
                  Max108 Level 8 Level 8 (5,800 points)

                  Depending on how MySQL was installed, the library might not be loading because it couldn't be found. Type the following into Terminal to create a symbolic link (It's all one line, not two):

                   

                  ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

                    • Re: osx 10.11 El Capitan and MySQL
                      satibasti Level 1 Level 1 (0 points)

                      When typing that, I get "Operation not permitted".

                       

                      I guess it has to do with improved OS security in OSX 10.10 (rootless).

                       

                      When using YOSEMITE it worked doing...

                       

                      1. sudo ln /usr/local/mysql-5.6.25-osx10.8-x86_64/bin/mysql /usr/bin/mysql)

                      2. export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

                      3. sudo ln /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

                       

                      but commands 1 y 3 are not permitted in OSX 10.10 and command 2 doesn't seem to work

                       

                      I feel that the solution is quite simple, but I am lost.

                        • Re: osx 10.11 El Capitan and MySQL
                          Max108 Level 8 Level 8 (5,800 points)

                          You're right, it's because SIP/rootless prevents access to usr/lib/

                           

                          You can temporarily disable SIP by holding cmd+r at bootup to get to Recovery HD. Then Utilities > Security Configuration menu. Uncheck "Enforce System Integrity Protection" and click "Apply Configuration".

                           

                          Once SIP is disabled, you should just reinstall MySQL.

                           

                          When you've got it working you can re-enable SIP.

                            • Re: osx 10.11 El Capitan and MySQL
                              satibasti Level 1 Level 1 (0 points)

                              Thank you Max!!!

                               

                              I found this solution yesterday googling around but I learnt that it would not be available in the final release . Do you have any othe ideas?

                               

                              Thank you again.

                                • Re: osx 10.11 El Capitan and MySQL
                                  Max108 Level 8 Level 8 (5,800 points)

                                  What's the result of running:

                                  locate libmysqlclient.18.dylib

                                  • Re: osx 10.11 El Capitan and MySQL
                                    Max108 Level 8 Level 8 (5,800 points)

                                    Where did you read that the ability to temporarily disable SIP will be absent from the final release?

                                      • Re: osx 10.11 El Capitan and MySQL
                                        satibasti Level 1 Level 1 (0 points)

                                        Give me a minute and I'll try to find it again

                                          • Re: osx 10.11 El Capitan and MySQL
                                            satibasti Level 1 Level 1 (0 points)

                                            Can't find it now, but I saw it yesterday. It was written as a reply from someone in Apple. I'll keep looking for it.

                                              • Re: osx 10.11 El Capitan and MySQL
                                                Max108 Level 8 Level 8 (5,800 points)

                                                The following is from StackOverflow:

                                                 

                                                At build time the static linker on OS X, ld, writes the shared library identifier of each library that your application links against in to the application binary. At run time the dynamic linker, dyld, attempts to load each shared library from the paths specified in the application binary. You can see this information using otool -L YourApp.app/Contents/MacOS/YourApp.

                                                 

                                                The fact you needed to symlink libmysqlclient.18.dylib in to /usr/lib suggests that the shared library identifier of libmysqlclient.18.dylib is something like /usr/lib/libmysqlclient.18.dylib. To include the library in your .app bundle in a way that your application will use it rather than looking in /usr/lib you need to:

                                                 

                                                1. Change the shared library identifier of libmysqlclient.18.dylib so that dyld will look for the binary relative to your application binary. This is typically done by running install_name_tool -id @executable_path/../Frameworks/libmysqlclient.18.dylib libmysqlclient.18.dylib.
                                                2. Copy the modified libmysqlclient.18.dylib in to the Frameworks subdirectroy in your application bundle. This is typically done using a Copy Files build phase in your Xcode project.


                                                You should then be able to verify that the install name written in to your application binary is @executable_path/../Frameworks/libmysqlclient.18.dylib rather than /usr/lib/libmysqlclient.18.dylib (using otool -L YourApp.app/Contents/MacOS/YourApp again). If the install name isn't correct then you'll need to ensure that your linker search path is set up to find your modified version of libmysqlclient.18.dylib ahead of any other versions you may have.

                                                • Re: osx 10.11 El Capitan and MySQL
                                                  satibasti Level 1 Level 1 (0 points)

                                                  Found it

                                                   

                                                  If you google "notes from thursday security lab" you'll get to an apple developer forum that says...

                                                   

                                                  Question:

                                                   

                                                  There is a nvram boot-args command available in Developer Beta 1 which can disable SIP when run with root privileges:

                                                   

                                                  1. nvram boot-args="rootless=0"

                                                   

                                                  Will this option of disabling SIP also be available in the El Capitan release version? Or is this strictly for the Developer Builds?

                                                   

                                                  Answer:

                                                   

                                                  This nvram boot-args command will be going away. It will not be available in the El Capitan release version and may disappear before the end of the Developer Betas. Keep an eye on the release notes for future Developer Betas.

                                                    • Re: osx 10.11 El Capitan and MySQL
                                                      Max108 Level 8 Level 8 (5,800 points)

                                                      Thank you for finding that for me. I can understand the terminal command going away because it disables SIP with more collateral effect than doing so through booting into Recovery to disable it. My guess is that the new Security Configuration menu in Recovery will continue to be supported because it was created for this very purpose.

                                                      • Re: osx 10.11 El Capitan and MySQL
                                                        satibasti Level 1 Level 1 (0 points)

                                                        Mmmmmmm.... I am doing something wrong. Look.... I've checked the spelling and it is ok.

                                                         

                                                         

                                                        MacBook-Pro-de-Jose:~ jose$ otool -L SaDPeMAC.APP/Contents/MacOS/SaDPeMAC

                                                        error: /Library/Developer/CommandLineTools/usr/bin/otool: can't open file: SaDPeMAC.APP/Contents/MacOS/SaDPeMAC (No such file or directory)

                                                         

                                                        I can see the file there!!!

                                                          • Re: osx 10.11 El Capitan and MySQL
                                                            satibasti Level 1 Level 1 (0 points)

                                                            Sorry, this is what I get...

                                                             

                                                            MacBook-Pro-de-Jose:~ jose$ otool -L /usr/Aplicaciones/SaDPeMAC.app/Contents/MacOS/SaDPeMAC

                                                            error: /Library/Developer/CommandLineTools/usr/bin/otool: can't open file: /usr/Aplicaciones/SaDPeMAC.app/Contents/MacOS/SaDPeMAC (No such file or directory)

                                                              • Re: osx 10.11 El Capitan and MySQL
                                                                Max108 Level 8 Level 8 (5,800 points)

                                                                experiment with:

                                                                 

                                                                cd //usr/Aplicaciones/SaDPeMAC.app/Contents/MacOS/

                                                                 

                                                                or whatever, until you find the correct path (you won't get an error when you have it)

                                                                 

                                                                The following are complete guesses; You have to figure this bit out yourself really:

                                                                cd //usar/Aplicaciones/SaDPeMAC.app/Contents/MacOS/

                                                                or

                                                                cd //Applications/SaDPeMAC.app/Contents/MacOS/

                                        • Re: osx 10.11 El Capitan and MySQL
                                          berewo Level 1 Level 1 (0 points)

                                          You can symlink to `/usr/local/lib` instead.

                                           

                                          `sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib`