Ken, these undefined symbol errors are a common occurrence. Here is more general information for your future reference. Programs in C, fortran, and certain other languages will call functions in external libraries for various purposes. Each library contains many functions. When a program is compiled, the linker tries to find those external functions by name. Some functions are in system libraries that the linker already knows, so no libraries are specified for these.
External libraries such as "libcurl" need to be given explicitly in the compile command, in two parts. In general, -L[PATH] (big "L") points to a directory containing some libraries, and -l[NAME] (little "L") names a specific library. For example, "-L/opt/local/lib -lcurl". If multiple libraries in the same directory are requested, -L needs to be given only once. This is why I did not suggest -L earlier, because your compiler/linker was already including /opt/local/lib and some other library directories. When naming a library with -l (little "L"), the linker adds the prefix "lib" to the given name. For example, "-lcurl" resolves to "libcurl". The file suffix such as ".a" or ".dylib" is NOT specified, and the linker will figure out that part. The command "nm [LIBRARY FILE NAME] | grep ' T ' " will list all of the available function names within a single library file. Try this on /opt/local/lib/libcurl.dylib, and you will see those formerly missing CURL symbols listed. Function names must match exactly, including underscores. Knowing this, you can go hunting for missing libraries and symbols, when you next run into the "undefined symbols" message. On Fri, Oct 24, 2025 at 1:01 PM Kenneth Wolcott <[email protected]> wrote: > Thank you Dave, I knew it was simple, right over my head. > > Now the problem is not with the code, not with compiling, not with > linking, but that the Rosetta Code task itself doesn't work (web address > change, etc). > > Thanks again for the help. > > On Fri, Oct 24, 2025 at 11:26 AM Dave Allured - NOAA Affiliate < > [email protected]> wrote: > >> Add -lcurl. >> >> >> On Fri, Oct 24, 2025 at 12:14 PM Kenneth Wolcott < >> [email protected]> wrote: >> >>> Hi; >>> >>> trying to compile a Rosetta Code task written in C which uses curl; fails >>> >>> https://rosettacode.org/wiki/Web_scraping#C >>> >>> What am I missing? >>> >>> Perhaps I hav asked a similar question previously, hope not, apologies >>> if so... >>> >>> Thanks, >>> Ken Wolcott >>> >>> platform: arm64 Tahoe >>> >>> command: clang -v -o ./web_scraping ./web_scraping.c >>> >>> Failure output: >>> >>> Apple clang version 17.0.0 (clang-1700.3.19.1) >>> Target: arm64-apple-darwin25.0.0 >>> Thread model: posix >>> InstalledDir: >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin >>> >>> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" >>> -cc1 -triple arm64-apple-macosx26.0.0 -Wundef-prefix=TARGET_OS_ >>> -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage >>> -Werror=implicit-function-declaration -emit-obj -dumpdir ./web_scraping- >>> -disable-free -clear-ast-before-backend -disable-llvm-verifier >>> -discard-value-names -main-file-name web_scraping.c -mrelocation-model pic >>> -pic-level 2 -mframe-pointer=non-leaf -fno-strict-return -ffp-contract=on >>> -fno-rounding-math -funwind-tables=1 -fobjc-msgsend-selector-stubs >>> -target-sdk-version=26.0 -fvisibility-inlines-hidden-static-local-var >>> -fdefine-target-os-macros -fno-assume-unique-vtables >>> -fno-modulemap-allow-subdirectory-search -target-cpu apple-m1 >>> -target-feature +zcm -target-feature +zcz -target-feature +v8.5a >>> -target-feature +aes -target-feature +altnzcv -target-feature +ccdp >>> -target-feature +complxnum -target-feature +crc -target-feature +dotprod >>> -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +fptoint >>> -target-feature +fullfp16 -target-feature +jsconv -target-feature +lse >>> -target-feature +neon -target-feature +pauth -target-feature +perfmon >>> -target-feature +predres -target-feature +ras -target-feature +rcpc >>> -target-feature +rdm -target-feature +sb -target-feature +sha2 >>> -target-feature +sha3 -target-feature +specrestrict -target-feature +ssbs >>> -target-abi darwinpcs -debugger-tuning=lldb >>> -fdebug-compilation-dir=/Users/kwolcott/not_git_master/programming/from_Rosetta_Code/C/Web_Scraping >>> -target-linker-version 1221.4 -v >>> -fcoverage-compilation-dir=/Users/kwolcott/not_git_master/programming/from_Rosetta_Code/C/Web_Scraping >>> -resource-dir >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17 >>> -isysroot >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk >>> -I/usr/local/include -c-isystem /opt/local/include -cxx-isystem >>> /opt/local/include -internal-isystem >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include >>> -internal-isystem >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/include >>> -internal-externc-isystem >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include >>> -internal-externc-isystem >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include >>> -internal-iframework >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks >>> -internal-iframework >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/SubFrameworks >>> -internal-iframework >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks >>> -Wno-reorder-init-list -Wno-implicit-int-float-conversion >>> -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt >>> -Wno-misleading-indentation -Wno-quoted-include-in-framework-header >>> -Wno-implicit-fallthrough -Wno-enum-enum-conversion >>> -Wno-enum-float-conversion -Wno-elaborated-enum-base -ferror-limit 19 >>> -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks >>> -fencode-extended-block-signature -fregister-global-dtors-with-atexit >>> -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fmax-type-align=16 -fcommon >>> -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation >>> -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding >>> -clang-vendor-feature=+revert09abecef7bbf >>> -clang-vendor-feature=+thisNoAlignAttr >>> -clang-vendor-feature=+thisNoNullAttr >>> -clang-vendor-feature=+disableAtImportPrivateFrameworkInImplementationError >>> -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o >>> /var/folders/f7/q14k59r11z310fdpl0m5mlc80000gn/T/web_scraping-babfe6.o -x c >>> ./web_scraping.c >>> clang -cc1 version 17.0.0 (clang-1700.3.19.1) default target >>> arm64-apple-darwin25.0.0 >>> ignoring nonexistent directory >>> "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include" >>> ignoring nonexistent directory >>> "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks" >>> #include "..." search starts here: >>> #include <...> search starts here: >>> /usr/local/include >>> /opt/local/include >>> >>> >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/include >>> >>> >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include >>> >>> >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include >>> >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks >>> (framework directory) >>> >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/SubFrameworks >>> (framework directory) >>> End of search list. >>> >>> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" >>> -demangle -lto_library >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib >>> -no_deduplicate -dynamic -arch arm64 -platform_version macos 26.0.0 26.0 >>> -syslibroot >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk >>> -mllvm -enable-linkonceodr-outlining -o ./web_scraping -L/opt/local/lib >>> -L/usr/local/lib >>> /var/folders/f7/q14k59r11z310fdpl0m5mlc80000gn/T/web_scraping-babfe6.o >>> -lSystem >>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/lib/darwin/libclang_rt.osx.a >>> Undefined symbols for architecture arm64: >>> "_curl_easy_cleanup", referenced from: >>> _main in web_scraping-babfe6.o >>> "_curl_easy_init", referenced from: >>> _main in web_scraping-babfe6.o >>> "_curl_easy_perform", referenced from: >>> _main in web_scraping-babfe6.o >>> "_curl_easy_setopt", referenced from: >>> _main in web_scraping-babfe6.o >>> _main in web_scraping-babfe6.o >>> _main in web_scraping-babfe6.o >>> _main in web_scraping-babfe6.o >>> ld: symbol(s) not found for architecture arm64 >>> clang: error: linker command failed with exit code 1 (use -v to see >>> invocation) >>> >>
