Recent

Author Topic: Lazarus with RPi 3  (Read 25709 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: Lazarus with RPi 3
« Reply #15 on: October 28, 2016, 10:59:56 am »
A further note is that I did the upgrades first is because of VC4 hardware accelerated chromium. But nothing else except for the dependency installs.
I suggest you look at the logs if cUrl is updated in the dist-upgrade.

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Lazarus with RPi 3
« Reply #16 on: October 28, 2016, 11:00:36 am »
What version of curl?
curl --version

And what does this give you:
curl -o fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz

For me it doesn't download anything without the -L switch:
(this is on the latest 2016-09-23-raspbian-jessie without sudo apt-get update/upgrade)

Code: [Select]
pi@raspberrypi:~ $ curl -o fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

pi@raspberrypi:~ $ curl --version
curl 7.38.0 (arm-unknown-linux-gnueabihf) libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP
pi@raspberrypi:~ $
« Last Edit: October 28, 2016, 11:02:17 am by rvk »

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: Lazarus with RPi 3
« Reply #17 on: October 28, 2016, 11:04:55 am »
Seem identical:
Code: [Select]
~/Downloads $ curl --version
curl 7.38.0 (arm-unknown-linux-gnueabihf) libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP

Must be something else then?

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Lazarus with RPi 3
« Reply #18 on: October 28, 2016, 11:06:36 am »
So... does this work?
curl -o fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz

If it does I would be really puzzled as to why it wouldn't work for me without the -L.

When I add the -v I get this.
You'll see I get the 302 Found but it doesn't proceed without -L for follow redirect.

Code: [Select]
pi@raspberrypi:~ $ curl -v -o fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz
* Hostname was NOT found in DNS cache
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 162.125.65.1...
* Connected to www.dropbox.com (162.125.65.1) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server key exchange (12):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
*        subject: businessCategory=Private Organization; 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; serialNumber=4348296; street=185 Berry St STE 400; postalCode=94107; C=US; ST=California; L=San Francisco; O=Dropbox, Inc; OU=Dropbox Ops; CN=www.dropbox.com
*        start date: 2015-12-10 00:00:00 GMT
*        expire date: 2017-12-13 12:00:00 GMT
*        subjectAltName: www.dropbox.com matched
*        issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
*        SSL certificate verify ok.
> GET /s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz HTTP/1.1
> User-Agent: curl/7.38.0
> Host: www.dropbox.com
> Accept: */*
>
< HTTP/1.1 302 Found
* Server nginx is not blacklisted
< Server: nginx
< Date: Fri, 28 Oct 2016 09:09:29 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 0
< Connection: keep-alive
< Cache-Control: no-cache
< Content-Security-Policy: sandbox
< Location: https://dl.dropboxusercontent.com/content_link/QJWLWUYiHTRAOccw7bFYM2YioLe8PV8O5c840b3U2qN3klJFvdnzbTl5IF1prpKJ/file
< Pragma: no-cache
< Set-Cookie: locale=en; Domain=dropbox.com; expires=Wed, 27 Oct 2021 09:09:29 GMT; Path=/; secure
< Set-Cookie: gvc=MjM2ODE0MTMxMTU4NDE1OTQ3NTU2Nzc4MDUyMDg5Mzk1MTExNTY%3D; expires=Wed, 27 Oct 2021 09:09:29 GMT; httponly; Path=/; secure
< Set-Cookie: puc=; expires=Fri, 28 Oct 2016 09:09:29 GMT; httponly; Path=/; secure
< Set-Cookie: seen-sl-signup-modal=VHJ1ZQ%3D%3D; expires=Sun, 27 Nov 2016 09:09:29 GMT; httponly; Path=/; secure
< Set-Cookie: t=WXn8Fayw6qMyTmZm0G9GVk4f; Domain=dropbox.com; expires=Mon, 28 Oct 2019 09:09:29 GMT; httponly; Path=/; secure
< Set-Cookie: __Host-js_csrf=WXn8Fayw6qMyTmZm0G9GVk4f; expires=Mon, 28 Oct 2019 09:09:29 GMT; Path=/; secure
< X-Content-Type-Options: nosniff
< X-Dropbox-Http-Protocol: None
< X-Dropbox-Request-Id: aae547ea8e805d87fa1bd91dbeeb8354
< X-Frame-Options: DENY
< X-Robots-Tag: noindex, nofollow, noimageindex
< X-Xss-Protection: 1; mode=block
< Strict-Transport-Security: max-age=15552000; includeSubDomains
<
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host www.dropbox.com left intact
pi@raspberrypi:~ $
« Last Edit: October 28, 2016, 11:09:45 am by rvk »

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: Lazarus with RPi 3
« Reply #19 on: October 28, 2016, 12:27:50 pm »
That does not work, indeed, I guess you missed something in the script, because that works....
I will have a closer look at the script. Looks at first glance to me the dropbox part is a fallback for the S3?

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Lazarus with RPi 3
« Reply #20 on: October 28, 2016, 12:30:19 pm »
That does not work, indeed, I guess you missed something in the script, because that works....
I will have a closer look at the script. Looks at first glance to me the dropbox part is a fallback for the S3?
Did you use the latest version of the script?
Where it has this line:
download fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz

If so, it would be really really weird that it worked for you :)

If you're using an older script which takes the download from S3, then it makes sense.

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: Lazarus with RPi 3
« Reply #21 on: October 28, 2016, 12:39:02 pm »
I did not use the version on github but the first link

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: Lazarus with RPi 3
« Reply #22 on: October 28, 2016, 12:48:21 pm »
it came from the first link like: http://cache.getlazarus.org/download/raspberry/setup.sh
And that one works.

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Lazarus with RPi 3
« Reply #23 on: October 28, 2016, 12:50:51 pm »
I did not use the version on github but the first link
Mmmm, The github version has:
Code: [Select]
URL=http://cache.getlazarus.org/archives

download fpc.lazarus.raspberry.tar.gz $URL/fpc.lazarus.raspberry.tar.gz
So that one would work.

The version on cache.getlazarus.org (http://cache.getlazarus.org/download/raspberry/setup.sh) has
Code: [Select]
# Download from our Amazon S3 bucket
URL=http://cache.getlazarus.org/archives

# download fpc.lazarus.raspberry.tar.gz $URL/fpc.lazarus.raspberry.tar.gz
# trying dropbox to save money on bandwidth charges from amazon s3
download fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz

So I would expect that you DO have the one from github, because that one still works (and doesn't use dropbox) !!

it came from the first link like: http://cache.getlazarus.org/download/raspberry/setup.sh
And that one works.
Now this gets really weird....
The one from http://cache.getlazarus.org/download/raspberry/setup.sh has the dropbox link.
And that doesn't work for me :( :(

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: Lazarus with RPi 3
« Reply #24 on: October 28, 2016, 01:06:57 pm »
Oh well, it's Friday. I will get an 16G sd cart extra from the supermarket and film the whole shebang...again  :o :(

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Lazarus with RPi 3
« Reply #25 on: October 28, 2016, 01:11:34 pm »
Oh well, it's Friday. I will get an 16G sd cart extra from the supermarket and film the whole shebang...again  :o :(
No need to film it.
But if you check the script you'll see that line
download fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz

And if you enter the line manually
curl -o fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz
it also doesn't work for you.

I would love to know why your script works (I do believe you but I'd like to understand why).

The download function is this so I'll expect it to always take curl if installed:
Code: Pascal  [Select][+][-]
  1. # function download(url, output)
  2. function download() {
  3.         if type "curl" > /dev/null; then
  4.                 curl -o "$1" "$2"
  5.         elif type "wget" > /dev/null; then
  6.                 wget -O "$1" "$2"
  7.         fi     
  8. }

Adding -L will fix it but in that case I'll still not understand why it would work on your box.

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: Lazarus with RPi 3
« Reply #26 on: October 28, 2016, 01:25:27 pm »
That's why I do a new sd card. I have no clue other than the file coming from a different cache.

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Lazarus with RPi 3
« Reply #27 on: October 28, 2016, 01:29:52 pm »
That's why I do a new sd card. I have no clue other than the file coming from a different cache.
You could check that by looking in the script itself to see if there is the dropbox link.

Could you post the text from the terminal during install (it will be easier then to filming the whole shebang and it will make clear if curl is used or wget).
(unfortunately it won't show if the download was taken from S3 or dropbox)

(I also took a clean SD-card with the latest jessie 2016-09-23 on it)

Cyrax

  • Hero Member
  • *****
  • Posts: 835
Re: Lazarus with RPi 3
« Reply #28 on: October 29, 2016, 01:22:01 am »
Code: [Select]
#!/bin/bash

# Author of this script: http://www.getlazarus.org
# This is the universal script to install fpc 3.0.0 minimal

# If you need to fix something and or want to contribute, send your
# changes to admin at getlazarus dot org with
# "fpc lazazarus install" in the subject line.

# Prevent this script from running as root
if [ "$(id -u)" = "0" ]; then
   echo "This script should not be run as root"
   exit 1
fi

# Prevent this script from running as root
if [ "$(id -u)" = "0" ]; then
   echo "This script should not be run as root"
   exit 1
fi

# function download(url, output)
function download() {
if type "curl" > /dev/null; then
curl -o "$1" "$2"
elif type "wget" > /dev/null; then
wget -O "$1" "$2"
fi
}

# Cross platform function expandPath(path)
function expandPath() {
if [ `uname`="Darwin" ]; then
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}";
else
echo $(readlink -m `$1`)
fi
}

clear
echo "Prerequisites for Free Pascal and Lazarus on Raspbian"
echo "-----------------------------------------------------"
echo "Lazarus requires the following Gtk+ dev packages which"
echo "can be installed on Raspbian by using:"
echo
echo "sudo apt-get install libgtk2.0-dev libcairo2-dev \\"
echo "  libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev \\"
echo "  libghc-x11-dev"
echo
echo -n "Press return to check your system"
read CHOICE
echo

# function requirePackage(package)
function requirePackage() {
INSTALLED=$(dpkg-query -W --showformat='${Status}\n' $1 2> /dev/null | grep "install ok installed")
if [ "$INSTALLED" = "" ]; then
echo "$1 not found"
echo
echo "An error occured"
echo
echo "This script requires the package $1"
echo
echo "Use the command:"
echo
echo "sudo apt-get install $1"
echo
echo "Then re-run this script"
echo
exit 1
fi
echo "$1 found"
}

requirePackage "libgtk2.0-dev"
requirePackage "libcairo2-dev"
requirePackage "libpango1.0-dev"
requirePackage "libgdk-pixbuf2.0-dev"
requirePackage "libatk1.0-dev"
requirePackage "libghc-x11-dev"
sleep 2s

# Present a description of this script
clear
echo "Raspberry Free Pascal 3.0 with Lazarus install script"
echo "-----------------------------------------------------"
echo "This script will install a lightweight version of"
echo
echo "The Free Pascal Compiler version 3.0"
echo "The Lazarus Development Environment"
echo
echo "After install 280MB of drive space will be used"
echo
echo "This lightweight version is designed specifically"
echo "for the Raspberry Pi running Raspbian OS"
echo
# The default folder
BASE=$HOME/Development/FreePascal

# Ask a series of questions
while true; do
# Ask for an install location
echo "Enter an installation folder or press return to"
echo "accept the default install location"
echo
echo -n "[$BASE]: "
read CHOICE
echo

# Use BASE as the default
if [ -z "$CHOICE" ]; then
CHOICE=$BASE
fi

# Allow for relative paths
CHOICE=`eval echo $CHOICE`
EXPAND=`expandPath "$CHOICE"`
EXPAND=${EXPAND%/}

# Allow install only under your home folder
if [[ $EXPAND == $HOME* ]]; then
echo "The install folder will be:"
echo "$EXPAND"
echo
else
echo "The install folder must be under your personal home folder"
echo
continue
fi

# Confirm their choice
echo -n "Continue? (y,n): "
read CHOICE
echo

case $CHOICE in
[yY][eE][sS]|[yY])
;;
*)
echo "done."
echo
exit 1
;;
esac

# If folder already exists ask to remove it
if [ -d "$EXPAND" ]; then
echo "Directory already exist"
echo -n "Remove the entire folder and overwrite? (y,n): "
read CHOICE
case $CHOICE in
[yY][eE][sS]|[yY])
echo
rm -rf $EXPAND
;;
*)
echo
echo "done."
echo
exit 1
;;
esac
fi

break
done

# Confirm their choice
echo "After install do you want to shortcuts created in:"
read -r -p "$HOME/.local/share/applications (y/n)? " SHORTCUT
echo

# Create the folder
BASE=$EXPAND
mkdir -p $BASE

# Exit if the folder could not be created
if [ ! -d "$BASE" ]; then
  echo "Could not create directory"
  echo
  echo "done."
  echo
  exit 1;
fi

cd $BASE

# Note we use our bucket instead of sourceforge or svn for the following
# reason:
#   It would be unethical to leach other peoples bandwidth and data
#   transfer charges. As such, we rehost the same fpc stable binary, fpc
#   test sources, and lazarus test sources from sourceforge and free
#   pascal svn servers using our own Amazon S3 bucket.

# Download from our Amazon S3 bucket
URL=http://cache.getlazarus.org/archives

# download fpc.lazarus.raspberry.tar.gz $URL/fpc.lazarus.raspberry.tar.gz
# trying dropbox to save money on bandwidth charges from amazon s3
download fpc.lazarus.raspberry.tar.gz https://www.dropbox.com/s/90cuaf1rvh8asj5/fpc.lazarus.raspberry.tar.gz

tar xvf fpc.lazarus.raspberry.tar.gz
rm fpc.lazarus.raspberry.tar.gz

# Create the cfg file
"$BASE/fpc/bin/fpcmkcfg" -d "basepath=$BASE/fpc/lib/fpc/\$FPCVERSION" -o "$BASE/fpc/bin/fpc.cfg"

# function replace(folder, files, before, after)
function replace() {
BEFORE=$(echo "$3" | sed 's/[\*\.]/\\&/g')
BEFORE=$(echo "$BEFORE" | sed 's/\//\\\//g')
AFTER=$(echo "$4" | sed 's/[\*\.]/\\&/g')
AFTER=$(echo "$AFTER" | sed 's/\//\\\//g')
find "$1" -name "$2" -exec sed -i "s/$BEFORE/$AFTER/g" {} \;
}

# Replace paths from their original location to the new one
ORIGIN="/home/pi/Development/Base"
replace "$BASE/lazarus/config" "*.xml" "$ORIGIN" "$BASE"
replace "$BASE/lazarus/config" "*.cfg" "$ORIGIN" "$BASE"
replace "$BASE/lazarus" "lazarus.sh" "$ORIGIN" "$BASE"
replace "$BASE/lazarus" "lazarus.desktop" "$ORIGIN" "$BASE"

case $SHORTCUT in
[yY][eE][sS]|[yY])
cp "$BASE/lazarus/lazarus.desktop" "$HOME/.local/share/applications/"
;;
*)
;;
esac

mv "$BASE/lazarus/lazarus.desktop" "$BASE/lazarus.desktop"

FPCDIR="$BASE/fpc"
# Create a terminal configuration
TERMINAL="$FPCDIR/bin/fpc-terminal.sh"
echo "#!/bin/bash" > $TERMINAL
echo "export PPC_CONFIG_PATH=$FPCDIR/bin" >> $TERMINAL
echo "export PATH=\$PPC_CONFIG_PATH:\$PATH" >> $TERMINAL
echo "\$SHELL" >> $TERMINAL
chmod +x $TERMINAL
# Get the current terminal program name
APP=`ps -p $(ps -p $(ps -p $$ -o ppid=) -o ppid=) o args=`
# Create a shortcut file
DESKTOP="$BASE/freepascal.desktop"
echo "[Desktop Entry]" > $DESKTOP
echo "Name=Free Pascal Terminal" >> $DESKTOP
echo "Comment=Open a new terminal with the fpc program made available" >> $DESKTOP
echo "Icon=terminal" >> $DESKTOP
echo "Exec=$APP -e \"$TERMINAL\"" >> $DESKTOP
echo "Terminal=false" >> $DESKTOP
echo "Type=Application" >> $DESKTOP
chmod +x $DESKTOP

function hit() {
if type "curl" > /dev/null; then
curl -s -o /dev/null "$1"
elif type "wget" > /dev/null; then
wget -q -O /dev/null "$1"
fi
}

hit "http://www.getlazarus.org/installed/?platform=raspberry"
echo
echo "Your Free Pascal 3.0 with Lazarus is now installed"
echo

I see dropbox link in that script, too.

rvk

  • Hero Member
  • *****
  • Posts: 4324
Re: Lazarus with RPi 3
« Reply #29 on: October 29, 2016, 01:29:41 am »
I see dropbox link in that script, too.
And does the script work for you on a RPI with curl installed?

Maybe dropbox doesn't always redirect (in which case the curl will work without -L).

 

TinyPortal © 2005-2018