Skip to content
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

Fix #16937; --clib option pass library name to backend C compiler correctly #19754

Merged
merged 5 commits into from
Sep 1, 2022

Conversation

demotomohiro
Copy link
Contributor

No description provided.

@Varriount
Copy link
Contributor

Can you give a description of what the previous behavior was, why it was incorrect, and what the new behavior is?

@demotomohiro
Copy link
Contributor Author

Previous behavior convert a --clib parameter to full path and pass it to backend C compiler.
It doesn't work when you want to link C libraries in system library directories.

For example:

$ nim c --clib:my_c_lib --listcmd test.nim

Hint: gcc   -o /tmp/tmphjk/testnim/test  /tmp/nimcache/d/test/stdlib_digitsutils.nim.c.o /tmp/nimcache/d/test/stdlib_dollars.nim.c.o /tmp/ni
mcache/d/test/stdlib_io.nim.c.o /tmp/nimcache/d/test/stdlib_system.nim.c.o /tmp/nimcache/d/test/@mtest.nim.c.o    -l/tmp/tmphjk/testnim/my_c
_lib -ldl [Link]

In this example, my_c_lib was convert to /tmp/tmphjk/testnim/my_c_lib.

This PR doesn't convert --clib parameter to full path before passing it to backend C compiler.
So nim c --clib:my_c_lib --listcmd test.nim passes -lmy_c_lib to backend C compiler at link time.

@Varriount Varriount added the merge_when_passes_CI mergeable once green label Sep 1, 2022
@Varriount Varriount merged commit 2a34d14 into nim-lang:devel Sep 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2022

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 2a34d14

Hint: mm: orc; threads: on; opt: speed; options: -d:release
163966 lines; 12.802s; 842.184MiB peakmem

capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
…iler correctly (nim-lang#19754)

* Fix 16937: Make --clib option works

* Make tests/compiler/tcmdlineclib.nim works from any current dir

* Try to fix link error on macosx

* Add a comment to tests/compiler/tcmdlineclib.nims

Co-authored-by: Clay Sweetser <[email protected]>
narimiran pushed a commit that referenced this pull request Apr 24, 2023
…rectly (#19754)

* Fix 16937: Make --clib option works

* Make tests/compiler/tcmdlineclib.nim works from any current dir

* Try to fix link error on macosx

* Add a comment to tests/compiler/tcmdlineclib.nims

Co-authored-by: Clay Sweetser <[email protected]>
(cherry picked from commit 2a34d14)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge_when_passes_CI mergeable once green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants