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

Allow building against system libraries #178

Closed
rekado opened this issue May 25, 2015 · 8 comments
Closed

Allow building against system libraries #178

rekado opened this issue May 25, 2015 · 8 comments
Milestone

Comments

@rekado
Copy link

rekado commented May 25, 2015

Right now powertabeditor can only be built after fetching the code in ./external. It would be good if the build system was flexible enough to allow building against these libraries even if they are not located in ./external but have been installed elsewhere in the system.

(I'm currently packaging powertabeditor for GNU Guix and we like to avoid bundling libraries whenever possible.)

@cameronwhite
Copy link
Member

Yes, this would be a good improvement.
Which of those third party libraries are available as packages for your system?

@rekado
Copy link
Author

rekado commented May 26, 2015

I'm almost done packaging all five. It appears to be sufficient to remove the "external" directory altogether and remove any references to it in the main CMake list.

@cameronwhite
Copy link
Member

Yeah, removing references to the external directory would work as long as the headers and libraries can be found.
It would probably be good to also have an option to skip building the test suite, since it isn't necessary for packaging.

@rekado
Copy link
Author

rekado commented May 27, 2015

It would probably be good to also have an option to skip building the test suite, since it isn't necessary for packaging.

I agree that it would be good to have a separate target for running the tests (something like "make check" but for CMake, which I'm not familiar with).

When packaging the external libraries I noticed that pugixml has no default installation target. Is it used as a static/shared library or are the sources embedded directly? If the latter: could it rather be linked against instead of "baking" the sources into the final object?

@cameronwhite
Copy link
Member

@rekado
Copy link
Author

rekado commented May 30, 2015

Okay, pugixml builds fine now. I'm having trouble with withershins --- it builds fine on its own, but when linked with powertabeditor I get linker errors:

/gnu/store/m9x4kpcn384261hlza0n4bf667a153xk-gcc-4.8.4/bin/c++    -std=c++11 -Wall -Wnon-virtual-dtor -Wextra -Wno-deprecated -O2 -g -DNDEBUG   CMakeFiles/powertabeditor.dir/build/main.cpp.o CMakeFiles/powertabeditor.dir/qrc_resources.cpp.o CMakeFiles/powertabeditor.dir/powertabeditor_automoc.cpp.o  -o ../bin/powertabeditor -rdynamic /gnu/store/662h1fckdb3vk6jb0478k7ih2kpakia9-qt-5.4.1/lib/libQt5Network.so.5.4.1 app/libpteapp.a dialogs/libptedialogs.a widgets/libptewidgets.a audio/libpteaudio.a -lrtmidi painters/libptepainters.a formats/libpteformats.a actions/libpteactions.a score/libptescore.a -lpugixml -lwithershins -lboost_date_time -lboost_iostreams -lboost_program_options -lboost_regex -lz -lasound -lpthread /gnu/store/662h1fckdb3vk6jb0478k7ih2kpakia9-qt-5.4.1/lib/libQt5Concurrent.so.5.4.1 /gnu/store/662h1fckdb3vk6jb0478k7ih2kpakia9-qt-5.4.1/lib/libQt5PrintSupport.so.5.4.1 /gnu/store/662h1fckdb3vk6jb0478k7ih2kpakia9-qt-5.4.1/lib/libQt5Widgets.so.5.4.1 /gnu/store/662h1fckdb3vk6jb0478k7ih2kpakia9-qt-5.4.1/lib/libQt5Gui.so.5.4.1 /gnu/store/662h1fckdb3vk6jb0478k7ih2kpakia9-qt-5.4.1/lib/libQt5Core.so.5.4.1 
/gnu/store/9c8qdmp96v3mcg9ny26a3zcqrl1rkl26-withershins-0.1/lib/libwithershins.a(withershins_unix.cpp.o): In function `withershins::trace(int)':
(.text+0x2ec): undefined reference to `bfd_init'
/gnu/store/9c8qdmp96v3mcg9ny26a3zcqrl1rkl26-withershins-0.1/lib/libwithershins.a(withershins_unix.cpp.o): In function `withershins::trace(int)':
(.text+0x328): undefined reference to `bfd_openr'
/gnu/store/9c8qdmp96v3mcg9ny26a3zcqrl1rkl26-withershins-0.1/lib/libwithershins.a(withershins_unix.cpp.o): In function `withershins::trace(int)':
(.text+0x349): undefined reference to `bfd_check_format'
/gnu/store/9c8qdmp96v3mcg9ny26a3zcqrl1rkl26-withershins-0.1/lib/libwithershins.a(withershins_unix.cpp.o): In function `withershins::trace(int)':
(.text+0x4bc): undefined reference to `bfd_close'
/gnu/store/9c8qdmp96v3mcg9ny26a3zcqrl1rkl26-withershins-0.1/lib/libwithershins.a(withershins_unix.cpp.o): In function `withershins::trace(int)':
(.text+0x9c1): undefined reference to `bfd_close'
/gnu/store/9c8qdmp96v3mcg9ny26a3zcqrl1rkl26-withershins-0.1/lib/libwithershins.a(withershins_unix.cpp.o): In function `throw_bfd_error(std::string)':
(.text.unlikely+0x17): undefined reference to `bfd_get_error'
/gnu/store/9c8qdmp96v3mcg9ny26a3zcqrl1rkl26-withershins-0.1/lib/libwithershins.a(withershins_unix.cpp.o): In function `throw_bfd_error(std::string)':
(.text.unlikely+0x93): undefined reference to `bfd_errmsg'
collect2: error: ld returned 1 exit status
source/CMakeFiles/powertabeditor.dir/build.make:223: recipe for target 'bin/powertabeditor' failed

I suppose this means that powertabeditor must also be linked against libbdf?

@cameronwhite
Copy link
Member

Yeah - that happens implicitly in the current build. If one of the arguments to target_link_libraries is the name of a target generated by add_library, then the executable also links against that library's dependencies.

@rekado
Copy link
Author

rekado commented Jun 1, 2015

Thank you, I actually got it to build on the Guix System Distribution.

@cameronwhite cameronwhite added this to the Alpha 10 milestone Nov 28, 2015
cameronwhite added a commit that referenced this issue Nov 28, 2015
Since the Ubuntu package doesn't ship with a CMake find module, one is
included here.

Bug: #201
Bug: #178
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants