Cannot compile simple example with libcurl on MacOS with M1 cpu lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- ydd · 2021-05-06 13:51 project file: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program teststream;uses libcurl;var hCurl: pCurl;begin  hCurl := curl_easy_init;end. compile log: QuoteProject checks, Hints: 1 Note: passing compiler option -M twice with different values Hint: (11030) Start of reading config file /Users/yd/Lazarus/v1.8.2n/fpc/bin/aarch64-darwin/fpc.cfg Hint: (11031) End of reading config file /Users/yd/Lazarus/v1.8.2n/fpc/bin/aarch64-darwin/fpc.cfg Free Pascal Compiler version 3.3.1-r49155 [2021/04/09] for aarch64 Copyright (c) 1993-2021 by Florian Klaempfl and others (1002) Target OS: Darwin for AArch64 (3104) Compiling teststream.pp /Volumes/Projects/Tests/Lazarus/libcurl/teststream.pp(43,5) Note: (5027) Local variable "hCurl" is assigned but never used (9001) Assembling (pipe) /Volumes/Projects/Tests/Lazarus/libcurl/lib/a arch64-darwin/teststream.s (9015) Linking /Volumes/Projects/Tests/Lazarus/libcurl/teststream Undefined symbols for architecture arm64:   "_curl_easy_init", referenced from:       _PASCALMAIN in teststream.o ld: symbol(s) not found for architecture arm64 Error: (9013) Error while linking Fatal: (10026) There were 1 errors compiling module, stopping Fatal: (1018) Compilation aborted Error: /Users/yd/Lazarus/v1.8.2n/fpc/bin/aarch64-darwin/ppca64 returned an error exitcode I installed curl using brew. I found that libcurl exists under: /opt/homebrew/Cellar/curl/7.76.1/lib below is content of this dir: Quote┌<─ /opt/homebrew/Cellar/curl/7.76.1/lib ────────────────────────────────────────────.[^]>┐ │.n                              Name                                │ Size  │Modify time │ │/..                                                                 │UP--DIR│May  6 04:59│ │/pkgconfig                                                          │     96│May  6 04:59│ │ libcurl.4.dylib                                                    │ 596528│May  6 04:59│ │ libcurl.a                                                          │ 955824│Apr 14 08:58│ │@libcurl.dylib                                                      │     15│Apr 14 08:58│ question - how to make it to compile? I can compile it on Windows & Linux. ---------------------------------------------------------------------- Jonas Maebe · 2021-05-06 18:21 Have you added that directory to the linker's library search path? (-Fl/opt/homebrew/Cellar/curl/7.76.1/lib) That directory is not a default directory in which the linker looks for libraries. ---------------------------------------------------------------------- ydd · 2021-05-06 19:35 Quote from: Jonas Maebe on May 06, 2021, 08:21:24 pmHave you added that directory to the linker's library search path? (-Fl/opt/homebrew/Cellar/curl/7.76.1/lib) configured as you advised - same error ---------------------------------------------------------------------- Jonas Maebe · 2021-05-06 19:47 Looking at the source of that unit, it's missing a {$linklib curl} directive. I wonder why it was enabled for Darwin, since it was obviously never tested there. (You can add that line to your program, it doesn't have to be in the unit itself) ---------------------------------------------------------------------- ydd · 2021-05-06 20:13 Quote from: Jonas Maebe on May 06, 2021, 09:47:20 pmLooking at the source of that unit, it's missing a {$linklib curl} directive. I wonder why it was enabled for Darwin, since it was obviously never tested there. (You can add that line to your program, it doesn't have to be in the unit itself) added, got big number of other errors - see attached file ---------------------------------------------------------------------- Jonas Maebe · 2021-05-06 20:29 Looks like the compiler is selecting the static rather than the dynamic library to link against, not sure why (in that case you have to manually specify all of the dependent libraries to link against as well). Did you use {$linklib libcurl.a} perhaps? Try {$linklib libcurl.dylib} instead. ---------------------------------------------------------------------- ydd · 2021-05-06 20:44 Quote from: Jonas Maebe on May 06, 2021, 10:29:27 pmLooks like the compiler is selecting the static rather than the dynamic library to link against, not sure why (in that case you have to manually specify all of the dependent libraries to link against as well). Did you use {$linklib libcurl.a} perhaps? Try {$linklib libcurl.dylib} instead. look like it does not matter - errors are same for "{$linklib x}" with: curl, libcurl, libcurl.a, libcurl.dylib but magically it compiled for: {$linklib libcurl.4} need to test ---------------------------------------------------------------------- Jonas Maebe · 2021-05-06 20:51 Well, there's only a libcurl.4.dylib in that directory, no libcurl.4.a, so that's "normal". Still strange it picked the static library in the other cases, as it really should default to dynamic. ---------------------------------------------------------------------- ydd · 2021-05-06 21:42 Quote from: Jonas Maebe on May 06, 2021, 09:47:20 pmLooking at the source of that unit, it's missing a {$linklib curl} directive. I wonder why it was enabled for Darwin, since it was obviously never tested there. thank you for your help - I already spend 2 evenings trying to compile does it mean that unit "libcurl" - should be fixed?