0

I'm new in C language programing, and i'm working in an Mac OS enverimont!

I'm testing a code, that takes the current hostname from machine and send it to an MySql database. In my computer it works!

I tried to execute the complied program at another computer, and i got the error: Library not loaded '/usr/local/opt/mysql/lib/libmysqlclient.21.dylib' (no such file)...

I belive that if i install the mysql at this computer (brew install mysql) should solve the problem, but i would like to know if is it possible to export dylib with the compiled program, is it possible? What is the best pratices when the program work with dylibs that are not default in an OS?

Thank you!

I would like to undestant how hadle dylibs!

3
  • your code??? wpints to a directory doesnt exist on the computer, so you must link to a library that ypu deploy Commented Jun 21, 2023 at 20:50
  • That looks like a Homebrew dependency, so unless the other machine has that package installed, you're likely stuck. To make a more self-contained build, see if you can link in a .a or "static" library instead. This way the dependency is removed. Commented Jun 21, 2023 at 21:01
  • Another thing to consider is making your C program a custom Homebrew package. Commented Jun 21, 2023 at 21:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.