cs50 / cli

https://cs50.readthedocs.io/cs50/cli
GNU General Public License v3.0
13 stars 19 forks source link

Clang Sanitizers not built for latest image #219

Closed sgilbert-student closed 3 months ago

sgilbert-student commented 3 months ago

One of my students updated her workspace this afternoon (Sunday, homework due by midnight) and found that none of the makefiles I supplied work now. The update seems to change clang from 14.0.0 to 18. Unfortunately, that breaks makefiles, which include any -fsantiize= lines.

In the previous image, all of the santitizers were built in this folder: /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/

This is what make hello does (with hello.cpp) $ make hello /usr/bin/ld: cannot find /usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.ubsan_standalone-x86_64.a: No such file or directory /usr/bin/ld: cannot find /usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a: No such file or directory clang++: error: linker command failed with exit code 1 (use -v to see invocation)

I can fix this by removing all of the -fstanitize flags from CXXFLAGS I just wish this hadn't happened on Sunday night.

rongxin-liu commented 3 months ago

I'm sorry, we upgraded codespace to use ubuntu 24.04 now.

rongxin-liu commented 3 months ago

Could you please provide the makefile and the assignment here so we can test it out and potentially fix it?

sgilbert-student commented 3 months ago

Well, any cpp file (hello.cpp, for instance) will fail if it is compiled with either -fsanitize=signed-integer-overflow or -fsanitize=undefined. Here is what the old folder looks like image

I checked the new image and none of those files were found. I was able to install them (well, the new versions) with: sudo apt-get install libclang-rt-18-dev

rongxin-liu commented 3 months ago

Ok, thanks! We will just install libclang-rt-18-dev in our base image. https://github.com/cs50/cli/commit/df4ac11d09c0ef23ef53ae2d0e2ec1ac793a6b1c

rongxin-liu commented 3 months ago

https://github.com/cs50/codespace/commit/c4efefa86ae63958ce20549ee426f8d73745c904