← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Recent builds on OSX working?

 

On 05/25/2014 06:44 AM, Bernhard Stegmaier wrote:
> Hi all,
> 
> thanks to your hints I got it compiled and also working again… obviously static building
> really was the culprit.
> However, I still had to change some things, so I would like to share a first set of
> patches that might also be useful to be included.
> 
> 01-OSX-fix-pcbcalculator.diff
> This fixes the build problem reported by Jean-Paul here
>   https://lists.launchpad.net/kicad-developers/msg13354.html
> I am pretty sure that the part I removed is obsolete, because it isn’t there in the other
> applications and the .kiface file is already at the right place.
> 
> 02-OSX-clanguselibcpp.diff
> Not building static anymore I used wxWidgets installed by MacPorts to build against, which
> is built against libc++ on my 10.9.x machine.
> Thus, KiCad also has to be built against libc++ (otherwise it won’t even compile and bail
> out due to wrong includes in some wxWidgets headers).
> This patch introduces a new build option CLANG_USE_LIBCPP to force building against libc++
> on OSX (and also bumps "-mmacosx-version-min” to 10.7 as this is required by the compiler
> for libc++). It would be more nice having automatically detected whether to use libc++ or
> libstdc++ instead of having to specify it, but I didn’t find any easy/smart way how this
> could be done (I guess this doesn’t only affect wxWidgets but maybe also other
> dependencies using libc++/libstdc++). 
> The option defaults to OFF and thus shouldn’t change behavior when not specified.
> Note: I also changed this for all the download_pcre/swig/glew/... cmake files, although I
> think that they are now obsolete anyway when not being able to build statically any more.
> 
> 03-OSX-eeschemainfoplist.diff
> Info.plist of eeschema was not correct (with the effect that it did look bad on my Retina
> display).
> I don’t really know what my changes are doing, but I copied the relevant parts over from
> pcbnew and adapted accordingly so that they are at least similar.
> Now it’s fine again.
> 
> 
> With those patches I get working applications (no really deep tests yet) - but not
> portable with absolute paths to wxWidget libraries.
> Next thing on my list: create portable applications when doing a “make install”.
> 
> 
> Regards,
> Bernhard
> 
> PS: Should the KICAD_BUILD_STATIC option be removed? 


I don't know, it depends, see below.  My comments about avoiding static libraries were
very specific to wxWidgets.  Expanding that umbrella loses the very specific point:
wxWidgets + STATIC is no good.  Typically each library needs a different consideration.

I made a suggestion for the road map that the project get split into two: 1) a CMake
prerequisites project, and 2) a simpler kicad CMake project under the premise that all
prerequisites would be found.  If that gets done, it changes any work in this area
preceding that, i.e. making it a waste of time.


I committed 01 and 03 patches.

02:

a) looked like it was using bad tabbing, spaces of 4 are needed.

b) was beyond my ability to verify its appropriateness.  You probably need to maintain
this as a patch set for awhile until it gets more widely needed, used, and accepted.




