[petsc-dev] ARG_MAX and linking

Jed Brown jed at jedbrown.org
Tue Feb 6 11:17:20 CST 2018


Oh good.  So maybe this conditional also needs to recognize msys2 so we
can also add this flag for Pierr's msys2 with gcc.

Satish Balay <balay at mcs.anl.gov> writes:

> gmakefile has:
>
> # implies shared libraries with MS compilers
> ifeq ($(SL_LINKER_FUNCTION),-LD)
> $(OBJDIR)/%.o : CCPPFLAGS+=-Dpetsc_EXPORTS
> endif
>
>
> Sure - the comment is misleading - it could be updated to say 'gmakefile' instead of 'CMake'
>
> Satish
>
> On Tue, 6 Feb 2018, Jed Brown wrote:
>
>> If it's a __declspec(dllexport) issue, it's probably just not being
>> handled correctly in petscsys.h.  Actually, it could be this junk which
>> much be obsolete because we don't use CMake to build PETSc and also
>> don't define petsc_EXPORTS.
>> 
>> include/petscsys.h-#if defined(petsc_EXPORTS)      /* CMake defines this when building the shared library */
>> include/petscsys.h:#  define PETSC_VISIBILITY_PUBLIC PETSC_DLLEXPORT
>> include/petscsys.h-#else  /* Win32 users need this to import symbols from petsc.dll */                                                                                                        
>> include/petscsys.h-#  define PETSC_VISIBILITY_PUBLIC PETSC_DLLIMPORT                                                                                                                          
>> include/petscsys.h-#endif                                                            
>> 
>> Pierre Jolivet <pierre.jolivet at enseeiht.fr> writes:
>> 
>> > I’m on master.
>> > Thanks, I think this is the way to go, though I’m now seeing a lot of undefined references, like there http://mingw-users.1079350.n2.nabble.com/imp-prefixes-when-linking-td7386007.html <http://mingw-users.1079350.n2.nabble.com/imp-prefixes-when-linking-td7386007.html>
>> >
>> >> On 6 Feb 2018, at 2:05 PM, Jed Brown <jed at jedbrown.org> wrote:
>> >> 
>> >> What branch are you on?  I wonder if this is exacerbated by Scott's
>> >> "absolute path".  You can configure --with-single-library=0 which will
>> >> link a separate libpetscsys, libpetscvec, etc.
>> >> 
>> >> There are Cygwin recipes in gmakefile that create argument files that
>> >> the linker reads as @args.  We could use $(file > args, $^) to write
>> >> them with arbitrarily long command lines.
>> >> 
>> >> Pierre Jolivet <pierre.jolivet at enseeiht.fr> writes:
>> >> 
>> >>> Hello,
>> >>> I’m trying to compile PETSc with msys2 and MS MPI.
>> >>> Everything works out almost flawlessly, except when linking. Indeed, you generate a nice line of 
>> >>> $ wc /tmp/cl
>> >>>    2  1234 69041 /tmp/cl
>> >>> 69041 characters, but 
>> >>> $ getconf.exe ARG_MAX
>> >>> 32000
>> >>> 
>> >>> Thus, sadly, the make fails with the following error
>> >>> /usr/bin/sh: /mingw64/bin/gcc: Argument list too long
>> >>> 
>> >>> Do you know of a work around? Anyway to link the full library as multiple smaller libraries (I think you did that for some version X.Y with X << 3, didn’t you?)?
>> >>> 
>> >>> Thanks,
>> >>> Pierre
>> 


More information about the petsc-dev mailing list