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

libopenrct2.so: cannot open shared object file: No such file or directory when building g2.dat #5910

Closed
Mailaender opened this issue Jul 15, 2017 · 10 comments

Comments

@Mailaender
Copy link
Contributor

Another build problem I can't solve on my own. According to the logs the build of libopenrct2 finishes successfully, but nonetheless the creation of g2.dat fails.

OS: openSUSE Tumbleweed
Version: 0.1.0

[  266s] [100%] Built target openrct2
[  266s] make -f CMakeFiles/g2.dir/build.make CMakeFiles/g2.dir/depend
[  266s] make[3]: Entering directory '/home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build'
[  266s] cd /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0 /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0 /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build/CMakeFiles/g2.dir/DependInfo.cmake
[  266s] Scanning dependencies of target g2
[  266s] make[3]: Leaving directory '/home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build'
[  266s] make -f CMakeFiles/g2.dir/build.make CMakeFiles/g2.dir/build
[  266s] make[3]: Entering directory '/home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build'
[  266s] [100%] Generating g2.dat
[  266s] ./openrct2 sprite build /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build/g2.dat /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/resources/g2/sprites.json
[  266s] ./openrct2: error while loading shared libraries: libopenrct2.so: cannot open shared object file: No such file or directory
[  266s] make[3]: *** [CMakeFiles/g2.dir/build.make:65: g2.dat] Error 127
[  266s] make[3]: Leaving directory '/home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build'
[  266s] make[2]: *** [CMakeFiles/Makefile2:103: CMakeFiles/g2.dir/all] Error 2
[  266s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build'
[  266s] make[1]: *** [CMakeFiles/Makefile2:110: CMakeFiles/g2.dir/rule] Error 2
[  266s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/build'
[  266s] make: *** [Makefile:180: g2] Error 2
[  266s] error: Bad exit status from /var/tmp/rpm-tmp.G26YYX (%build)

Steps to reproduce:
https://build.opensuse.org/package/show/home:Mailaender:branches:games/openrct2

@IntelOrca
Copy link
Contributor

IntelOrca commented Jul 15, 2017

It fails because running openrct2 fails. Presumably you can't run ./openrct2 either? It appears it can't find libopenrct2.so, now usually when it links a library to the binary, it stores the location to it so that it can load it - but that doesn't appear to work in this case? Alternatively you can set LD_LIBRARY_PATH to the directory that contains libopenrct2.so or move that into /usr/lib.

@Mailaender
Copy link
Contributor Author

It looks like something in the %cmake macro is causing problems:

[   25s] + /usr/bin/cmake /home/abuild/rpmbuild/BUILD/OpenRCT2-0.1.0/. '-GUnix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64 -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -DNDEBUG' '-DCMAKE_CXX_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -DNDEBUG' '-DCMAKE_Fortran_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -DNDEBUG' '-DCMAKE_EXE_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_MODULE_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' -DLIB_SUFFIX=64 -DCMAKE_SKIP_RPATH:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_MODULES_INSTALL_DIR=/usr/share/cmake/Modules

It works fine without it. We had such problems in the past.

@IntelOrca
Copy link
Contributor

What does -DLIB_SUFFIX=64 do?

@Mailaender
Copy link
Contributor Author

I assume nothing here as you hardcoded all the paths manually in the install rules

install(TARGETS "libopenrct2" LIBRARY DESTINATION "lib")

Will send a fix for that, because that borks the installation on 64-bit systems. It has to be lib64 there.

@IntelOrca
Copy link
Contributor

Thanks, our cmake needs a lot more improvements because we want to have libopenrct2 be a separate package in package managers.

@Mailaender
Copy link
Contributor Author

I am still getting this error even with -DBUILD_SHARED_LIBS=ON for version 0.1.1 not sure why. It must be some parameter in the %cmake macro. #5910 (comment)

@janisozaur
Copy link
Member

What error exactly?

@Mailaender
Copy link
Contributor Author

libopenrct2.so: cannot open shared object file: No such file or directory when building g2.dat on make all g2

@janisozaur
Copy link
Member

For some reason openrct2 does not load libopenrct2.so. Can you post:

  • ldd openrct2
  • find . -name libopenrct2.so

Also make sure your build dir is clean, CMake likes to cache things.

@susnux
Copy link
Contributor

susnux commented Jul 15, 2019

Cause of this issue: libopenrct2.so is not installed when make g2 is called, so it does not exist in the LD_LIBRARY_PATH, but in the build directory. On openSUSE rpath is disabled, that is why make g2 will fail.

When compiling on openSUSE use something like this:

make %{?_smp_mflags} all
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(dirname $(find . -name libopenrct2.so))"
make g2

I have no idea if this is also a problem on other linux systems.

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

4 participants