[petsc-dev] ARG_MAX and linking

Jed Brown jed at jedbrown.org
Tue Feb 6 16:30:33 CST 2018


If it's the error I'm guessing you have, then we just need petsc_EXPORTS
to be defined when building the library.  The current logic, I think,
only does that for the MS compiler.

Pierre Jolivet <pierre.jolivet at enseeiht.fr> writes:

> I tried to comment out the lines you pointed out, but the builds error out.
> Was I supposed to do something else?
>
>> On 6 Feb 2018, at 3:47 PM, Jed Brown <jed at jedbrown.org> 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