Perl 6 - the future is here, just unevenly distributed

IRC log for #native, 2017-01-04

| Channels | #native index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
02:09 willthechill joined #native
02:11 willthechill hello everyone, I'm looking to build Alien::astyle in the similar style to Alien::bison (I think)
02:11 willthechill basically I need to have RPerl be able to soft-require the command line utility `astyle` which will possibly need to be built from source
02:12 willthechill is there a recipe or specific section of docs I can find, or any other guidance?
02:12 willthechill I'm looking at the Alien::bison source code but it seems to be confusing and/or auto-generated
02:12 plicease astle is a command or a library generally?
02:12 willthechill astyle is a command
02:12 willthechill it can be made into a library but that is not my usage case at this time
02:12 willthechill I am using it solely as a command
02:12 willthechill a command-line utility in the form of an executable binary file
02:15 plicease so AB has historically been geared toward autoconf style libraries, but with Alien::bison and Alien::flex and some others I've adapted them to work with commands
02:16 willthechill yeah I noted the Alien docs specifically state "libraries" not "executables"
02:16 willthechill but if it works for bison it should work for astyle?
02:16 plicease yup I would expect.
02:16 plicease you want to subclass Alien::Base::ModuleBuild
02:17 plicease implement your own alien_check_installed_version which detects if the command is already installed
02:17 willthechill okay so with Alien::bison I know you are doing at least 1 special thing, which is applying a source code patch
02:17 willthechill and currently I do not need to do that
02:19 plicease Alien::m4 is a simpiler example to follow possibly?
02:19 willthechill ah okay great, I will definitely look at Alien::m4!
02:19 willthechill gotta run for now, be back later!  :-)
02:20 plicease sure np.
02:23 plicease I should probably write a FAQ on this sort of usage now that I think of it.
03:24 mib_u38syi joined #native
03:25 dcmertens plicease, you should delegate that to jberger. :-p
03:48 willthechill yes this is likely a good use case for the docs  :-)
03:48 willthechill I haven't dug into Alien::m4 yet, will do so shortly (hopefully!)
03:50 plicease I think you will want to subclass AB::ModuleBuild and implement alien_check_installed_version and alien_check_built_version
03:51 plicease https://metacpan.org/pod/Alien::Base::ModuleBuild#alien_check_installed_version
03:51 plicease https://metacpan.org/pod/Alien::Base::ModuleBuild#alien_check_built_version
03:51 plicease provide a little context on what the My::ModuleBuild in Alien::m4 is doing hopefully.
04:36 willthechill plicease: okay I have a vague idea of what you're telling me so far, I looked at the Alien::m4 source code, the m4.pm file contains no significant code, so am I correct in assuming that only the Build.PL and ModuleBuild.pm contain significant code?
04:39 willthechill also, Build.PL says "This file was automatically generated by Dist::Zilla::Plugin::Alien" so does that mean there IS an automatic code generation step somewhere that I'm currently not aware of?
04:47 jberger dcmertens makes one comment on irc in like 6 years and its too give me more work?!!
04:48 jberger s/too/to/
04:49 jberger willthechill I'm not as familiar with executables using AB but for I'm assuming it is mostly the same as libraries
04:50 jberger The idea is that a typical Alien module is almost entirely configuration
04:50 jberger And at build time it notices if the system provides the library already or not
04:51 jberger If so a new very thin config file is generated and the base class uses that to load the library on demand
04:52 jberger If not available the configuration is used to fetch and build the library and it is stored in a perl only directory for use later
04:52 willthechill okay
04:53 jberger At which point a similar thin configuration file is written with those locations and the base class .... blah blah
04:53 jberger So i assume that for an executable it is similar
04:53 jberger But plicease is the point person on that
04:56 willthechill dcmertens: I just found your C::Blocks code, looks interesting (and similar to Inline::C), thanks for the free advertising, haha!
04:56 willthechill "If you're just looking to write fast code with compact data structures, http://rperl.org/ may be just the ticket. It produces highly optmized code from a subset of the Perl language itself."
04:57 willthechill jberger: yeah I'm just waiting to hear back from him plicease about my 2 questions above
04:57 willthechill maybe you can answer my question about Build.PL?
04:58 willthechill Build.PL says it was auto-generated by Dist::Zilla::Plugin::Alien, what's that about?
05:04 jberger There is a dzil plugin that can build the Build.PL
05:04 jberger I'm not a fan of dzil myself
05:05 jberger I write my own Build.PL, it really isn't hard
05:05 jberger https://metacpan.org/source/JBERGER/Alien-GSL-1.00/Build.PL
05:06 jberger https://metacpan.org/source/JBERGER/Alien-GSL-1.00/Build.PL
05:06 jberger https://metacpan.org/source/JBERGER/Alien-GSL-1.00/Build.PL
05:07 jberger Ummm
05:07 jberger https://metacpan.org/source/JBERGER/Alien-GSL-1.00/Build.PL
05:07 jberger Link https://metacpan.org/source/JBERGER/Alien-GSL-1.00/Build.PL
05:07 jberger Wow, sorry
05:07 jberger My client really hiccuped there
05:10 willthechill haha wow okay then
05:10 willthechill so it is okay to write our own Build.PL by hand?
05:10 jberger Yeah
05:11 willthechill okay great
05:11 jberger (My client wasn't echoing lines with urls in them)
05:11 willthechill oh I see, yeah you pasted the same URL 5 times LOL
05:11 jberger When it finally didn't with the word link, i finally refreshed everything
05:12 willthechill huh weird
05:12 willthechill okay so I don't need to use any auto-generated code mechanisms here?
05:12 willthechill just write my own Build.PL and also write my own ModuleBuild.pm and that's pretty much it?
05:13 jberger I use an in browser client that just hit totally rewritten, I think I found a bug ;p (doesn't usually happen, this was very recurring suddenly)
05:14 jberger For a gnu style library you only need Build.PL and a tiny Alien:: subclass (entirely copy paste)
05:14 jberger See that dist i linked you to (so many times ;p)
05:15 jberger It isn't code generation at all, the base class has all the functionally
05:16 jberger All that gets generated is a file containing the build paths etc
05:16 jberger Though remember that all my knowledge is for libraries not executables
05:18 willthechill okay gotcha, thanks  :-)
12:13 dcmertens willthechill, Alien::TinyCCx installs the tcc libraries, and the tcc executable
12:14 dcmertens the Alien module itself actually messes with @PATH to make sure tcc's arcane location is visible
12:14 dcmertens (Alien::TinyCC does the same thing, but it's been a while since I worked on that one)
12:14 dcmertens All of that code is hand-written, not generated
12:15 dcmertens That having been said, I would be plicease would have better advice about how to do this stuff
12:15 dcmertens willthechill, I'm happy to point out rperl for others to see
12:15 dcmertens it's a nice bit of work. :-)
12:16 plicease You don't need to use dzil to use Alien::Base.
12:18 plicease The advantage of the Alien dzil plugin is that it notes which AB features you are using and makes sure that the correct version of AB and AB::MB are prereqs for you.
12:19 plicease But if you aren't using dzil already I don't recommend using it just for this.
12:19 plicease You will want to take note of the features you are using here: https://metacpan.org/pod/Alien::Base::ModuleBuild::API
12:20 plicease each item has a version number, just make sure you are using the correct prereqs and you do not need a code generator.
13:33 plicease dcmertens: is there a reason to use Alien::TinyCC over Alien::TinyCCx?  I have a module using the former, because when I wrote it there wasn't a latter
13:40 dcmertens plicease, FFI::TinyCC should use Alien::TinyCC
13:40 dcmertens Alien::TinyCCx is my distribution channel for my fork of tcc
13:41 dcmertens which includes extended symbol table support
13:41 dcmertens The two alien distributions are nearly identical, and I plan on eventually combining them into a single git repo with different branches
13:41 dcmertens Alien::TinyCC is based on a version of tcc that is a couple of years old
13:41 dcmertens (but still newer than the latest release)
13:42 dcmertens In short: expect an update to Alien::TinyCC in the next month or two
13:42 dcmertens :-)
13:42 plicease cool.  Glad that it is still supported
13:42 plicease All the different tcc forks are a little hard to follow.
13:43 * dcmertens is confused
13:43 dcmertens how many forks are there?
13:43 dcmertens I actually don't know of any other substantive forks of the project
13:43 dcmertens To be fair, I've not spent time digging
13:44 plicease I had trouble finding a suitable upstream some years back it seemed like there were a few
13:45 plicease but I could have mistaken what I was seeing
13:45 plicease either way I am happy for someone else to be providing an Alien::TinyCC for me to use :)
13:45 dcmertens Hmm, well, there are some very old links. The official repo is here: http://repo.or.cz/tinycc.git
13:46 plicease thanks I will make a note of it.
13:50 dcmertens Unfortunately, this (http://bellard.org/tcc/) is probably where most people land, and that's got a lot of outdated junk
13:54 plicease That is definitely one that I saw.
13:54 plicease I mean the main one.
15:58 willthechill sorry I was gone, I'm back now, will read backlog, thanks!  :-)
17:46 plicease willthechill: I think the most complicated thing that Alien::m4 does is it rejects certain versions which are known to cause autoconf problems.
17:46 plicease So if you don't care which version yours could be much simpler.
17:47 plicease I am thinking of rebooting Alien::Builder as Alien::Build using lessons learned from the former and Alien::pkgconf
18:18 willthechill plicease: actually I will probably want to check for a minimum version number
18:20 willthechill also, what are the pros/cons of using Alien::astyle to build astyle, versus pre-packaging a pre-compiled elf binary and a windows binary of astyle?
18:22 plicease main con against binaries is that they aren't portable.
18:23 willthechill possible work flow...  1. check if min version of astyle is already available;  2. if not, check if pre-compiled binary can execute on target OS;  3. if not, see if Alien::astyle can build on target OS;  4. if not, emit warning and disable components which utilize astyle
18:23 plicease I don't see any problem with that.
18:23 plicease only con there is the space taken up by the binaries.
18:24 willthechill somebody told me that statically-linked elf binaries run on most non-Windows platforms?
18:25 willthechill hmm yes the dynamically-linked astyle elf binary is nearly 350K, obviously will be larger for static
18:26 willthechill I can put the big binaries somewhere to be downloaded only when needed...
18:26 plicease Yeah that too
18:27 willthechill any opinions on the static-elf-binaries-run-almost-everywhere idea?
18:28 plicease I know on FreeBSD you can run linux binaries if you have the linux compability package installed
18:29 plicease I don't think it is generally true.
18:29 plicease In the very least you need binaries of the right CPU
18:30 willthechill 386 or 486 compile mode for wide CPU compatibility?
18:31 plicease I am thinking more like Arm, Intel, PPC, Sparc, etc
18:32 willthechill oh right!  duh
18:32 willthechill yeah that's an issue
18:32 willthechill hmmm okay
18:33 willthechill also, I'm thinking of somehow renaming my copy as `astyle.rperl` so as not to conflict with possible system-wide installs of `astyle`
18:33 willthechill always trying to protect RPerl users who need or want to install in single-user mode (not system-wide install)
18:34 plicease so AB will install the binariy in a location that doesn't conflict with the system version
18:34 plicease if available.
18:34 plicease and you need to actively request it through the Alien::astyle module.
18:34 plicease the philosophy of AB is not to tamper with the system libaries or utilities
18:34 willthechill okay good point!  personally I use local::lib and also many people use Perlbrew or even just change their own PERL5LIB & friends env vars
18:35 willthechill so I want to make sure not to somehow break that single-user-install ability
18:36 plicease Right AB takes care of that for you.
18:38 willthechill great; now that I think about it, we almost certainly need to install the `astyle.rperl` binary to the same exact path that the `rperl` executable itself is installed, which is either some seemingly-random system-wide location or is controlled by local::lib's magic env vars
18:39 willthechill for example, local::lib MIGHT somehow automagically choose to install the `rperl` executable into ~/perl5/bin/
18:39 willthechill so then we would also want `astyle.rperl` to go into ~/perl5/bin/ as well
18:40 willthechill thus we keep all the RPerl executables together
18:40 plicease AB doesn't ever install into the PATH ~/perl/bin or otherwise.  It installs into a share directory.  You then use Alien::astyle->bin_dir to get the location and add it to your path as needed.
18:40 willthechill a share directory?
18:40 plicease The idea is not to pollute the uesrs PATH with executables that they didn't ask for.
18:42 plicease its a perl-dist directory where you can store non Perl data
18:42 willthechill okay sorry I must be slow, what is a "perl-dist directory"?
18:42 plicease in the case of AB it is the binaries and libraries built during the install step.
18:42 plicease sorry per-dist
18:42 willthechill oh
18:43 willthechill you mean like ~/.cpanm/work/FOO/  ?
18:44 plicease more like .../lib/perl5/auto/share/dist/Alien-m4
18:44 plicease the mechanism for accessing it is File::ShareDir
18:44 plicease https://metacpan.org/pod/File::ShareDir
18:45 plicease where ../lib/perl5 is whever you've installed the module.
18:45 plicease It might help to try installing Alien::m4 with env ALIEN_INSTALL_TYPE=share
18:46 plicease that will force a build from source (even if m4 is in your PATH)
18:46 plicease then you can call Alien::m4->bin_dir to see where it has been installed
18:49 willthechill okay so again, Alien is or is not aware of local::lib and Perlbrew setting the special perl env vars?
18:49 willthechill because in your example the "..." would be "~/perl5" with local::lib
18:50 willthechill (trying to install Alien::m4 now)
18:50 plicease it is whereever the module gets installed which is decided by the environment variables that you are talking about
18:50 plicease AB doesn't need to be aware because Perl takes care of all that.
18:53 willthechill okay yes I got ~/perl5/lib/perl5/auto/share/dist/Alien-m4/bin
18:53 willthechill and yes I already had m4 installed system-wide in /usr/bin/m4
18:54 plicease So from Perl you can say 'use Env qw( @PATH ); unshift @PATH, Alien::m4->bin_dir'
18:54 plicease and you will get the alienized m4 in your path just for your script
18:55 plicease or the system m4 if the install code detected m4 in the path
18:55 plicease without conflicting with ANY system tools at all
18:55 willthechill cool that's great
18:56 willthechill does any of this relate to Windows at all?
18:56 willthechill should we expect it to work on Windows, etc?
18:56 plicease yup.
18:56 plicease if it isn't then it is a bug you can file it with AB
18:56 plicease https://github.com/Perl5-Alien/Alien-Base/issues
18:57 willthechill okay great
18:57 plicease (assuming the tool itself fundamentally supports windows)
18:57 willthechill yes of course, I may need to fall back on a pre-compiled Windows binary due to the difficulty of compiling in Windows
18:58 willthechill bulk88 and I have already been down the compiling-astyle-in-Windows path a bit
18:58 plicease he is expert in windows
18:58 willthechill not exactly easy or straightforward or something I would expect to work "out of the box" as with Alien, etc.
18:58 plicease does astyle build with autoconf?
18:58 willthechill in other words, it was hard for him to do manually, so probably not gonna work automatically for everyone
18:59 willthechill not sure, it's been a while, have not dived back in to that part just yet
18:59 willthechill although will likely be doing so today'ish!  :-)
19:00 jberger Alien::Base relies on DynaLoader for loading libraries, so it works as well as Perl does for dynamic loading
19:01 jberger actually, Apple was harder than Windows, because Mach binaries are finicky about moving them after they are compiled (who knew?!)
19:02 plicease It looks to me as though astyle does not use autoconf
19:04 plicease may be helpful: https://metacpan.org/pod/Alien::Base::FAQ#vanilla-Makefiles
19:04 willthechill plicease: is that good or bad?
19:04 willthechill helpful is good!
19:04 plicease I've done a lot fo work to get autoconf stuff working on windows because it is hard some of the vanilla makefile stuff might not be as well supported, but I can help when/if you run into problems.
19:05 willthechill well if everyone in the world just had access to the `apt-get` command (or even `choco` for that matter), then none of this would be necessary, haha!  :-P
19:06 plicease i think the problem is that every system has some form of those commands but they are all different
19:12 plicease Alien::apt-get :P
19:12 willthechill LOL yes if only!
19:12 willthechill Alien::linux
19:12 willthechill haha
19:26 jberger Alien::make_this_damn_thing_work
19:30 willthechill LOL exactly
19:57 willthechill hmm okay added complexity, astyle has 4 distributions: linux, mac, windows, windows xp
19:57 willthechill each of those 4 distributions of astyle has multiple makefiles and/or build scripts
19:57 willthechill https://github.com/wbraswell/astyle-mirror/tree/master/astyle_2.06_linux/build
19:58 willthechill https://github.com/wbraswell/astyle-mirror/tree/master/astyle_2.06_macos/build
19:58 willthechill https://github.com/wbraswell/astyle-mirror/tree/master/AStyle_2.06_windows/build
19:58 willthechill https://github.com/wbraswell/astyle-mirror/tree/master/AStyle_2.06_windows_xp/build
20:05 plicease there doesn't appear to be any windows gcc configurations
20:05 plicease that will make building on strawberrry hard.
20:07 plicease which is probably the most common windows/perl environment
20:13 plicease MSYS + strawberry may work with the gcc Makefiles
20:14 plicease I am curious how the clang and gcc makefiles differ they can't be that different
20:14 felliott` joined #native
20:14 plicease or if they are I'd have to wonder why
20:15 plicease anyway, one way to check if you are using gcc or clang is to check $Config{cc}
20:16 plicease I think what you really need is the correct name for the C++ compiler
20:16 plicease ExtUtils::CppGuess will give you that.
20:18 plicease EU::CppGuess clearly needs some love though.
20:18 plicease nevermind.
20:20 willthechill EU::CppGuess is the cause of an ongoing issue which we are not sure how to fix with the absentee maintainers...  :-(
20:20 plicease yeah.
20:21 plicease I opened a ticket two years ago on that dist
20:21 plicease unanswered
20:21 willthechill yeah  :-(
20:21 willthechill I'm starting to put out feelers on how to move forward on that front
20:22 willthechill I put this up for the astyle web docs, the 4 different "install.html" files may help
20:22 willthechill https://wbraswell.github.io/astyle-mirror/
20:27 willthechill I think it is best to rely on pre-compiled binaries for Windows platforms
20:27 willthechill which, if true, leaves us with only mac and linux distros of astyle to actually try and compile via Alien
20:28 plicease makes sense.
20:28 willthechill so looking back at the linux build instructions...   https://wbraswell.github.io/astyle-mirror/astyle_2.06_linux/doc/install.html#_Linux_Version
20:28 plicease If you want to try building from source you can do so with Alien::MSYS
20:28 plicease and the gcc makefiles
20:29 willthechill *nods*  well I won't get too deep on Windows right now since I only have Linux myself...
20:29 willthechill on Linux, astyle provides gcc & clang & intel makefiles
20:29 plicease yeah I would start with the simple stuff like working on Linux first :)
20:29 plicease that is usually where I start.
20:30 plicease Right.  I think you can ignore the intel compiler
20:30 willthechill okay how come?  nobody uses intel compiler?
20:30 plicease I had a lot of trouble getting Perl and Intel C to work
20:30 willthechill ah okay gotcha
20:30 plicease I don't think many people are using it
20:30 plicease for Perl at least.
20:30 willthechill I only know gcc
20:31 plicease It would be nice to check $Config{cc} and if that is 'clang' to use the clang makefile and otherwise use the gcc makefile
20:32 plicease though if you want to keep things real simple you can probably safely assume that g++ is available even if people (like me) are using clang as their C compiler for Perl.
20:33 plicease I bet the clang makefile works for FreeBSD
20:33 plicease and the gcc makefile will work on at least some non Linux platforms where gcc is available
20:34 willthechill hmm so for my first version of Alien::astyle I can just use gcc only and ignore clang and intel?
20:35 plicease so you want to set alien_build_commands => [ "make -C build/$dir" ]
20:35 plicease or better alien_build_commands => [ "$Config{make} -C build/$dir" ]
20:38 plicease I would personally support clang as well.
20:38 plicease on os x 'gcc' is actually clang
20:38 plicease on freebsd gcc has been replaced by clang and there is no 'gcc'
20:39 plicease but it is up to you.
20:40 willthechill hmm okay interesting
20:40 willthechill gotta run for now, will pick up where we left off later tonight, thanks!  :-)
20:40 plicease np
21:15 plicease I am contemplating submitting an Alien ecosystem talk for YAPC this year
21:16 plicease is anyone here going to be at YAPC?
21:17 jberger I should be
21:17 jberger I wasn't planning on talking about Alien though, so I'd be happy to see you do so
21:17 jberger I have an idea for an introductory level talk
21:18 plicease oh good no compitition :P
21:18 plicease on what subject?
21:18 jberger variable scope, lexicals, globals etc
21:19 plicease scoping is probably my favorite aspect of Perl
21:19 jberger really?
21:19 jberger it is my favorite aspect of Perl
21:19 plicease I am very OCD about my variable scoping
21:19 jberger oh, sorry I misread
21:19 jberger we are in agreement
21:19 plicease seems as though :)
21:20 jberger anyway, yeah, I think the reason newcomers find it hard is that they learn "my" first
21:20 jberger lexicals are probably the most important but it does mean that fully-qualified globals, lexical globals (our) and dynamic scope (local) are harder to teach
21:21 jberger so my theory of this talk is to start with globals and work forward
21:21 jberger pure globals, no strict
21:21 plicease interesting
21:21 jberger lexicals are really different than everything else
21:22 jberger anyway, that's one idea, the other idea is to do a mojo chat app with Mojo+websockets+VueJS
21:22 jberger that wouldn't be introductory obviously
21:23 jberger basically this gist: https://gist.github.com/jberger/c4515eb8399f356736528dbc5af115f2
21:23 plicease very succinct
21:24 plicease I would rather hear about scoping though.  I am a dork.
21:24 plicease of course I don't think I am your target audience
21:26 jberger I'd happily give both
21:27 jberger I gave two talks in a row at YAPC madison, on different topics in different rooms (that was fun)
21:27 jberger I was originally scheduled to give two talks at the same time!
21:27 jberger that woulda been interesting
21:27 plicease lol
21:27 plicease I haven't had two talks at a time accepted yet.
21:27 jberger neither had
21:27 jberger I
21:28 jberger it was the only time
21:28 jberger one talk was more introductory though
21:28 jberger and I think that's what does it
21:28 jberger the other was my science work
21:28 plicease it's weird my first talk was 1 hour about ffi and alien, but then later two 1/2 hour talks about ffi and alien no.
21:28 jberger heh
21:29 plicease actually 1/2 hour is enough.
21:29 jberger yeah, I bet they get enough proposals that they don't want to give too many slots to repeat speakers
21:30 plicease my problem is that if I have an hour I really will fill it with all sorts of esoteric stuff.  but most people aren't interested in the weird things that I am interested in.
21:30 plicease so short talks help me focus
21:31 plicease I am local for this year so I am happy that I don't have to fly anywhere
21:32 plicease but espeically happy not to fly to Orlando again.
21:32 jberger he
21:32 jberger heh
21:32 jberger last year was a mess for me
21:32 jberger it was announced so late that I had booked vacation and then it collided
21:32 jberger there was no real reason I had to miss it
21:33 jberger if they had announced earlier I could have booked travel at another time
21:33 jberger but oh well, bygones
21:33 plicease they were very disorganized last year
21:33 jberger actually my sister lives right near YAPC this year, so its going to be fun for me too
21:35 plicease SLC was great for me because my parents have a house right near downtown
21:35 dcmertens hmm, my sister lives in DC, too
21:35 dcmertens and I'm toying with the idea of attending this year. First time in five years
21:35 dcmertens :-)
21:36 willthechill joined #native
21:36 plicease cool as a speaker or observer ?
21:36 dcmertens I would definitely give a talk about C::Blocks
21:36 plicease awesome I would definitely attend
21:37 dcmertens I wouldn't mind giving a talk also on how I structure my exploratory research code
21:37 dcmertens but C::Blocks is top priority
21:38 jberger I'd like a talk on your Beagle Bone array
21:38 jberger but that's just me
21:39 dcmertens heh, I might *talk* about it at YAPC, but that would be over beers
21:39 jberger my sister is in shirlington (took me a while to figure that out on a map)
21:40 plicease that is close.
21:40 plicease I am on the other side of DC in Maryland
21:40 dcmertens o/
21:41 jberger dcmertens: it'd be fun if you were there
21:41 dcmertens I know, I'd love it, too. Cross your fingers. :-)

| Channels | #native index | Today | | Search | Google Search | Plain-Text | summary