dilevin / computer-graphics-ray-tracing

Computer Graphics Assignment about Ray Tracing
1 stars 5 forks source link

error message when running make #11

Closed Lipai-1994 closed 5 years ago

Lipai-1994 commented 5 years ago

I got the following error message when I ran make

[ 14%] Building CXX object CMakeFiles/raytracing.dir/src/DirectionalLight.cpp.o
[ 28%] Building CXX object CMakeFiles/raytracing.dir/src/PointLight.cpp.o
[ 42%] Building CXX object CMakeFiles/raytracing.dir/src/blinn_phong_shading.cpp.o
[ 57%] Building CXX object CMakeFiles/raytracing.dir/src/raycolor.cpp.o
[ 71%] Building CXX object CMakeFiles/raytracing.dir/src/reflect.cpp.o
[ 85%] Building CXX object CMakeFiles/raytracing.dir/main.cpp.o
[100%] Linking CXX executable raytracing
/usr/bin/ld: ../lib/debug/linux/libhw2.a(Plane.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ../lib/debug/linux/libhw2.a(Sphere.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ../lib/debug/linux/libhw2.a(Triangle.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ../lib/debug/linux/libhw2.a(TriangleSoup.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ../lib/debug/linux/libhw2.a(first_hit.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ../lib/debug/linux/libhw2.a(viewing_ray.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ../lib/debug/linux/libhw2.a(write_ppm.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
CMakeFiles/raytracing.dir/build.make:224: recipe for target 'raytracing' failed
make[2]: *** [raytracing] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/raytracing.dir/all' failed
make[1]: *** [CMakeFiles/raytracing.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I don't think the error is about the code. I doubt it's about my gcc. I'm using Ubuntu, and my gcc version is 5.5.0 20171010. Any idea on this problem? Any response will be appreciated.

dilevin commented 5 years ago

Which version of Ubuntu are you running, what were the exact cmake and make commands you used ?

Lipai-1994 commented 5 years ago

I am using Ubuntu 18.04.1 LTS The command I am using for cmake is: cmake -DCMAKE_BUILD_TYPE=Debug - DHW2LIB_DIR=../lib/debug/linux/ ..

and the make command is just "make", just as the instruction on our assignment post.

dilevin commented 5 years ago

This stackoverflow post seems to refer to the problem.

This is likely due to the fact that the precompiled library is designed for the CDF machines (Ubuntu 16.04) not Ubuntu 18.04. For now, either use your A2 code for the required functions or use the CDF machines for A3.

If we are able to produce a new version of the precompiled library we will post here but it is unlikely by Friday.