Community
Participate
Working Groups
Created attachment 286678 [details] Two screenshots of debug settings and eclipse IDE version. When I try to build the project, I get an error message: Info: Internal Builder is used for build gcc -O0 -g3 -fsanitize-address -fsanitize=leak -fsanitize=undefined -pedantic -Wall -c -fmessage-length=0 -o src/bst.o ../src/bst.c gcc: error: unrecognized command-line option ‘-fsanitize-address’; did you mean ‘-fsanitize=address’? You can see the selected debugging flags in the first screenshot. Sorry, I'm not sure about the version. I only can see 4.20.0 (2021-06). See second screenshot.
Thanks for the bug report. It looks like there was some typos in Bug 266305 work. Thank you for brining them to our attention.
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/182419
I have prepared a fix, in the meantime, please use the workaround of manually putting the correct flag in "Other debugging flags"
Ok, I did it, but got more errors. So I created a Hello World Project by the wizard and entered manually "-fsantize=address". See screenshot. This is, what I got: 20:49:22 **** Incremental Build of configuration Debug for project HelloWorld **** make all Building target: HelloWorld Invoking: GCC C Linker gcc -o "HelloWorld" ./src/HelloWorld.o /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: ./src/HelloWorld.o: in function `_sub_D_00099_0': /mnt/datalnx/data_gs/Entwicklung/C/eclipse-workspace/HelloWorld/Debug/../src/HelloWorld.c:17: undefined reference to `__asan_unregister_globals' /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: ./src/HelloWorld.o: in function `_sub_I_00099_1': /mnt/datalnx/data_gs/Entwicklung/C/eclipse-workspace/HelloWorld/Debug/../src/HelloWorld.c:17: undefined reference to `__asan_init' /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /mnt/datalnx/data_gs/Entwicklung/C/eclipse-workspace/HelloWorld/Debug/../src/HelloWorld.c:17: undefined reference to `__asan_version_mismatch_check_v8' /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /mnt/datalnx/data_gs/Entwicklung/C/eclipse-workspace/HelloWorld/Debug/../src/HelloWorld.c:17: undefined reference to `__asan_register_globals' collect2: error: ld returned 1 exit status make: *** [makefile:46: HelloWorld] Fehler 1 "make all" terminated with exit code 2. Build might be incomplete. 20:49:22 Build Failed. 7 errors, 0 warnings. (took 318ms)
Created attachment 286679 [details] Manual debug settings in project HelloWorld.
For those issues please consult gcc docs and support channels. If there are changes to CDT that it leads to we can make them. https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html https://github.com/google/sanitizers/wiki/AddressSanitizer
Gerrit change https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/182419 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=3f472a917b7e09afcf9d84837f9cf8c1e275254f
(In reply to Jonah Graham from comment #6) > For those issues please consult gcc docs and support channels. If there are > changes to CDT that it leads to we can make them. > > https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html > https://github.com/google/sanitizers/wiki/AddressSanitizer It's not a gcc issue. When I compile HelloWorld.c manually in a terminal with "gcc -fsanitize=address -o HelloWorld.o HelloWorld.c", everything is ok. I get those errors, mentioned in comment #4 only when building HelloWorld.c in Eclipse.
Ok. Your terminal command line is compile and link, my guess is that the sanitize command line option needs to be specified at link time too. Please add the option to the linker flags. If that works, let me know and we'll look at how to provide them in both places.
Created attachment 286687 [details] Linker Flag -fsanitze=address When I set the linker flag as shown in the attachment,it works and HelloWorld is compiled and linked without an error. I found another issue: 16:12:52 **** Incremental Build of configuration Debug for project HelloWorld **** make all Building file: ../src/HelloWorld.c Invoking: GCC C Compiler gcc -O0 -g3 -fsanitize=address -fsanitize-pointer-compare -fsanitize=pointer-subtract -Wall -c -fmessage-length=0 -MMD -MP -MF"src/HelloWorld.d" -MT"src/HelloWorld.o" -o "src/HelloWorld.o" "../src/HelloWorld.c" gcc: error: unrecognized command-line option ‘-fsanitize-pointer-compare’; did you mean ‘-fsanitize=pointer-compare’? make: *** [src/subdir.mk:20: src/HelloWorld.o] Fehler 1 "make all" terminated with exit code 2. Build might be incomplete. And another question: How can I get the fix?
(In reply to Guenter Stoehr from comment #10) > Created attachment 286687 [details] > Linker Flag -fsanitze=address > > > > When I set the linker flag as shown in the attachment,it works and > HelloWorld is compiled and linked without an error. Great. Thanks for confirming. > > I found another issue: My earlier commit fixed this case too. > > And another question: How can I get the fix? It will be part of the next release. You can try out latest master build https://ci.eclipse.org/cdt/job/cdt-master/lastSuccessfulBuild/artifact/releng/org.eclipse.cdt.repo/target/repository/ If this is blocker for you we may be able to spin a bug fix release based on last release.
I think we are done here - just never marked it resolved until now. Please advise if something is missing.