Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding pkg-config .pc files for included versions #2387

Open
trevorlinton opened this issue May 28, 2014 · 13 comments

Comments

@trevorlinton
Copy link

commented May 28, 2014

I manually need to recreate these for each upgrade of emscripten, it would be helpful to have them included by default. It helps (VASTLY HELPS) configure scripts to complete without errors and configure accurately.

  1. Create a default system/lib/pkgconfig
  2. Include glesv2.pc, egl.pc, libpng.pc, zlib.pc, sdl.pc
    (and any other included libraries with emscripten's build).

This would be a huge improvement and very low effort.

@kripken

This comment has been minimized.

Copy link
Member

commented May 28, 2014

I actually don't know enough about pkg-config to follow this. But I would be ok with including files in emscripten that are useful for various build systems, like we have for cmake and scons, so long as we have a test in place to keep them from breaking.

@trevorlinton

This comment has been minimized.

Copy link
Author

commented May 28, 2014

They're mostly dummy stubs, without them autoconf and configure will attempt (on for example cairo's build) to try and individual detect -llibpng, -lSDL, -lzlib, etc and fail.

Here's the stubs I have, if you add these files to system/lib/pkgconfig directory pkg-config behaves properly without any intervention from the user, as you can see from the stubs it doesn't add anything to the compile, but gives configure/autoconf confidence that they exist and will just compile when needed.

You can test this on cairo-1.12, if you download it and run emconfigure ./configure it will fail not finding the required (built in) libraries such as libpng, zlib, sdl, etc. If you have these .pc files in the system/lib/pkgconfig within your emscripten root the configure finishes fine (and more importantly cairo builds correctly and runs correctly).

You can test if the files have been included with emconfigure pkg-config --list-all you should see a list of all the built-in packages for emscripten. There may be other stubs that could be added, but these are all the stubs I need.

One thing, <emscripten path??> needs to be replaced with the installed path of emscripten's system root. I'm not sure how to automatically do this but could be part of the installation ?..

=== BEGIN glesv2.pc
prefix=<emscripten path??>
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include

Name: glesv2
Description: OpenGL ES 2.0 library
Version: 2.1.45

Requires:
Libs: -L${libdir} -L${sharedlibdir}
Cflags: -I${includedir}
==== END

==== BEGIN libpng.pc
prefix=<emscripten path??>
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include

Name: libpng
Description: png library
Version: 1.2.45

Requires:
Libs: -L${libdir} -L${sharedlibdir}
Cflags: -I${includedir}
==== END

==== BEGIN egl.pc
prefix=<emscripten path??>
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include

Name: egl
Description: EGL library
Version: 1.0.0

Requires:
Libs: -L${libdir} -L${sharedlibdir}
Cflags: -I${includedir}
==== END

==== BEGIN zlib.pc
prefix=<emscripten path??>
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include

Name: zlib
Description: zlib compression library
Version: 1.2.5

Requires:
Libs: -L${libdir} -L${sharedlibdir}
Cflags: -I${includedir}
==== END

==== BEGIN sdl.pc
prefix=<emscripten path??>
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include

Name: sdl
Description: Simple DirectMedia Layer
Version: 1.2.12

Requires:
Libs: -L${libdir} -L${sharedlibdir}
Cflags: -I${includedir}
==== END

@trevorlinton

This comment has been minimized.

Copy link
Author

commented May 28, 2014

E.g., the prefix= in all of the .pc files needs to be set to the path of emscripten/version/system

@trevorlinton

This comment has been minimized.

Copy link
Author

commented May 28, 2014

Actually I just tested this and the prefix can be set to something completely ridiculous such as /usr/blah/blah, the included directory would be /usr/blah/blah/lib and not affect the build at all, but allow you to get past the configure checks quickly.

pkg-config is very helpful for libraries and if emscripten ever plans to support shared libraries it will be very helpful in managing dependencies and installing user-compiled libraries. Hypothetically installed .BC files could be used as "shared libraries" then pulled in for the final build with everything managed through pkg-config and existing package management tools.

@kripken

This comment has been minimized.

Copy link
Member

commented May 29, 2014

Sounds good to me. Again, I don't understand autotools at all. But a pull request with this stuff + tests would be welcome.

@sronsse

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2014

trevorlinton: do you plan to work on this? I just ran into similar issues with my autotools project with PKG_CHECK_MODULES failing on SDL for emscripten builds. It would definitely be helpful for all projects relying on pkg-config.

@trevorlinton

This comment has been minimized.

Copy link
Author

commented Jul 2, 2014

@sronsee, i'm not - if you'd like to take a swing at it i'm sure the community would appreciate it!

@sronsse

This comment has been minimized.

Copy link
Contributor

commented Jul 5, 2014

@trevorlinton, @kripken : now working on this.

@sronsse

This comment has been minimized.

Copy link
Contributor

commented Jul 5, 2014

@jplatte

This comment has been minimized.

Copy link
Contributor

commented Feb 7, 2015

Hi, and thanks for the nice work! I wanted to create a new issue about gl.pc and FindSDL.cmake missing, but I guess at least the former belongs here.

Emscripten provides FindOpenGl.cmake, so it should also provide gl.pc, right? The same goes for SDL, just the other way arround.

I am not very familiar with CMake, but I guess creating gl.pc should be pretty straight-forward (though I don't know how to find out the correct version).

@Beuc

This comment has been minimized.

Copy link
Contributor

commented May 23, 2018

I confirm it would be nice to have when your project's configure.ac uses PKG_CHECK_MODULES :)
There's a small challenge in making the .pc files available conditionally depending on -s USE_SDL=2 -s USE_SDL_IMAGE=2 etc.

@stale

This comment has been minimized.

Copy link

commented Sep 19, 2019

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Sep 19, 2019
@Beuc

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2019

I believe this can be merged with #8650

@stale stale bot removed the wontfix label Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.