New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nim: broken liblinkage #3273
Comments
This is supposed to be a linking problem with nim in the new version and I don't know how to fix it at the moment. |
My tests with shared library need Library proc foo(n: cint): cint {.cdecl, exportc, dynlib.} = App proc foo(n: cint): cint {.cdecl, importc, dynlib.} = or proc foo(n: cint): cint {.cdecl, importc, dynlib: "path/lib.so"} = make -vD
[ 33%]: linking.release libinteropCpp.so
/usr/bin/nim c -d:release --nimcache:build/.gens/interopCpp/linux/x86_64/release/nimcache --app:lib --noMain --passL:-s -o:build/linux/x86_64/release/libinteropCpp.so src/foo.nim
[ 66%]: linking.release interopCpp_demo
/usr/bin/nim c -d:release --nimcache:build/.gens/interopCpp_demo/linux/x86_64/release/nimcache --passL:-Lbuild/linux/x86_64/release --passL:-s --passL:-linteropCpp -o:build/linux/x86_64/release/interopCpp_demo src/main.nim
build cache stats:
cache directory: build/.build_cache
cache hit rate: 0%
cache hit: 0
cache miss: 0
new cached files: 0
remote cache hit: 0
remote new cached files: 0
preprocess failed: 0
compile fallback count: 0
[100%]: build ok! |
Fix:
Worked for me too!! |
thanks, it works now. |
it works for me, what's problem? |
Shared library in the tests, the application does not need the If you correct this, you can close the issue! |
no dylib in main.nim
https://github.com/xmake-io/xmake/blob/master/tests/projects/nim/shared_library/src/main.nim |
Xmake Version
2.7.5
Operating System Version and Architecture
ArchLinux
Describe Bug
When creating an initial example of a dynamic or static library and trying to run it, an error occurs when linking the library to the executable to be generated.
The purpose of the project was to experiment with C++ interop with nim and later to use c2nim (similar to cxxbridge in rust).
However, this error prevents me from continuing the experiment.
Expected Behavior
Output:
$> xmake run [...] build process... 1
Project Configuration
Structure:
. ├── build │ └── linux │ └── x86_64 │ └── release │ └── libinteropCpp.so ├── src │ ├── foo.nim │ └── main.nim └── xmake.lua
Additional Information and Error Logs
The text was updated successfully, but these errors were encountered: