User forums > Using Code::Blocks
C::B adds options to lib.exe (-r ; ranlib ) that i can not remove.
BDick:
I want to make a static library for windows with the PGI compiler. Compiling and linking of executables with pgfortran works fine, but the built of the library fails. In "settings" the toolchain is set so that "C-compiler", "C++ compiler", and "linker for dynamic libs" all point to pgfortran.exe, and "linker for static libs" points to the lib.exe from Microsoft.
The correct call should be: lib.exe name.o
and generates name.lib
I test this in a command shell.
However, C::B issues the command: lib.exe -r name.a name.o ranlib name.a
How can I tell C::B to omit "-r name.a" and "ranlib name.a"? In the varous dialog boxes I can ADD more options, but I can apparently not REMOVE those superfluous ones.
best regards,
Bernhard
stahta01:
Copy a compiler then edit the advanced compiler options.
This is what Command: Link Object files to static library shows for "PGI Fortran Compiler"
--- Code: ---$lib_linker -r $static_output $link_objects
ranlib $exe_output
--- End code ---
Tab: Other Settings Button: Advanced Options
BDick:
Thank you very much, with your help I could solve the problem (so I think). In case somebody has a similar problem, here is what I did:
There are two versions of the file "options_pgifortran.xml" on the computer:
one here: C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\compilers
the second here: C:\Users\dib05004\AppData\Roaming\CodeBlocks\share\codeblocks\compilers
only changes to the second (after making a backup copy) seems necessary.
I changed:
<Program name="LIB" value="C:\Program Files\PGICE\win64\18.4\bin\ar.exe"/>
<Switch name="libExtension" value="a"/>
<Command name="LinkStatic" value="$lib_linker -r $static_output $link_objects
	ranlib $exe_output"/>
into:
<Program name="LIB" value="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\lib.exe"/>
<Switch name="libExtension" value="lib"/>
<Command name="LinkStatic" value="$lib_linker $link_objects $libs /OUT:$exe_output"/>
The first change points to the library manager of Microsoft for x64 host and x64 code. The third invoces this with the correct option for setting the output file name. I found the second change necessary, since otherwise the library gets the extension "a", regardless of what one sets in the "Project Properties -> target" dialog.
Hence, many thanks!
Miguel Gimenez:
Thank you for the information, but direct editing of the XML files is not a good idea; Using the Global Compiler Settings is a lot easier and less prone to errors.
oBFusCATed:
If the default settings are wrong you should provide a patch, so it would work fine by default.
@darmar: Do you know if this is something we need to fix?
Navigation
[0] Message Index
[#] Next page
Go to full version