crossbuild icon indicating copy to clipboard operation
crossbuild copied to clipboard

How to install project specific libraries for multiple platforms required for compiling?

Open stohn opened this issue 9 years ago • 6 comments

First let me say GREAT! Exactly what I need for my project (I have to supply binaries for "normal" users for Linux/OSX/Windows). I also plan to use this as a CI build env.

Now my question: I need some libraries in order to compile my project (e.g. libusb, ncurses). Usually I use packet manager on the real platforms to install them (apt-get for Linux, brew for OSX and pacman for MSYS2-MinGW/Windows).

Do you have an idea / suggestion how to install (automated or manually) the different platform specific libraries?

Thanks,

Maik

stohn avatar Apr 11 '16 12:04 stohn

Hi @stohn, interesting questions!


First ideas:

  • by mounting the local /usr/lib in the container using docker -v; Overriding the container's /usr/lib is a bad idea, so maybe we can mount it elsewhere and configure ldd to look at this path. I like this idea, it's very easy to automate, but it will probably only works for Linux

  • by inheriting the Docker image and apt-get install the missing libraries

    FROM multiarch/crossbuild
    RUN apt-get install toto-dev
    

Is your project open-source ? I would love to try to fix this issue against a real library-based project in Linux, OSX and Windows

moul avatar Apr 11 '16 15:04 moul

Yes project is open source. I had to change my github account recently and now having 2 both connected to other projects. So sometimes using old one by accident.

The project is here: http://github.com/MaikStohn/UP3D

It's just at the begin so any change can be made easily.

stohn avatar Apr 11 '16 15:04 stohn

Ok perfect, can you give me instructions to get/install libraries for each architectures ? Do not worry about the Docker part, just instructions/url for one of the projects of your repo; Thanks!

moul avatar Apr 11 '16 16:04 moul

The relevant parts of the project for now are: "UP3DTRANSCODE" (no dependencies) and "UP3DTOOLS" (requires libusb / ncurses)

Inside of each directory is a small "make.sh" which already handles all platform specific stuff.

-> All resulting apps are console based apps.

For library installation a made a small note in the appropriate "make.sh" in the directories. Here my full notes for compilation on each platform:

Linux (debian/ubuntu):

 apt-get install gcc
 apt-get install libusb-1.0.0-dev
 apt-get install libncurses5-dev
  • compile using the appropriate "make.sh"

OSX:

  • install homebrew ( http://brew.sh )
  • use "brew" to install the required libraries:
 brew install pkg-config
 brew install libusb
 brew install homebrew/dupes/ncurses
  • compile using the appropriate "make.sh"

Windows:

  • install msys2 (which also brings mingw + pacman package manager)
  • open msys2 shell and use pacman to install
 pacman -S mingw32/mingw-w64-i686-gcc
 pacman -S mingw32/mingw-w64-i686-libusb
 pacman -S mingw32/mingw-w64-i686-ncurses
  • then close msys2 shell and open mingw32 shell to compile using the "make.sh"

EDIT: corrected / add more details to package manager instructions

stohn avatar Apr 11 '16 17:04 stohn

I guess I need exactly this functionality for, in my case, zlib. Are there instructions for this now since it is labeled ready?

pkriens avatar Sep 26 '17 17:09 pkriens

Any progress on this?

nioncode avatar Jul 01 '19 14:07 nioncode