User forums > Using Code::Blocks

C::B adds options to lib.exe (-r ; ranlib ) that i can not remove.

<< < (3/3)

stahta01:

--- Quote from: BlueHazzard on February 24, 2019, 08:39:20 pm ---I am not sure if i can follow?
The conclusion?:
1) Codeblocks does nothing wrong (but it could be improved see 4) )

--- End quote ---
Yes, that was my conclusion; the root cause is the PGI Compiler has missing path to find the linker used by its ar.exe wrapper program.


--- Quote from: BlueHazzard on February 24, 2019, 08:39:20 pm ---2) There are two programs called link.exe, and if the path is wrong pgfortran will call the wrong program (can we do something against this?)

--- End quote ---
Yes, we could auto detect the correct MS Visual Studio link.exe location and add it to the compiler aux. paths


--- Quote from: BlueHazzard on February 24, 2019, 08:39:20 pm ---3) You can you detect pgfortran is using the wrong path?

--- End quote ---
No, the verbose option list the paths that the PGI compiler tried to use.


--- Quote from: BlueHazzard on February 24, 2019, 08:39:20 pm ---4) Is the output of the command if we add this verbose flag cluttered a lot? Can it be added in the normal compiler options, or has it to be added in the "extended" options?

--- End quote ---
We can remove all the advanced fixed options instead of adding it to the advanced options; this might be best.
Edit: This would allow the user to choose to use PGI ar.exe wrapper, MS link.exe, or MS lib.exe.

stahta01:
Edit3: https://sourceforge.net/p/codeblocks/tickets/803/

I figure out a better patch for the OP issue; this allows the OP fix/change to be easier. And, maintains the default way on Linux and Windows. Edit2: It adds the -v for verbose option to the static link command instead of advanced options on Windows.

Tim S.


--- Code: ---From 8170d22e6ca089e67d25bb56a08ae1ad615e42e2 Mon Sep 17 00:00:00 2001
From: Tim S <tim.stahlhut@gmail.com>
Date: Tue, 26 Feb 2019 22:08:24 -0500
Subject: [PATCH] - compiler: In win32, move ar options to command (Thanks
 stahta01)

And, removed ranlib command
---
 .../resources/compilers/options_pgifortran.xml       | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/plugins/compilergcc/resources/compilers/options_pgifortran.xml b/src/plugins/compilergcc/resources/compilers/options_pgifortran.xml
index 6e428398b..02a755fc2 100644
--- a/src/plugins/compilergcc/resources/compilers/options_pgifortran.xml
+++ b/src/plugins/compilergcc/resources/compilers/options_pgifortran.xml
@@ -5,7 +5,7 @@
         <Program name="C"       value="pgfortran.exe"/>
         <Program name="CPP"     value="pgfortran.exe"/>
         <Program name="LD"      value="pgfortran.exe"/>
-        <Program name="LIB"     value="ar.exe"/>
+        <Program name="LIB"     value="ar.exe -vr"/>
         <Program name="WINDRES" value=""/>
         <Program name="MAKE"    value="make.exe"/>
     </if>
@@ -201,8 +201,14 @@
              value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
     <Command name="LinkDynamic"
              value="$linker -shared $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs"/>
-    <Command name="LinkStatic"
-             value="$lib_linker -r $static_output $link_objects&#xA;&#x9;ranlib $exe_output"/>
+    <if platform="windows">
+      <Command name="LinkStatic"
+               value="$lib_linker $static_output $link_objects"/>
+    </if>
+    <else>
+      <Command name="LinkStatic"
+               value="$lib_linker -r $static_output $link_objects&#xA;&#x9;ranlib $exe_output"/>
+    </else>
     <Command name="LinkNative"
              value="$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs"/>
 
--
2.21.0.windows.1

--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version