10110111 / CalcMySky

Simulator of light scattering by planetary atmospheres
GNU General Public License v3.0
29 stars 7 forks source link

Failed to link on aarch64 #12

Closed Hellseher closed 1 year ago

Hellseher commented 1 year ago

Hi,

I'm about to pack your project for Guix to extand Stellarium, the build has been pased on x84_64 but aarch64 failed on link phase:

[100%] Linking CXX shared library libShowMySky-Qt6.so
cd /tmp/guix-build-calcmysky-0.2.1.drv-0/build/ShowMySky && /gnu/store/6lfyb68pdy0b1vggzbvw8grkv2ws6vhl-cmake-minimal-3.21.4/bin/cmake -E cmake_link_script CMakeFiles/ShowMySky.dir/link.txt --verbose=1
/gnu/store/dbcbcaxq20kbkhh2mr8k98qfnymq22kp-gcc-10.3.0/bin/c++ -fPIC -Werror=return-type -Wall -Wextra -fvisibility=hidden  -O2 -g -DNDEBUG -shared -Wl,-soname,libShowMySky-Qt6.so.14 -o libShowMySky-Qt6.so.14.0.0 CMakeFiles/ShowMySky.dir/ShowMySky_autogen/mocs_compilation.cpp.o CMakeFiles/ShowMySky.dir/api/AtmosphereRenderer.cpp.o CMakeFiles/ShowMySky.dir/AtmosphereRenderer.cpp.o CMakeFiles/ShowMySky.dir/util.cpp.o  -Wl,-rpath,::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../libversion.a ../libcommon.a /gnu/store/qkf1654wl06h2v77fw93y4qsl4dydg2d-qtbase-6.3.1/lib/libQt6OpenGL.so.6.3.1 /gnu/store/qkf1654wl06h2v77fw93y4qsl4dydg2d-qtbase-6.3.1/lib/libQt6Widgets.so.6.3.1 /gnu/store/qkf1654wl06h2v77fw93y4qsl4dydg2d-qtbase-6.3.1/lib/libQt6Gui.so.6.3.1 /gnu/store/g4z7km9bhzi83pz597knwhvndb2740vk-mesa-21.3.8/lib/libGL.so /gnu/store/qkf1654wl06h2v77fw93y4qsl4dydg2d-qtbase-6.3.1/lib/libQt6Core.so.6.3.1 -pthread 
ld: ../libcommon.a(EclipsedDoubleScatteringPrecomputer.cpp.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_ZNSt12out_of_rangeD1Ev@@GLIBCXX_3.4' which may bind externally can not be used when making a shared object; recompile with -fPIC
ld: ../libcommon.a(EclipsedDoubleScatteringPrecomputer.cpp.o)(.text+0x2cc0): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `_ZNSt12out_of_rangeD1Ev@@GLIBCXX_3.4'
ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [ShowMySky/CMakeFiles/ShowMySky.dir/build.make:155: ShowMySky/libShowMySky-Qt6.so.14.0.0] Error 1
make[2]: Leaving directory '/tmp/guix-build-calcmysky-0.2.1.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:366: ShowMySky/CMakeFiles/ShowMySky.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-calcmysky-0.2.1.drv-0/build'
make: *** [Makefile:149: all] Error 2

Full build log https://bordeaux.guix.gnu.org/build/0db2d4fd-c6e9-4333-ad6f-c04a87d563b7

10110111 commented 1 year ago

Try configuring cmake with -DCMAKE_CXX_FLAGS=-fPIC.

Hellseher commented 1 year ago

Thanks, your suggestion resolved the issue.