SaschaWillems / glCapsViewer

C++ port of the OpenGL hardware capability viewer
GNU Lesser General Public License v3.0
103 stars 28 forks source link

build fails on fedora 22 #7

Open sheepdestroyer opened 9 years ago

sheepdestroyer commented 9 years ago
[sheepdestroyer@sheepora Build] $ cmake ..
-- Boost version: 1.57.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sheepdestroyer/Downloads/temps/glCapsViewer-master/Build
[sheepdestroyer@sheepora Build] $ make -j 4
Scanning dependencies of target glcapsviewer_automoc
[  7%] Automatic moc for target glcapsviewer
Generating moc_glCapsViewer.cpp
Generating moc_glCapsViewerHttp.cpp
Generating moc_settingsDialog.cpp
[  7%] Built target glcapsviewer_automoc
[ 14%] Generating qrc_glCapsViewer.cpp
Scanning dependencies of target glcapsviewer
[ 21%] Building CXX object CMakeFiles/glcapsviewer.dir/settingsDialog.cpp.o
[ 28%] Building CXX object CMakeFiles/glcapsviewer.dir/glCapsViewerHttp.cpp.o
[ 35%] Building CXX object CMakeFiles/glcapsviewer.dir/glCapsViewer.cpp.o
[ 42%] Building CXX object CMakeFiles/glcapsviewer.dir/settings.cpp.o
[ 50%] Building CXX object CMakeFiles/glcapsviewer.dir/capsGroup.cpp.o
[ 57%] Building CXX object CMakeFiles/glcapsviewer.dir/main.cpp.o
[ 64%] Building CXX object CMakeFiles/glcapsviewer.dir/glCapsViewerCore.cpp.o
[ 71%] Building CXX object CMakeFiles/glcapsviewer.dir/internalFormatInfo.cpp.o
[ 78%] Building CXX object CMakeFiles/glcapsviewer.dir/internalFormatTarget.cpp.o
[ 85%] Building CXX object CMakeFiles/glcapsviewer.dir/qrc_glCapsViewer.cpp.o
[ 92%] Building CXX object CMakeFiles/glcapsviewer.dir/glcapsviewer_automoc.cpp.o
[100%] Linking CXX executable glcapsviewer
/usr/bin/ld: CMakeFiles/glcapsviewer.dir/glCapsViewerCore.cpp.o: undefined reference to symbol 'XDefaultScreen'
/usr/lib64/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/glcapsviewer.dir/build.make:379: recipe for target 'glcapsviewer' failed
make[2]: *** [glcapsviewer] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/glcapsviewer.dir/all' failed
make[1]: *** [CMakeFiles/glcapsviewer.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
[sheepdestroyer@sheepora Build] $ 
SaschaWillems commented 9 years ago

Thanks for reporting this issue, I'll take a look at it.

fredericomba commented 9 years ago

I know how to fix this issue, since this affects me too (I'm also a Fedora user). I think even the main Fedora distribution (the Workstation, as opposed to the spins) still uses the X libraries for graphics.

On the "CMakeLists.txt" file, add the following lines:

X11

find_package(X11 REQUIRED) target_link_libraries(${NAME} ${X11_LIBRARIES})

If you don't want to bother rewriting CMakeLists.txt, you can grab the fixed "CMakeLists.txt" file on the following pastebin: http://pastebin.com/raw.php?i=XbgSak3Q

However, this file will only work on Linux (that uses X for displaying graphics). Placing it on the main tree would break the code on other OSes.

Also, after compilation, the program will still not work. The reason for that is because the "enumlist.xml" file isn't copied to the folder where the program was build with CMake, so you'll need to manually copy that file to the output folder. This could be added to CMakeLists.txt, but I did not bother.

I have seen this bug months ago. However, I'm shy, and therefore I didn't fill a proper bug report (followed by the fix).

SaschaWillems commented 8 years ago

Hi frederico,

sorry for my later answer, and thanks for this detailed comment on how to fix this for issue. I'm currently pretty busy with other stuff, so I don't know when I'll get around incorporating this, but just wanted to let you know that it's still on my radar.

And thanks for submitting the mesa reports :+1:

justinclift commented 6 years ago

@frederico-miranda As a data point, it's possible to put platform specific bits into a CMakeLists.txt.

For stuff that's just for Linux/BSD/similar, something like this would probably work:

if(UNIX AND NOT APPLE)
    #X11
    find_package(X11 REQUIRED)
    target_link_libraries(${NAME} ${X11_LIBRARIES})
endif(UNIX AND NOT APPLE)

Note that the indentation there is tabs and not spaces. I don't remember off hand if that's important or not, as I don't personally touch CMake bits very often. I just happened to remember this thing about platform specific stuff. :smile: