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

Installation Folder & rpath urls #103

Merged
merged 21 commits into from
Jan 25, 2018
Merged

Conversation

gabyx
Copy link
Contributor

@gabyx gabyx commented Jan 21, 2018

the same as in #101 ,

@gabyx gabyx mentioned this pull request Jan 21, 2018
6 tasks
@gabyx
Copy link
Contributor Author

gabyx commented Jan 21, 2018

bildschirmfoto 2018-01-21 um 22 29 16

This is now pretty fine -> executable work in build bin folder (on macos)
After installation the binary no longer work, because the rpaths have not been adapted. Cmake should actually do something when installing (see https://cmake.org/Wiki/CMake_RPATH_handling)

the output of otool -l /usr/local/opt/rttr/bin/bench_variant | grep LC_RPATH -A2

          cmd LC_RPATH
      cmdsize 40
         path /usr/local/opt/llvm/lib (offset 12)

where as the binary in the build folder works and has

         cmd LC_RPATH
      cmdsize 40
         path /usr/local/opt/llvm/lib (offset 12)
--
          cmd LC_RPATH
      cmdsize 56
         path /Users/gabrielnuetzi/Desktop/rttrBuild/lib (offset 12)

this is the reason it work in the build folder, I dont understand why cmake has not correctly adapted the RPATH after installing, there is a misconfiguration I think...

@@ -165,7 +165,7 @@ function(loadFolder FOLDER _HEADER_FILES _SOURCE_FILES)
getNameOfDir(CMAKE_CURRENT_SOURCE_DIR DIRNAME)
if (${shouldInstall})
if (NOT ${FULL_HEADER_PATH} MATCHES ".*_p.h$") # we don't want to install header files which are marked as private
install(FILES ${FULL_HEADER_PATH} DESTINATION "include/${DIRNAME}/${REL_PATH}" PERMISSIONS OWNER_READ)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this removed? I want that the installed header files should not be modified by accident.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong merge, I will correct that

@gabyx
Copy link
Contributor Author

gabyx commented Jan 21, 2018

thanks, its a mistake!

@coveralls
Copy link

coveralls commented Jan 22, 2018

Coverage Status

Coverage remained the same at 90.131% when pulling 764c0c7 on gabyx:fix-cmake-rpath-macos into 4a0272e on rttrorg:master.

CMakeLists.txt Outdated
@@ -31,7 +31,7 @@
# the build configuration options are initialized. #
####################################################################################

cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.10)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.10 version is too strict, IMO 3.0 is enough, unless you use something specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!
ok, cmake version 3.0 is fine for me, I rather work with the newest, since there is better behavior :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and it is not a problem for the user to have higher version

@Warchant
Copy link

Warchant commented Jan 22, 2018

$ mkdir build
$ cd build
$ cmake .. 
$ make

fails with

[ 99%] Linking CXX executable ../../bin/unit_tests
[ 99%] Built target unit_tests
Scanning dependencies of target run_tests
[100%] Running unit_tests
../../bin/unit_tests: error while loading shared libraries: librttr_core.so.0.9.6: cannot open shared object file: No such file or directory
src/unit_tests/CMakeFiles/run_tests.dir/build.make:57: recipe for target 'src/unit_tests/CMakeFiles/run_tests' failed
make[2]: *** [src/unit_tests/CMakeFiles/run_tests] Error 127
CMakeFiles/Makefile2:206: recipe for target 'src/unit_tests/CMakeFiles/run_tests.dir/all' failed
make[1]: *** [src/unit_tests/CMakeFiles/run_tests.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Linux Ubuntu 16.04

@gabyx
Copy link
Contributor Author

gabyx commented Jan 22, 2018

@Warchant : Could you extract some information in the unit_test binaries (I could not build them catch is too old for gcc 7 or clang 7).

I mean what is the RPATH the unit tests executable is searching for the library,

https://cmake.org/Wiki/CMake_RPATH_handling
objdump -x executable | grep RPATH

I think we miss some configuration for INSTALL_RPATH here:

set_target_properties(unit_tests PROPERTIES DEBUG_POSTFIX _d)

but that line I added to the other exes, is for installation only, I think I have to check on my linux machine

INSTALL_RPATH "${RTTR_EXECUTABLE_INSTALL_RPATH}"

@gabyx
Copy link
Contributor Author

gabyx commented Jan 22, 2018

Building with gcc4.9 (macOs).... lets see whats the problem

@gabyx
Copy link
Contributor Author

gabyx commented Jan 22, 2018

ok found the error, I think I mistakenly misscorrected the beahvior for rpath...

@gabyx
Copy link
Contributor Author

gabyx commented Jan 22, 2018

lets look on the tests, the unit tests build with gcc4.9 on mac, libraries are loaded, but no executable does run (unit_tests and benchmarks),
: weird error:

bench_variant(24239,0x7fff74ebc000) malloc: *** error for object 0x106ecbea0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
clock resolution: Abort trap: 6

@acki-m: Any idea? Supposed wrong linking, ...?
with clang7.0 and all warnings off I builded everythin except the unit_tests since catch is too old?
are you improving on this? meaning, installing a newer version!? that would be great!
So we can make some progress with some really more modern compilers instead of the ones supported, I think they are way behind...

@gabyx
Copy link
Contributor Author

gabyx commented Jan 23, 2018

seems to compile now, apple travis is missing, they have problems I think...

@gabyx
Copy link
Contributor Author

gabyx commented Jan 23, 2018

OK: only https://travis-ci.org/rttrorg/rttr/jobs/332456069 still fails due to some installation problems , probably re-run it again....

@acki-m
Copy link
Contributor

acki-m commented Jan 24, 2018

What are you fixing here? What is the problem on MacOSX?

@gabyx gabyx changed the title Fix cmake rpath on macos Fix cmake rpath settings Jan 24, 2018
@gabyx gabyx changed the title Fix cmake rpath settings Installation Folder & rpath urls Jan 24, 2018
@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018

Changed the PR title: I made more consistent cmake code, for linux and mac, windows, and set the settings for the rpath urls in the binaries.
as well as incorporated the changes of @Warchant (some of them)
Default prefix when configuring is still ./install, these are some really valuable changes I think.

  • Newer Cmake
  • Made rpath settings in binaries consistent in Linux/Mac (Windows not affected since that thing does not exist in Win) (newer cmake has some new policy for macos, thats why it did not work)
  • Better Install directories (default is ./install)

These fixes are also incorporated for the PR #100 (which is on good way I think, since, clang 7.0 compiles fine with all warning on, except for benchmarks and unit_tests there I have disabled some minor ones... (see the PR)

@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018

Can we merge this?

@acki-m
Copy link
Contributor

acki-m commented Jan 24, 2018

I checked it out and compiled it with MSVC. It works so far, however.
I am unsure about:

  • higher CMake version 3.5
  • the switching of: -stdlib=libstdc++ -static -lstdc++
  • DESTINATION ${CMAKE_INSTALL_DATADIR}/rttr/cmake What location is this?
  • how to you copy the readme and the license file now?

PS: I would merge this first, because this fixes the path handling

@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018

that would be great!,

@acki-m
Copy link
Contributor

acki-m commented Jan 24, 2018

Damn't it I checked out master from your fork ^^
That's why everything worked. Have to do it again.

@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018

Oh pitty, ehm -> let me know if something is not working, so we can fix it =)

@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018

At least appveyor succeded, the others are a bit stuck

set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_PREFIX}")
endif()

set(CMAKE_DEBUG_POSTFIX CACHE STRING "_d")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for unkown reason the postfix will not be applied to rttr_core
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The postfix is necessary, otherwise we cannot copy the debug and release libraries, into one folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for sure! but why is it not working? the CMAKE_DEBUG_POSTFIX is set...?

COMPONENT Devel)

install(FILES "${LICENSE_FILE}" "${README_FILE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license files are missing

@@ -134,10 +161,6 @@ write_basic_package_version_file(

if (BUILD_INSTALLER)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CMake/rttr-config-version.cmake"
DESTINATION cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/rttr/cmake
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks now strange on windows:
image
The folder should be named cmake. I think otherwise cmake will not find the script, when pointing to the root directory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lib folder should be empty? isnt it? the libraries should all go into the bin folder...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be we could symlink on windows into the lib folder, and install all everythin properly in the lib folder?, why is the lib folder even constructed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lib folder has to be there, there are the *.lib files placed.
necessary to link the libraries on windows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, where is this path hardcoded into cmake? i didnt see that one? maybe I missed something?

CMakeLists.txt Outdated
@@ -31,7 +31,7 @@
# the build configuration options are initialized. #
####################################################################################

cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to 3.0

@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018 via email

@acki-m
Copy link
Contributor

acki-m commented Jan 24, 2018

The lib folder should stay!
That's how it works under windows, that is common behavior to put the libs under lib
Here how it is done with Qt:
image

PS: the debug DLL has still no _d postfix
Do you have not a virtual machine with windows for testing?

@acki-m
Copy link
Contributor

acki-m commented Jan 24, 2018

This will fix it:

    set_target_properties(rttr_core PROPERTIES
                          VERSION ${RTTR_VERSION} SOVERSION ${RTTR_VERSION}
                          DEBUG_POSTFIX _d
                          EXPORT_NAME Core)

@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018 via email

@@ -0,0 +1,2 @@
.vscode
build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line

endif()

set(CMAKE_DEBUG_POSTFIX "_d")
set(CMAKE_DEBUG_POSTFIX CACHE STRING "_d")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be removed.
You have to add the DEBUG_POSTFIX _d to all target properties

@acki-m
Copy link
Contributor

acki-m commented Jan 24, 2018

It seems to work now, I wait for the MSVC builds to finish, then I will merge
PS: Why did you changed the -stdlib=libstdc++ -static -lstdc++

@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018

jup, for me to, on mac os, installation folder looks clean. tests passed...

@gabyx
Copy link
Contributor Author

gabyx commented Jan 24, 2018

Oh, it dont know why I changed, -stdlib=libstdc++ -static -lstdc++
@Warchant I think commented on this beeing more standart? maybe we should check again... do you know?

@acki-m
Copy link
Contributor

acki-m commented Jan 25, 2018

@gabyx
I want to squash your 21 commits into one for merge, can you give me a shot summary, what you have done here.

@gabyx
Copy link
Contributor Author

gabyx commented Jan 25, 2018

Jeah, thats a good thing to do,
Shot summary:

  • installation folder consistency Linux/Mac/Windows solved
  • RPath issues solved for Linux/Mac
  • cmake version upgraded to 3.0
    I think thats it.

sorry, I was a bit profusely with comitting

Thanks for your time!

@acki-m acki-m merged commit 29e6ff9 into rttrorg:master Jan 25, 2018
@gabyx gabyx deleted the fix-cmake-rpath-macos branch February 16, 2018 18:34
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

Successfully merging this pull request may close these issues.

4 participants