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

32bit Compile Fails #115

Closed
shoober420 opened this issue May 15, 2017 · 8 comments
Closed

32bit Compile Fails #115

shoober420 opened this issue May 15, 2017 · 8 comments

Comments

@shoober420
Copy link

shoober420 commented May 15, 2017

I've been trying to compile OpenAL from the master. I have successfully compiled it for 64bit, but not for 32bit. No matter what CMAKE options I try, it still fails. Here is the error.

[100%] Linking CXX executable ../../alsoft-config
/usr/lib/libQt5Widgets.so.5.8.0: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [utils/alsoft-config/CMakeFiles/alsoft-config.dir/build.make:158: alsoft-config] Error 1
make[1]: *** [CMakeFiles/Makefile2:525: utils/alsoft-config/CMakeFiles/alsoft-config.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

This is compiling on Arch Linux 64bit. Here is my PKGBUILD with all the options.

_pkgbasename=openal
_gitname=openal-soft
pkgname=lib32-openal-git
pkgver=1.17.2
pkgrel=1
pkgdesc="A cross-platform 3D audio library (32-bit)"
arch=(x86_64)
url="https://github.com/kcat/openal-soft"
license=(LGPL)
depends=(lib32-glibc $_pkgbasename)
makedepends=(lib32-alsa-lib pkgconfig cmake lib32-libpulse lib32-portaudio lib32-jack
             git gcc-multilib lib32-ffmpeg lib32-sdl_sound)
source=("git+$url")
sha256sums=('SKIP')

prepare() {
  mkdir build
  cd $_gitname
}

build() {
  export CC="gcc -m32"
  export CXX="g++ -m32"
  export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"

  cd build
  cmake -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_INSTALL_LIBDIR=/usr/lib32 -D CMAKE_BUILD_TYPE=Release -D LIB_SUFFIX=32 ../$_gitname
  make
}

package() {
  optdepends=('lib32-qt5-base-bin: alsoft-config GUI Configurator'
              'lib32-fluidsynth: MIDI rendering')

  make -C build DESTDIR="$pkgdir/" install
  rm -rf "$pkgdir"/usr/{include,share,bin}
}
@kcat
Copy link
Owner

kcat commented May 15, 2017

Looks like an issue with the Qt5 dev packages, that cmake's picking up a 64-bit lib instead of a 32-bit one. Are you sure the 32-bit versions of the necessary packages are installed? I'm not too familiar with Arch so I'm not sure exactly which packages you need, but alsoft-config uses Qt5Widgets.

@shoober420
Copy link
Author

shoober420 commented May 15, 2017

Yes, I have the 32bit qt5 libs installed. They are located in /usr/lib32. Is there a way I can force cmake to look for the qt5 libs in /usr/lib32 instead of /usr/lib?

I made a thread about on the Arch Linux forums and we still haven't figured it out.

https://bbs.archlinux.org/viewtopic.php?id=225588

@kcat
Copy link
Owner

kcat commented May 15, 2017

From my reading of https://doc.qt.io/qt-5/cmake-manual.html:

"In order for find_package to be successful, Qt 5 must be found below the CMAKE_PREFIX_PATH, or the Qt5_DIR must be set in the CMake cache to the location of the Qt5WidgetsConfig.cmake file. The easiest way to use CMake is to set the CMAKE_PREFIX_PATH environment variable to the install prefix of Qt 5."

With CMAKE_PREFIX_PATH set to /usr by default (I presume), CMake might be getting confused with both /usr/lib/cmake/Qt5Widgets and /usr/lib32/cmake/Qt5Widgets existing, so find_package(Qt5Widgets) just "randomly" picks one. Unless there's some other trick Arch Linux has to tell CMake to look in lib32/cmake instead of lib/cmake, it seems you need to explicitly tell it where to look for the Widgets module and its dependencies (Gui and Core):
cmake .. -DQt5Widgets_DIR=/usr/lib32/cmake/Qt5Widgets -DQt5Gui_DIR=/usr/lib32/cmake/Qt5Gui -DQt5Core_DIR=/usr/lib32/cmake/Qt5Core

@shoober420
Copy link
Author

It still fails to compile even when adding those setting. It still looks in the /usr/lib directory instead of /usr/lib32. It's the same error.

@kcat
Copy link
Owner

kcat commented May 15, 2017

That was with a clean build directory?

What does your /usr/lib32/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake look like? Does the get_filename_component(_realOrig ...) line have the correct lib32path?

@shoober420
Copy link
Author

shoober420 commented May 15, 2017

It appears that it does.

if (CMAKE_VERSION VERSION_LESS 2.8.3)
    message(FATAL_ERROR "Qt 5 requires at least CMake version 2.8.3")
endif()

get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
 Use original install prefix when loaded through a
 cross-prefix symbolic link such as /lib -> /usr/lib32.
get_filename_component(_realCurr "${_IMPORT_PREFIX}" REALPATH)
get_filename_component(_realOrig "/usr/lib32/cmake/Qt5Widgets" REALPATH)
if(_realCurr STREQUAL _realOrig)
    get_filename_component(_qt5Widgets_install_prefix "/usr/lib32/../" ABSOLUTE)
else()
    get_filename_component(_qt5Widgets_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
endif()
unset(_realOrig)
unset(_realCurr)
unset(_IMPORT_PREFIX)

@kcat
Copy link
Owner

kcat commented May 15, 2017

Seems there's a couple lines down a bit farther,
set(imported_location "${_qt5Widgets_install_prefix}...)
do they have the correct lib32 path too?

If so, I'm not sure. Do other cmake projects that use Qt5 work when built for 32-bit?

@shoober420
Copy link
Author

shoober420 commented May 16, 2017

You're a fricking genius. Built Successfully. Thank you so much kcat.

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