Starting yesterday I now get the following warning when I comple any code with
an import:
nim c temp.nim
ld: warning: ignoring duplicate libraries: '-lm'
Run
## Simple Example (with import)
import strutils
if isMainModule:
assert "A" & "B" & "C" == "ABC"
assert ["A", "B", "C"].join == "ABC"
Run
if I comment out the import the error goes away:
## Simple Example (without import)
# import strutils
if isMainModule:
assert "A" & "B" & "C" == "ABC"
# assert ["A", "B", "C"].join == "ABC"
Run
## GPT 3.5 analysis:
The warning message you encountered, "ld: warning: ignoring
duplicate libraries: '-lm'", is related to the ld command, which
is the linker used in the C and C++ programming languages. This
warning occurs when the linker encounters duplicate library
flags.
In this case, the warning specifically states that the linker is
ignoring the duplicate library flag -lm. The -lm flag is used to
link the math library in C programs. The linker is designed to
handle multiple occurrences of the same library flag, but it
typically ignores the duplicates to avoid unnecessary redundancy.
In most cases, this warning can be safely ignored because the
linker will still successfully link the program. However, if you
encounter multiple warnings for different libraries, it is worth
investigating why the duplicate library flags are present in the
first place. It could indicate an issue with the build system or
the way libraries are being linked.
To summarize, the warning message "ld: warning: ignoring
duplicate libraries: '-lm'" means that the linker has encountered
a duplicate library flag for the math library and is choosing to
ignore it.
Run
## Context:
macOS Ventura Version 13.5.2
Nim Compiler Version 2.0.0 [MacOSX: amd64]
Compiled at 2023-08-01
Copyright (c) 2006-2023 by Andreas Rumpf
gcc -v
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
cc -v
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ld -v
@(#)PROGRAM:ld PROJECT:dyld-1015.7
BUILD 18:48:43 Aug 22 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386
x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k
armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is
29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3)
Library search paths:
Framework search paths:
Run
**Can any other Mac Nim users confirm this behavour?**
**Any recommendations on how to easily make this warning go away would be
appreciated**