LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to run this debian example? (https://www.linuxquestions.org/questions/linux-software-2/how-to-run-this-debian-example-4175606156/)

pedros 05-17-2017 03:40 PM

How to run this debian example?
 
This is some example code in debian 8.5 software repository. How to run it?
Code:

atscc /usr/share/doc/ats-lang-anairiats-examples/examples/AUP/AUP_5_17_3.dats
/usr/lib/ats-anairiats-0.2.11/bin/atsopt --output AUP_5_17_3_dats.c --dynamic /usr/share/doc/ats-lang-anairiats-examples/examples/AUP/AUP_5_17_3.dats
gcc -I/usr/lib/ats-anairiats-0.2.11/ -I/usr/lib/ats-anairiats-0.2.11/ccomp/runtime/ -L/usr/lib/ats-anairiats-0.2.11/ccomp/lib64/ /usr/lib/ats-anairiats-0.2.11/ccomp/runtime/ats_prelude.c AUP_5_17_3_dats.c -lats
AUP_5_17_3_dats.c:58:30: error: ‘PTHREAD_MUTEX_INITIALIZER’ undeclared here (not in a function)
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER ;
^
Exit: [gcc] failed.

hunkemoller 05-18-2017 05:14 AM

Pedros, you need to supply more information than just this, the error reported is clear in itself.

ps: i see your name and same question all over http://forums.debian.net/viewtopic.php?t=133008 .....

Shadow_7 05-18-2017 08:03 AM

$ egrep -r -i pthread /usr/include/* | grep -i pthread_mutex_initializer
/usr/include/pthread.h:# define PTHREAD_MUTEX_INITIALIZER \
/usr/include/pthread.h:# define PTHREAD_MUTEX_INITIALIZER \
...

$ apt-file find usr/include/pthread.h
libc6-dev: /usr/include/pthread.h

$ sudo apt-get install libc6-dev

Shadow_7 05-18-2017 08:13 AM

Although if you're missing that most basic of things.

$ sudo apt-get install build-essential devscripts

pedros 05-18-2017 03:15 PM

to hunkemoller.
error: ‘PTHREAD_MUTEX_INITIALIZER’ undeclared here (not in a function)
It seems to me that PTHREAD_MUTEX_INITIALIZER needs to be declared somewhere. And since it was not declared in the example script, I guess the program
is looking for the declaration somewhere else. And I am assuming that since the script is included in the debian main software repository,
it should run? I found many example scripts that give error messages. I commented the scripts out in the bash file
http://pdscript.com/p/debian/example/bash/ats.txt
Would you like to see the error messages? And yes, I did post one of them twice at http://forums.debian.net/viewtopic.php?t=133008
It was ignored. You may help with that one if you wish. To avoid double-posting, I avoid asking about the same script twice.
I figure if I had the answer to some, then I could apply the answer to the rest.

to Shadow_7, Senior Member.
I tried to reproduce your work.
The file /mnt/01/dists/jessie/main/Contents-amd64.gz does not exist,
and so apt-file update gives an error. I installed everything you said to. Result is still the same.

to anyone.
To be less specific, In the bash file http://pdscript.com/p/debian/example/bash/ats.txt
can any of the commented-out scripts be run?

Shadow_7 05-18-2017 07:24 PM

/mnt/01/dists/jessie/main/Contents-amd64.gz

That's not a usual thing. What special voodoo are you doing? Cygwin under windows? VM? KVM? PXE? local mirror? CD-ROMs? ??? Not that it matters in this case for apt-file as we were "looking" for the missing bits. It's the install lines that matter in terms of end results.

Did it fail in the same place same error? You might need to override a lot of things with special voodoo. -I/path/to/stuff -L/path/to/things and various other gcc options depending on what you're trying to do. The blackmagic I had to do for povray on debian armel on a pi B from source was, well, educational. Be sure to follow the ./docs/ or README or INSTALL steps as much as they apply to your situation anyway. The usual configure make make install steps of old don't apply as much anymore.

pedros 05-19-2017 10:43 AM

I have 13 dvd set debian 8.5. I store it in /mnt.
See details in my post in Linux - General, Where is the best local place to store debian software repository?
http://www.linuxquestions.org/questi...84#post5712784
Anyway, I use standard install and default settings as much as possible. Minimal setup. I do not even use sudo.
I can try adjusting path. Note that my current settings work for many of the examples.
Has anyone got the commented-out examples working? how?

Habitual 05-19-2017 11:59 AM

Quote:

Originally Posted by pedros (Post 5712520)
And yes, I did post one of them twice at http://forums.debian.net/viewtopic.php?t=133008
It was ignored.

It most certainly was not ignored.

You were chided for "--allow-unauthenticated -y" and a senior member said your post "It has no business being on this forum."
and
Quote:

Originally Posted by pedros (Post 5712799)
I use standard install and default settings as much as possible. Minimal setup.

and
Code:

--allow-unauthenticated -y
is a risk, far from "standard and default settings". You are deviating from safe and stable practices.
You should try default. it rocks.

I encourage free thinking, but there this "thing" called DontBreakDebian or FrankenDebian.
Voodoo? FrankenDebian.

Have you taken a gander through any other documents in /usr/share/doc/ats-lang-anairiats-examples/ ?

Code:

sudo apt-get install debian-handbook
and use your browser to File > Open > /usr/share/doc/debian-handbook/html/index.htm

See file:///usr/share/doc/debian-handbook/html/sect.setup-apt-package-repository.html or
https://debian-handbook.info/browse/...epository.html for repository tips.

What you may wish to run to verify the dpkg system is ok using
Code:

sudo apt-get install -f
and follow the prompts.

FWIW: I don't think you've installed build-essential if gcc is failing.

I show 3 distinct ats-lang-anairiats packages:
Code:

ats-lang-anairiats - Legacy ATS v1 language compiler, named Anairiats
ats-lang-anairiats-doc - Documentation for the ATS compiler Anairiats
ats-lang-anairiats-examples - Examples for the ATS compiler Anairiats

and you've only mentioned the /usr/share/doc/ats-lang-anairiats-examples/examples/AUP/AUP_5_17_3.dats file, so are there files in /usr/share/doc/ats-lang-anairiats-docs/ ?

Wow, what a project.
Code:

sudo aptitude install ats-lang-anairiats-docs
[sudo] password for toaster:
The following NEW packages will be installed:
...
0 packages upgraded, 86 newly installed, 0 to remove and 0 not upgraded.


Good Luck.

pedros 05-19-2017 03:19 PM

to Habitual, LQ Addict.

I should use sudo, and another install method?

It most certainly was not ignored. Thank you for clarifying this.
Running the script was ignored, but security was not ignored.
I was so intent in finding a way to run the script, that I overlooked security.
What other install method should I use?

/usr/share/doc/ats-lang-anairiats-examples/
has many scripts, not many documents.
AUP_5_17_3.dats says this.
Author: Hongwei Xi (hwxi AT cs DOT bu DOT edu)
book: AUP (2nd edition), pages 332 - 338
section 5.17.3: Thread Synchronization (Mutexes)
Author did not respond to my email. I do not have the book.
But my question is: how to run this script in debian?

I had hoped that my work could be run on a system easily installed and setup by a novice user.
And sudo is not installed by default. I know sudo, but the setup instructions
are more complicated than I wish for. But you say I should use sudo anyway.

file:///usr/share/doc/debian-handbook/html/sect.setup-apt-package-repository.html
says: virtual host on internal HTTP server, with /srv/vhosts/packages/
I suppose this answers my question of where to put repository. Thank you.
But with internet search I also found these suggestions.
/packages/ /var/www/debian/ /usr/local/packages/ /dists

I ran apt-get install -f. There were no prompts. Everything looked good.

ats-lang-anairiats-doc has a pdf file that tells how to program.
It says nothing about system configuration.

The project is mostly done. There are simply some rogue scripts that would not compile.
The project should be redone: adding reasons in the documentation.
adding sudo. changing install method. Do you agree?

Shadow_7 05-19-2017 04:31 PM

Quote:

Originally Posted by pedros (Post 5712799)
I have 13 dvd set debian 8.5. I store it in /mnt.
See details in my post in Linux - General, Where is the best local place to store debian software repository?
http://www.linuxquestions.org/questi...84#post5712784
Anyway, I use standard install and default settings as much as possible. Minimal setup. I do not even use sudo.
I can try adjusting path. Note that my current settings work for many of the examples.
Has anyone got the commented-out examples working? how?

For optical images, I tend to mount them -o loop and copy the *.deb's to /var/cache/apt/archives/. That way it never prompts me to insert the disk. Once those exist and the package manager knows about the packages, I move the .iso's off system to save space. But I never purge the /var/cache/apt/archives/ path for existing systems. And I'd hardly call my methods standard, or even best practices. Plus the last time I did something like that the distro fit on 3 CDs or 1 DVD image. Which was an improvement over 26 floppy disks.

Habitual 05-19-2017 04:46 PM

Quote:

Originally Posted by pedros (Post 5712898)
I was so intent in finding a way to run the script, that I overlooked security.

+1
Quote:

Originally Posted by pedros (Post 5712898)
What other install method should I use?

To install what? From where? We've established it will have to be run as root.

Quote:

Originally Posted by pedros (Post 5712898)
But my question is: how to run this script in debian?

What "script"?
Code:

atscc /usr/share/doc/ats-lang-anairiats-examples/examples/AUP/AUP_5_17_3.dats
is not a script.

How did the package ats-lang-anairiats get installed?
From where?
When I examined some /usr/share/doc/ats-lang-anairiats-examples/examples/AUP/ file in a .deb I saw only what I guess is gcc code.


Quote:

Originally Posted by pedros (Post 5712898)
file:///usr/share/doc/debian-handbook/html/sect.setup-apt-package-repository.html
says: virtual host on internal HTTP server, with /srv/vhosts/packages/
I suppose this answers my question of where to put repository. Thank you.
But with internet search I also found these suggestions.
/packages/ /var/www/debian/ /usr/local/packages/ /dists

You're welcome. Yes, Debian is quite flexible. There are many ways.

That's good. Get a perspective on how other folks have solved the same problem But since you are a novice and overlooked security,
I recommend you start with "The Debian Way". And start documenting this stuff. :)

Quote:

Originally Posted by pedros (Post 5712898)
I ran apt-get install -f. There were no prompts. Everything looked good.

Great! I had my doubts. That's always a good sign!

You keep mentioning "this script"
If "this script" is
Code:

atscc /usr/share/doc/ats-lang-anairiats-examples/examples/AUP/AUP_5_17_3.dats
Then run this:
Code:

apt-get install ats-lang-anairiats ats-lang-anairiats-doc
There's a huge list following
this package around. Take a breath. Yes, all those. Take another breath.

since you already have one of 3 packages already, (ats-lang-anairiats-examples), I omitted it from the above.
After that install, open a terminal and issue
Code:

atscc /usr/share/doc/ats-lang-anairiats-examples/examples/AUP/AUP_5_17_3.dats
and see what's what.

Please take some time to have a look at the section titled
### Debian ###

Hope I didn't come off as a jerk.

Good Luck!

pedros 05-20-2017 05:32 PM

I now understand there is no standard or official local place to store debian software repository. Diffrent people use diffrent locations. I use /mnt.

I installed sudo, and added this to /etc/sudoers.
Code:

Defaults !authenticate
root ALL=(ALL) ALL
d ALL=(ALL) ALL
%sudo ALL=(ALL) ALL

I removed packages ats-lang-anairiats ats-lang-anairiats-examples. I ran this.
Code:

sudo apt-get install ats-lang-anairiats ats-lang-anairiats-examples;
prompt says Install these packages without verification? [y/N]
I would like everything to be automatic, without prompting. Is there a way to do this that is accepted by the community, or should I abandon this idea of being automatic ?

In the bash file http://pdscript.com/p/debian/example/bash/ats.txt many files are listed. They are from the package ats-lang-anairiats-examples. I call these files scripts, but a better term might be code? Some of the lines begin with #. This means the line is commented-out. These commented-out lines have files that will not compile. Perhaps some of them are some sort of template and are not meant to compile as is. Perhaps some of them requre special system setup to compile. I would like to know which.

Shadow_7 05-20-2017 10:16 PM

$ man apt-get

There's -y --yes --assume-yes that prevents the verification pause. You could also install the keyring stuffs so verification is not something that would be prompting you. And if you have all the packages that it might grab, it'll just do it, and not prompt you when not using the -y option. Otherwise use -y.

Code:

sudo apt-get -y install ats-lang-anairiats ats-lang-anairiats-examples
You don't need the ; at the end unless you're stringing another command on the same line or adding a # comment. Not that it hurts anything, it's just an extra key stroke that'll be ignored.

ats seems interesting, although I'm not much for languages who's compiler is written in the same language (beyond C anyway). There's too much of a chicken or an egg scenario. Plus lots of things make the claim, can be as efficient as C/C++, like RPerl. Outside of a job, is there a reason to learn ATS over say ADA that actually gets used (probably only by the governments).

ondoho 05-21-2017 02:26 AM

you are running a server/website and are active on at least 2 forums - so you do have internet connectivity.
this offline repo, is it on a different machine? one that is not connected to the internet?

Habitual 05-21-2017 04:34 AM

Quote:

Originally Posted by pedros (Post 5713244)
I abandon this idea of being automatic?

Again, what are you trying to automate?

Code:

apt-get -yqq install ats-lang-anairiats ats-lang-anairiats-examples
is what I'd use.
It one of the quickest method.
See man apt-get for more on these ("-y, -q") switches, including your use of (and why?)
Code:

--allow-unauthenticated
          Ignore if packages can't be authenticated and don't prompt about it. This is useful for tools like pbuilder. Configuration Item:
          APT::Get::AllowUnauthenticated.

pbuilder is a repo? If it is, you'd only need
--allow-unauthenticated -y for their stuff, I presume.

Installing sudo is good for experience, but it is not required for this to work.
I have an Debian8.7 installing in Vbox now to see what's what with
Code:

atscc /usr/share/doc/ats-lang-anairiats-examples/examples/AUP/AUP_5_17_3.dats
I'll let you know how that goes later today.
Good Luck.


All times are GMT -5. The time now is 06:38 AM.