> If it doesn’t make sense anymore in
> future, this would probably avoid confusion/problems…
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 24.05.2014, at 16:44, Bernhard Stegmaier <stegmaier@xxxxxxxxxxxxx
> <mailto:stegmaier@xxxxxxxxxxxxx>> wrote:
> 
>> Hi Dick (and others),
>>
>> thanks for the hint, I will try not to use static linking.
>> I did that because in the past dynamic linking didn’t produce portable applications.
>> That is, they contained a reference to the wxWidgets libs at the place when being built
>> and haven’t been copied to the app bundle… and all the usual fix-scripts to copy those
>> libs into the bundle failed for me (problems with the symlinks)… and I didn’t want to
>> fix every path manually.
>>
>> I looked around a bit and found some cmake modules that should be able to produce
>> portable application bundles… I’ll try to add/change that in the cmake files… if I
>> succeed, I will of course propose a patch.
>>
>>
>> Thanks,
>> Bernhard
>>
>> On 24.05.2014, at 04:16, Dick Hollenbeck <dick@xxxxxxxxxxx <mailto:dick@xxxxxxxxxxx>> wrote:
>>
>>> On 05/23/2014 12:31 PM, Jean-Paul Louis wrote:
>>>> Hi Bernhard,
>>>>
>>>> I am attaching my script to this email.
>>>> Some of the stuff in the script might not be needed anymore, but I will clean it up
>>>> when I have time.
>>>>
>>>> After the “make” is finished, I skip the “make install” as it is not yet capable to work.
>>>> So I just copy the bundles (*.app) to "/Applications/kicad” (see towards the end of
>>>> the script).
>>>>
>>>> Thanks to the help of Marco, Adam and even more so from Dick of the development team,
>>>> I simplified the script so it build to 100%, and Dick modified the Cmake files to
>>>> create the bundles with the kiface files  
>>>> properly copied where they belongs.
>>>> That might by why we have duplicate kiface files (seems to be the cause of the error
>>>> at the end of the “make”.
>>>>
>>>> I will create the files for the ENV variables, and let you know how that works.
>>>>
>>>> Regards,
>>>> Jean-Paul
>>>>
>>>>
>>>> On May 23, 2014, at 10:59 AM, Bernhard Stegmaier stegmaier@xxxxxxxxxxxxx
>>>> <mailto:stegmaier@xxxxxxxxxxxxx> [kicad-users] <kicad-users@xxxxxxxxxxxxxxx
>>>> <mailto:kicad-users@xxxxxxxxxxxxxxx>> wrote:
>>>>
>>>>> Hi Jean-Paul,
>>>>>
>>>>>
>>>>> can you tell me what files have to be copied where?
>>>>> I remember some discussions about copying/linking/whatever .kiface files that on the
>>>>> dev-list, but I didn’t find anything on first glance.
>>>>> And yes, let’s try to fix this…
>>>>>
>>>>> With respect to setting the environment variables I did the following:
>>>>> Using Linux-like ~/.profile, etc. files will set the variables only when launching
>>>>> from command-line… not from the dock/launcher.
>>>>> To set a variable for the launcher I made in 
>>>>> ~/Library/LaunchAgents
>>>>> files named like
>>>>> local.kicad.kisys3dmod.plist
>>>>> which looks like
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
>>>>>    "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
>>>>> <plist version="1.0">
>>>>> <dict>
>>>>>    <key>Label</key>
>>>>>    <string>local.kicad.kisys3dmod</string>
>>>>>    <key>EnableGlobbing</key>
>>>>>    <true/>
>>>>>    <key>ProgramArguments</key>
>>>>>    <array>
>>>>>        <string>launchctl</string>
>>>>>        <string>setenv</string>
>>>>>        <string>KISYS3DMOD</string>
>>>>>        <string>~/10 - Projekte/KiCad/Modules</string>
>>>>>    </array>
>>>>>    <key>RunAtLoad</key>
>>>>>    <true/>
>>>>> </dict>
>>>>> </plist>
>>>>> and in the case sets KISYS3DMOD variable. I did the same for the other variables I
>>>>> need (I didn’t find any solution to set more than one variable in a single file). The
>>>>> files will be loaded automatically on login (as far as I remember) or you can test
>>>>> them with “launchctl load …”. 
>>>>> But caution: those files will only set it for the launcher, not the shell… while
>>>>> searching for that I found some shell scripting that can be added to e.g., .profile
>>>>> reading the values from launched so that you don’t have to maintain it in two places
>>>>> if you need that, but I didn’t need it so I don’t have a link at hand.
>>>>>
>>>>> This solution works well for me both on 10.8 and 10.9.
>>>>>
>>>>> The KiCadOSXBuilder creates a wrapper-script for setting the variables, but I didn’t
>>>>> like that approach, because for me those variables are machine-specific (especially
>>>>> the library stuff). 
>>>>> So, it shouldn’t be hardcoded somewhere in the application bundle, but defined by the
>>>>> machine/account itself.
>>>>>
>>>>>
>>>>> Regards,
>>>>> Bernhard
>>>>>
>>>>> On 23.05.2014, at 16:27, Jean-Paul Louis louijp@xxxxxxxxx <mailto:louijp@xxxxxxxxx>
>>>>> [kicad-users] <kicad-users@xxxxxxxxxxxxxxx <mailto:kicad-users@xxxxxxxxxxxxxxx>> wrote:
>>>>>
>>>>>> Hi Bernhard,
>>>>>>
>>>>>> I use OS X 10.9.2 and I keep trying the most recents BZR. I came to the same
>>>>>> conclusion about some failures due to duplicate work copying files into the OS X
>>>>>> bundles.
>>>>>>
>>>>>> I use a bash script fairly raw to copy the files from the build to the
>>>>>> /Applications/kicad directory.
>>>>>> eeschema sort of work, but cannot find kicad.pro template.
>>>>>> it does complain about a missing power lib twice, then load the project I am working
>>>>>> on as a test case.
>>>>>> When I go to the preferences, nothing is loaded there, except a power lib (the
>>>>>> missing one) that I do not use, and a weird path like /usr/local/share.
>>>>>>
>>>>>> My next task is to figure out how to set the proper shell variables like KISYSMOD,
>>>>>> KIGITHUB, etc..
>>>>>> because they are not set at all in my build.
>>>>>>
>>>>>> If you are interested, we can work together to fix what we can, as I do not get any
>>>>>> help from Marco Serantoni who is supposed to be the Mac OS X guru.
>>>>>>
>>>>>> Regards,
>>>>>> Jean-Paul
>>>>>> AC9GH
>>>>>>
>>>>>> On May 23, 2014, at 7:24 AM, Bernhard Stegmaier stegmaier@xxxxxxxxxxxxx
>>>>>> <mailto:stegmaier@xxxxxxxxxxxxx> [kicad-users] <kicad-users@xxxxxxxxxxxxxxx
>>>>>> <mailto:kicad-users@xxxxxxxxxxxxxxx>> wrote:
>>>>>>
>>>>>>> Hi Mac guys,
>>>>>>>
>>>>>>>
>>>>>>> did anyone succeed to build and run a recent version on OSX (most likely after the
>>>>>>> modular kicad changes)?
>>>>>>>
>>>>>>> I tried to build some versions on both 10.8 and 10.9 machines using different
>>>>>>> versions of XCode during the last 2 weeks, but I didn’t succeed… :(
>>>>>>> Compilation did work smoothly on all machines (configured with
>>>>>>> -DKICAD_BUILD_STATIC=ON and having disabled scripting and github plugin - just as I
>>>>>>> did with all the previous versions I have built) after a small patch of aMakefile
>>>>>>> (see end of the mail, I think this is just a leftover because the file that should
>>>>>>> be copied by that piece of code is already at the right spot…).
>>>>>>> But, all binaries (except kicad) don’t work on any of my machines. 
>>>>>>>
>>>>>>> They start and immediately crash with a backtrace like this:
>>>>>>> <<<
>>>>>>> Exception Type:  EXC_CRASH (SIGABRT)
>>>>>>> Exception Codes: 0x0000000000000000, 0x0000000000000000
>>>>>>>
>>>>>>> Application Specific Information:
>>>>>>> abort() called
>>>>>>> *** error for object 0x108e2c0f0: pointer being freed was not allocated
>>>>>>>
>>>>>>>
>>>>>>> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
>>>>>>> 0   libsystem_kernel.dylib        0x00007fff8ae51866 __pthread_kill + 10
>>>>>>> 1   libsystem_pthread.dylib       0x00007fff8dbd435c pthread_kill + 92
>>>>>>> 2   libsystem_c.dylib             0x00007fff8e2c8b1a abort + 125
>>>>>>> 3   libsystem_malloc.dylib        0x00007fff91e2b07f free + 411
>>>>>>> 4   org.kicad-eda.pcbnew          0x0000000100008c3e
>>>>>>> wxScopedCharTypeBuffer<char>::DecRef() + 62
>>>>>>> 5   org.kicad-eda.pcbnew          0x00000001000bbff7
>>>>>>> wxScopedCharTypeBuffer<char>::MakeOwnedCopyOf(wxScopedCharTypeBuffer<char> const&) + 31
>>>>>>> 6   _pcbnew.kiface                0x00000001082f2275
>>>>>>> wxMessageOutputStderr::Output(wxString const&) + 97
>>>>>>> 7   _pcbnew.kiface                0x00000001081ef968 ShowAssertDialog(wxString
>>>>>>> const&, int, wxString const&, wxString const&, wxString const&, wxAppTraits*) + 664
>>>>>>> 8   _pcbnew.kiface                0x00000001081ee6cc
>>>>>>> wxDefaultAssertHandler(wxString const&, int, wxString const&, wxString const&,
>>>>>>> wxString const&) + 188
>>>>>>> 9   _pcbnew.kiface                0x00000001081eec5f wxOnAssert(char const*, int,
>>>>>>> char const*, char const*, wchar_t const*) + 127
>>>>>>> 10  _pcbnew.kiface                0x0000000108278d60 wxStandardPathsBase::Get() + 80
>>>
>>>
>>>
>>> Why is this stack trace point showing that function wxStandardPathBase::Get() is in the
>>> module _pcbnew.kiface?
>>>
>>> This might be because you are linking with static wx libraries.  With the advent of
>>> kiface, this can never work again.
>>>
>>> All platforms must link to a shared/dynamic wx library set.  No static wxWidgets library
>>> set ever again please.
>>>
>>> Start there.  Its possible that wxTheApp is not unique. You have a second copy because you
>>> are linking wx into every frickin module.
>>>
>>> As to the ::Get() call, here is the source from svn head of wx:
>>>
>>> line 59 or so of common/stdpbase.cpp:
>>>
>>> wxStandardPaths& wxStandardPathsBase::Get()
>>> {
>>>    wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
>>>    wxCHECK_MSG( traits, gs_stdPaths, wxT("create wxApp before calling this") );
>>>
>>>    return traits->GetStandardPaths();
>>> }
>>>
>>>
>>> But we only want this to reside in the wx SHARED/DYNAMIC library, not in our
>>> _pcbnew.kiface module.
>>>
>>>
>>>
>>>>>>> 11  _pcbnew.kiface                0x0000000108242677
>>>>>>> wxFileConfig::GetLocalFile(wxString const&, int) + 27
>>>>>>> 12  _pcbnew.kiface                0x00000001082429ad
>>>>>>> wxFileConfig::wxFileConfig(wxString const&, wxString const&, wxString const&,
>>>>>>> wxString const&, long, wxMBConv const&) + 497
>>>>>>> 13  _pcbnew.kiface                0x0000000107e20845 BIN_MOD::Init() + 229
>>>>>>> 14  _pcbnew.kiface                0x0000000107e686d7 KIFACE_I::start_common(int) + 39
>>>>>>> 15  _pcbnew.kiface                0x00000001079141c5
>>>>>>> PCB::IFACE::OnKifaceStart(PGM_BASE*, int) + 21
>>>>>>> 16  org.kicad-eda.pcbnew          0x0000000100022609 KIWAY::KiFACE(KIWAY::FACE_T,
>>>>>>> bool) + 441
>>>>>>> 17  org.kicad-eda.pcbnew          0x0000000100022ca5 KIWAY::Player(FRAME_T, bool) + 309
>>>>>>> 18  org.kicad-eda.pcbnew          0x0000000100006144
>>>>>>> PGM_SINGLE_TOP::OnPgmInit(wxApp*) + 1428
>>>>>>> 19  org.kicad-eda.pcbnew          0x0000000100009bed APP_SINGLE_TOP::OnInit() + 45
>>>>>>> 20  org.kicad-eda.pcbnew          0x000000010007912c wxApp::CallOnInit() + 78
>>>>>>> 21  org.kicad-eda.pcbnew          0x0000000100292f3c wxEntry(int&, wchar_t**) + 76
>>>>>>> 22  org.kicad-eda.pcbnew          0x0000000100005b20 main + 48
>>>>>>> 23  org.kicad-eda.pcbnew          0x0000000100005ab4 start + 52
>>>>>>>>>>
>>>>>>> and messages on console like
>>>>>>> <<<
>>>>>>> objc[17580]: Class wxNSAnimationDelegate is implemented in both
>>>>>>> /Volumes/MacStorage/Temp/KiCad/bin/bin/pcbnew.app/Contents/MacOS/pcbnew and
>>>>>>> /Volumes/MacStorage/Temp/KiCad/bin/bin/pcbnew.app/Contents/MacOS/_pcbnew.kiface.
>>>>>>> One of the two will be used. Which one is undefined.
>>>>>>> ./src/common/stdpbase.cpp(62): assert "traits" failed in Get(): create wxApp before
>>>>>>> calling this
>>>>>>>>>>
>>>>>>> After googling a bit at least the messages on console seem to indicate that some
>>>>>>> wxWidgets functions are used before the wxApp is instantiated.
>>>>>>>
>>>>>>> The problem might already be known, I found this comment in the code, but one line
>>>>>>> below where it crashes for me.
>>>>>>> <<<
>>>>>>>   m_bm.Init();
>>>>>>>
>>>>>>>   m_bm.m_config->Read( showPageLimitsKey, &g_ShowPageLimits );
>>>>>>>
>>>>>>>   // FIXME OSX Mountain Lion (10.8)
>>>>>>>   // Seems that Read doesn't found anything and ColorFromInt
>>>>>>>   // Asserts - I'm unable to reproduce on 10.7
>>>>>>>
>>>>>>>   int draw_bg_color = BLACK;      // Default for all apps but Eeschema
>>>>>>>>>>
>>>>>>>
>>>>>>> Any hints/ideas?
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>> Bernhard
>>>>>>>
>>>>>>> === modified file 'pcb_calculator/CMakeLists.txt'
>>>>>>> --- pcb_calculator/CMakeLists.txt2014-05-12 15:17:51 +0000
>>>>>>> +++ pcb_calculator/CMakeLists.txt2014-05-16 09:00:42 +0000
>>>>>>> @@ -134,15 +134,6 @@
>>>>>>>           )
>>>>>>>   endif()
>>>>>>>
>>>>>>> -    if( APPLE )
>>>>>>> -        # copies kiface into the bundle
>>>>>>> -        add_custom_target( _pcb_calculator_kiface_copy ALL
>>>>>>> -            COMMAND ${CMAKE_COMMAND} -E copy
>>>>>>> ${CMAKE_BINARY_DIR}/pcb_calculator/_pcb_calculator.kiface
>>>>>>> "${CMAKE_BINARY_DIR}/pcb_calculator/pcb_calculator.app/Contents/MacOS/"
>>>>>>> -            DEPENDS pcb_calculator_kiface
>>>>>>> -            COMMENT "Copying kiface into pcb_calculator"
>>>>>>> -        )
>>>>>>> -    endif()
>>>>>>> -
>>>>>>> else()
>>>>>>>
>>>>>>>   add_executable( pcb_calculator WIN32 MACOSX_BUNDLE
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------
>>>>>>
>>>>>> ------------------------------------
>>>>>>
>>>>>> Please read the Kicad FAQ in the group files section before posting your question.
>>>>>> Please post your bug reports here. They will be picked up by the creator of Kicad.
>>>>>> Please visit http://www.kicadlib.org <http://www.kicadlib.org/> for details of how
>>>>>> to contribute your symbols/modules to the kicad library.
>>>>>> For building Kicad from source and other development questions visit the kicad-devel
>>>>>> group athttp://groups.yahoo.com/group/kicad-develYahoo Groups Links
>>>>>>
>>>>>> <*> To visit your group on the web, go to:
>>>>>>   http://groups.yahoo.com/group/kicad-users/
>>>>>>
>>>>>> <*> Your email settings:
>>>>>>   Individual Email | Traditional
>>>>>>
>>>>>> <*> To change settings online go to:
>>>>>>   http://groups.yahoo.com/group/kicad-users/join
>>>>>>   (Yahoo! ID required)
>>>>>>
>>>>>> <*> To change settings via email:
>>>>>>   kicad-users-digest@xxxxxxxxxxxxxxx <mailto:kicad-users-digest@xxxxxxxxxxxxxxx> 
>>>>>>   kicad-users-fullfeatured@xxxxxxxxxxxxxxx
>>>>>> <mailto:kicad-users-fullfeatured@xxxxxxxxxxxxxxx>
>>>>>>
>>>>>> <*> To unsubscribe from this group, send an email to:
>>>>>>   kicad-users-unsubscribe@xxxxxxxxxxxxxxx
>>>>>> <mailto:kicad-users-unsubscribe@xxxxxxxxxxxxxxx>
>>>>>>
>>>>>> <*> Your use of Yahoo Groups is subject to:
>>>>>>   https://info.yahoo.com/legal/us/yahoo/utos/terms/
>>>>>
>>>>>
>>>>> __._,_.___
>>>>> Posted by: Bernhard Stegmaier <stegmaier@xxxxxxxxxxxxx <mailto:stegmaier@xxxxxxxxxxxxx>>
>>>>> Reply via web post•Reply to sender•Reply to group•Start a New Topic•Messages in this
>>>>> topic (3)
>>>>> Please read the Kicad FAQ in the group files section before posting your question.
>>>>> Please post your bug reports here. They will be picked up by the creator of Kicad.
>>>>> Please visit http://www.kicadlib.org <http://www.kicadlib.org/> for details of how to
>>>>> contribute your symbols/modules to the kicad library.
>>>>> For building Kicad from source and other development questions visit the kicad-devel
>>>>> group athttp://groups.yahoo.com/group/kicad-devel
>>>>> VISIT YOUR GROUP 
>>>>> • New Members 14 
>>>>> • New Photos 3
>>>>>
>>>>> • Privacy • Unsubscribe • Terms of Use
>>>>>
>>>>> .
>>>>>
>>>>>
>>>>> __,_._,___
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 



References