You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ruki@4db94baa81bc:/mnt/xmake/tests/projects/nim/static_library$ xmake f -c;xmake -rv
checking for platform ... linux
checking for architecture ... x86_64
checking for nim ... /tmp/nim-1.6.10/bin//nim
checking for the nim compiler (nc) ... nim
checking for /tmp/nim-1.6.10/bin//nim ... ok
checking for flags (-d:release) ... ok
[ 33%]: linking.release libfoo.a
checking for nim ... /tmp/nim-1.6.10/bin//nim
checking for the nim static library archiver (ncar) ... nim
/tmp/nim-1.6.10/bin//nim c -d:release --nimcache:build/.gens/foo/linux/x86_64/release/nimcache --app:staticlib --noMain --passL:-s --nimMainPrefix:libfoo -o:build/linux/x86_64/release/libfoo.a src/foo.nim
[ 66%]: linking.release test
checking for nim ... /tmp/nim-1.6.10/bin//nim
checking for the nim linker (ncld) ... nim
/tmp/nim-1.6.10/bin//nim c -d:release --nimcache:build/.gens/test/linux/x86_64/release/nimcache --passL:-Lbuild/linux/x86_64/release --passL:-s --passL:-lfoo -o:build/linux/x86_64/release/test src/main.nim
error: Hint: used config file '/tmp/nim-1.6.10/config/nim.cfg' [Conf]
Hint: used config file '/tmp/nim-1.6.10/config/config.nims' [Conf]
.........................................................
Hint: [Link]
/usr/bin/ld: build/linux/x86_64/release/libfoo.a(@mfoo.nim.c.o): in function `NimMainInner':
@mfoo.nim.c:(.text+0x0): multiple definition of `NimMainInner'; /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@mmain.nim.c.o:@mmain.nim.c:(.text+0x10): first defined here
/usr/bin/ld: build/linux/x86_64/release/libfoo.a(@mfoo.nim.c.o): in function `PreMainInner':
@mfoo.nim.c:(.text+0x10): multiple definition of `PreMainInner'; /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@mmain.nim.c.o:@mmain.nim.c:(.text+0x0): first defined here
/usr/bin/ld: build/linux/x86_64/release/libfoo.a(@mfoo.nim.c.o): in function `PreMain':
@mfoo.nim.c:(.text+0x1b0): multiple definition of `PreMain'; /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@mmain.nim.c.o:@mmain.nim.c:(.text+0x70): first defined here
/usr/bin/ld: build/linux/x86_64/release/libfoo.a(@mfoo.nim.c.o): in function `NimMainModule':
@mfoo.nim.c:(.text+0x290): multiple definition of `NimMainModule'; /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@mmain.nim.c.o:@mmain.nim.c:(.text+0x150): first defined here
/usr/bin/ld: build/linux/x86_64/release/libfoo.a(@mfoo.nim.c.o):(.bss+0x0): multiple definition of `gEnv'; /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@mmain.nim.c.o:(.bss+0x0): first defined here
/usr/bin/ld: build/linux/x86_64/release/libfoo.a(@mfoo.nim.c.o):(.bss+0x8): multiple definition of `cmdLine'; /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@mmain.nim.c.o:(.bss+0x8): first defined here
/usr/bin/ld: build/linux/x86_64/release/libfoo.a(@mfoo.nim.c.o):(.bss+0x10): multiple definition of `cmdCount'; /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@mmain.nim.c.o:(.bss+0x10): first defined here
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: 'gcc -o /mnt/xmake/tests/projects/nim/static_library/build/linux/x86_64/release/test /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@m..@s..@s..@s..@s..@s..@s..@stmp@snim-1.6.10@slib@sstd@sprivate@sdigitsutils.nim.c.o /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@m..@s..@s..@s..@s..@s..@s..@stmp@snim-1.6.10@slib@ssystem@sdollars.nim.c.o /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@m..@s..@s..@s..@s..@s..@s..@stmp@snim-1.6.10@slib@ssystem@sio.nim.c.o /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@m..@s..@s..@s..@s..@s..@s..@stmp@snim-1.6.10@slib@ssystem.nim.c.o /mnt/xmake/tests/projects/nim/static_library/build/.gens/test/linux/x86_64/release/nimcache/@mmain.nim.c.o -Lbuild/linux/x86_64/release -s -lfoo -ldl'
### Expected Output
```text
work
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Hello! I'm having similar issue trying to build a static lib in Nim and then use an other Nim script to import the lib. (It's for testing only). I got similar issue and add --passL:-Wl,--allow-multiple-definition to Nim worked for me.
It does not work now.
ld: unknown option: --allow-multiple-definition
clang: error: linker command failed with exit code 1 (use -v to see invocati
on)
Description
I set
--nimMainPrefix:libfoo
, but it still does not work.#19830
xmake-io/xmake#3273
test project: https://github.com/xmake-io/xmake/tree/master/tests/projects/nim/static_library
Nim Version
Nim Compiler Version 1.6.10 [Linux: amd64]
Current Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: