
3 Jan
2017
3 Jan
'17
8:37 p.m.
Fix tested successfully by Eduard (and I checked that it does not break things on linux), so I pushed it.
Thanks! Trunk should now build on Windows!
--
Mc
On 01/03/2017 02:15 AM, Yale Zhang wrote:
> Sorry, my suggested patch doesn't work for Mingw builds. This one does
> work (link internal, static inkscape libs as PRIVATE and external libs
> as PUBLIC)
>
> --- src/CMakeLists.txt 2016-10-22 22:11:58 +0000
> +++ src/CMakeLists.txt 2017-01-03 01:11:38 +0000
> @@ -521,7 +521,6 @@
> depixelize_LIB
> util_LIB
> gc_LIB
> - ${INKSCAPE_LIBS}
> )
>
> # Build everything except main and inkview.c in a shared library.
> @@ -534,7 +533,7 @@
> endif()
>
> # Link the inkscape_base library against all external dependencies
> -target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS})
> +target_link_libraries(inkscape_base PRIVATE ${INKSCAPE_TARGET_LIBS}
> PUBLIC ${INKSCAPE_LIBS})
>
> # Link inkscape and inkview against inkscape_base
> target_link_libraries(inkscape inkscape_base)
>
> On Mon, Jan 2, 2017 at 3:28 PM, Yale Zhang <yzhang1985@...400...> wrote:
>> I build for both GNU/Linux and Windows and get the multiple definition
>> error only for Windows. The problem is the libgc wrapper, libgc_LIB.a
>> is first baked into libinkscape, but then linked again with the
>> inkscape/inkview EXE.
>>
>> I just edited linklibs.rsp to not link again with libgc_LIB. Now that
>> I see I'm not the only one with the problem, I took a look at the
>> CMakeFile and spotted the problem.
>>
>> It seems to keep things simple, libinkscape is linked to *every*
>> library and the EXEs will indirectly be linked to them via
>> libinkscape.
>>
>> This in theory should work if all libraries are shared DLLs, but
>> libinkscape is static. By default, target_link_libraries() propagate
>> the dependencies of libinkscape to inkscape/inkview. I don't think
>> this is a sound practice.
>>
>> So to fix it, you need to tell it not to propagate by adding PRIVATE.
>> Then, you need to link the external libs, ${INKSCAPE_LIBS}, with the
>> EXEs instead of libinkscape.
>>
>> I tested and it works. Someone please check it in.
>>
>> --- src/CMakeLists.txt 2016-10-22 22:11:58 +0000
>> +++ src/CMakeLists.txt 2017-01-02 20:07:57 +0000
>> @@ -521,7 +521,6 @@
>> depixelize_LIB
>> util_LIB
>> gc_LIB
>> - ${INKSCAPE_LIBS}
>> )
>>
>> # Build everything except main and inkview.c in a shared library.
>> @@ -534,11 +533,11 @@
>> endif()
>>
>> # Link the inkscape_base library against all external dependencies
>> -target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS})
>> +target_link_libraries(inkscape_base PRIVATE ${INKSCAPE_TARGET_LIBS})
>>
>> # Link inkscape and inkview against inkscape_base
>> -target_link_libraries(inkscape inkscape_base)
>> -target_link_libraries(inkview inkscape_base)
>> +target_link_libraries(inkscape inkscape_base ${INKSCAPE_LIBS})
>> +target_link_libraries(inkview inkscape_base ${INKSCAPE_LIBS})
>>
>> if(NOT WIN32)
>> #Define the installation
>>
>> On Mon, Jan 2, 2017 at 11:09 AM, Eduard Braun <Eduard.Braun2@...173...> wrote:
>>> Hi Alvin,
>>>
>>> this is a known issue with compiling Inkscape trunk, see bug #1645062
>>> [1] (0.92 branch is not affected).
>>>
>>> I'm afraid nobody has figured it out, yet, but I'm hoping somebody here
>>> on the mailing list can point us to what's going wrong...
>>>
>>> Best Regards,
>>> Eduard
>>>
>>> [1] https://bugs.launchpad.net/inkscape/+bug/1645062
>>>
>>>
>>> Am 02.01.2017 um 16:01 schrieb alvinpenner:
>>>> this is my first attempt to compile a 64 bit version of Inkscape. Previously
>>>> I had done a 32 bit version on Windows XP using cmake.
>>>>
>>>> - running cmake version 3.7.1 32-bit version
>>>> - devlibs64 uptodate
>>>> - mingw64 from the file x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z
>>>> - the compile step appeared to be successful until the very end...
>>>> the output is:
>>>>
>>>> C:\Users\penne_000\AppData\Roaming\InkscapeBZR\build>mingw32-make -j 2
>>>> [ 1%] Built target vpsc_LIB
>>>> revision is 15382
>>>> [ 1%] Built target inkscape_version
>>>> [ 2%] Built target util_LIB
>>>> [ 2%] Built target gc_LIB
>>>> [ 2%] Built target cola_LIB
>>>> [ 4%] Built target avoid_LIB
>>>>
>>>> ...
>>>>
>>>> [ 26%] Built target pofiles_90
>>>> [ 26%] Built target filters_svg_h
>>>> [ 26%] Built target palettes_h
>>>> [ 26%] Built target patterns_svg_h
>>>> [ 27%] Built target symbols_h
>>>> [ 27%] Built target templates_h
>>>> [ 99%] Built target inkscape_base
>>>> [ 99%] Built target inkview
>>>> [100%] Linking CXX executable ..\bin\inkscape.exe
>>>> ../lib/libgc_LIB.a(gc.cpp.obj):gc.cpp:(.text+0x4f0): multiple definition of
>>>> `Inkscape::GC::Core::init()'
>>>> ../lib/libinkscape_base.dll.a(d010885.o):(.text+0x0): first defined here
>>>> collect2.exe: error: ld returned 1 exit status
>>>> src\CMakeFiles\inkscape.dir\build.make:201: recipe for target
>>>> 'bin/inkscape.exe' failed
>>>> mingw32-make[2]: *** [bin/inkscape.exe] Error 1
>>>> CMakeFiles\Makefile2:421: recipe for target
>>>> 'src/CMakeFiles/inkscape.dir/all' failed
>>>> mingw32-make[1]: *** [src/CMakeFiles/inkscape.dir/all] Error 2
>>>> mingw32-make[1]: *** Waiting for unfinished jobs....
>>>> [100%] Built target grid2
>>>> Makefile:126: recipe for target 'all' failed
>>>> mingw32-make: *** [all] Error 2
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context: http://inkscape.13.x6.nabble.com/compile-error-on-Windows-10-Inkscape-rev-15...
>>>> Sent from the Inkscape - Dev mailing list archive at Nabble.com.
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>>>> _______________________________________________
>>>> Inkscape-devel mailing list
>>>> Inkscape-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/inkscape-devel
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Inkscape-devel mailing list
>>> Inkscape-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/inkscape-devel
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Inkscape-devel mailing list
> Inkscape-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/inkscape-devel
>