Lintian warnings executable-not-elf-or-script - warnings

When i test my debian package with lintian i get the following warning:
executable-not-elf-or-script usr/share/cw1-6005-pp6g11/rss_reader.php
Does anyone know why lintian show this warning.

That file, rss_reader.php, has the +x permissions bit set, making it executable, but it isn't an ELF binary and it isn't a script with #! at the start. It therefore can't be executed by a standard linux kernel (there are modules to allow other binary formats to be executed).
In this particular case, although PHP scripts can be given a #! line and made executable, if they're part of a web application this probably isn't what you want. You should probably just remove the +x bit.

chmod -x /usr/share/cw1-6005-pp6g11/rss_reader.php
this will remove the EXECUTION bit from it and Lintian will not print the warning.

Related

How do I use LLDB to debug a raw i386 MBR binary running in QEMU, on an Apple Silicon Mac?

I'm working on an i386 bootloader and I'm running it with QEMU on my Apple Silicon machine, and everything works just fine, except I can't debug it: GDB does not (yet?) work on AS and LLDB sternly refuses to load a raw binary. This starts up fine:
$ qemu-system-i386 -s -S -drive format=raw,file=boot.bin,media=disk,if=floppy -no-fd-bootchk
but this errors out:
$ lldb boot.bin
(lldb) target create "boot.bin"
error: '/Users/morpheu5/src/boots/cube/boot.bin' doesn't contain the architecture x86_64
and I also tried this, because well, it's supposed to be i386, not x86_64:
$ lldb --arch i386 boot.bin
(lldb) target create --arch=i386 "boot.bin"
error: '/Users/morpheu5/src/boots/cube/boot.bin' doesn't contain the architecture i386
but it didn't make much of a difference. The inline help is not greatly helpful and I am having zero success searching online.
Now, I have alternatives: bochs has an internal debugger but the text-based interface is a bit clunky and I can't even figure out how to pre-set certain breakpoints -- I like to break on 0x7c00 or otherwise I have to step through the entire BIOS code -- and I can't even run the gui debugger despite having configured it with display_library: sdl2, options=gui_debug. The other alternative is a Raspberry Pi in which I could probably use gdb but I haven't tried this out yet and it's a Zero so it's not even that powerful anyway -- not that I need it, but I'd rather keep my workflow smooth...
It seems clear that lldb isn't recognizing the binary's format so I'm wondering if there's a way of just asking it to disassemble it as a 32 bit binary and just roll with it the best it can. In the end, all I really need is a way of seeing what is in memory, in the registers, and in the stack.
Any ideas?
After a few weeks of experimentation, it doesn't look like lldb is a viable option, but Bochs' command-line debugger was somewhat useful. Shame I couldn't get the GUI to run on macOS.
brew install x86_64-elf-gdb
qemu-system-i386 -s -S result.bin
x86_64-elf-gdb -ex "target remote localhost:1234" -ex "set architecture i8086" -ex "set disassembly-flavor intel" ····
this works for me, but this don't use lldb.

How to specify include directory of mpicxx in the command line option of make?

I am trying to build all CUDA samples by running make in the sample's base folder. One of the samples require mpi.h, but the system did not have it, which causes an error:
make[1]: Entering directory '$HOME/cuda_samples/samples/0_Simple/simpleMPI'
/bin/mpicxx -I../../common/inc -o simpleMPI_mpi.o -c simpleMPI.cpp
simpleMPI.cpp:25:10: fatal error: mpi.h: No such file or directory
25 | #include <mpi.h>
| ^~~~~~~
compilation terminated.
make[1]: *** [Makefile:371: simpleMPI_mpi.o] Error 1
Since I don't have root privilege, I downloaded a deb file for libopenmpi-dev package (using apt-get download command) and extracted it to somewhere in my user space (using dpkg -x command). However, as we can see, mpicxx tries to find mpi.h in ../../common/inc, which is not where I installed libopenmpi-dev in my user space (I did not notice that untill I installed the package. My bad). So I need to somehow tell mpicxx to find mpi.h in another directory. I know there is a -I option to tell make where additional include directories are, but this option does not apply to mpicxx. How to pass directory information from make's command line to mpicxx is beyond my knowledge. Can you please teach me what option I should use in make's command line to specify include directory used by mpicxx? Of course I can manually copy the installed libopenmpi-dev package to ../../common/inc to accommodate original settings in CUDA sample, but I would like to do something cool and learn something new, so I ask here. Thank you in advance for teaching me.
Environment:
Remote Linux with core version 5.8.0. I am not a super user.
CUDA version: 11.2
CPU: Intel Core i9-10900K
gcc version: (Ubuntu 10.2.0-13ubuntu1) 10.2.0
make version: GNU Make 4.3, Built for x86_64-pc-linux-gnu
MPI version: 4.0.3
The include directory in Makefile is held in a variable INCLUDES, together with -I. So, if we can somehow transfer the include directory of mpi installed in my user space to this variable, we are done. So, the question is reduced to how to transfer a user-defined value from make's command line into Makefile's variable and override it if it has be defined, as is clearly asked in the question.
Fortunately make provides this command line option: VAR=value, so the option to answer my question is
make INCLUDES=-I/path/to/mpi/include/in/my/user/space

Perl to mysql connectivity on Windows 10

I have a process that works in the production environment, that I need to get working on my local Windows 10 environment. It is a Perl script that calls mySql stored procedures.
I have installed ActivePerl 5.26.3 (64-Bit) from Active State. When I attempt to execute the script I get an error:
Can't locate DBD/mysql.pm (you may need to install the DBD::mysql module)...
So, I went to https://metacpan.org/release/DBD-mysql and found instructions that indicated I needed to do the following:
perl -MCPAN -e shell
install DBD::mysql
But, when I type the first command I get a message stating:
It looks like you don't have a C compiler and make utility installed. Trying to install dmake and the MinGW gcc compiler using the Perl Package Manager. This may take several minutes....
Then it goes thru what appears to be a successful installation. So I type in the second command. It scrolls by for a while, but ends with:
Failed during this command
DVEEDEN/DBD-mysql-4.050.tar.gz: writemakefile NO 'C:\Perl64\bin\perl.exe MakeFile.PL INSTALLDIRS=site' returned status 512
Not sure how to proceed.
For ActivePerl, use their package manager PPM.
Or, use Strawberry Perl for a more unixy experience. It comes with all the stuff to compile and install modules.
No matter which Perl you use, on Windows or elsewhere, modules typically need to be compiled the same. Mixing compilers (such as Visual Studio and gcc) or options can lead to incompatible binaries. The same might happen across Perl versions too. That means to use the same Perl (and compilation method) for everything in your project).
The cpan utility doesn't figure out those things for you. It does whatever it's configured to do.
For what it's worth, the cpan method to install modules can be simpler:
$ cpan DBD::mysql

"Fatal error: 'EXTERN.h' file not found" while installing Perl modules

While trying to install Perl modules like JSON::XS or YAML::XS, i receive the same error:
XS.xs:1:10: fatal error: 'EXTERN.h' file not found
I use MacBook, xCode is up to date, everything else that could help is up to date too.
Since OS X El Capitan, Apple introduced System Integrity Protection which restricts writing to /usr/lib /usr/bin and other sensitive directories (even to root or sudo user) that are used by the installation of Perl bundled with the Operating System. This can cause issues when it comes to installing new modules and also if trying to install XS modules ( those linked to external C libraries ).
For this reason you should not consider the default Perl installation as a working development environment, especially if you are installing custom modules.
Check out this thread on PM and others. I had since El-Capitan managed to solve this before by manually building from tarball and adding a few params or environment variables to set the paths believing that it would be best to retain use of the system Perl but this is not the way to go. This makes your environment difficult to build but also brittle and sensitive to OS updates that may either break things in many different ways.
The best practice seems to be starting with a Perl using brew install perl and work in this environment, remembering to setup your bash_profile as directed by the installer.
Also worth remembering to do a brew link perl. If you receive warnings about this clobbering what looks like system Perl libraries don't worry - these are likely modules that were installed by you over the top and it will cause you less trouble to link over these. If you have concerns, make a note of which module installs will be cleared and re-install them once your environment is configured ( ie your module installer approach is configured using cpanm or sticking with the old perl -MCPAN -e shell etc)
This new Perl setup from brew eliminates the need to continuing running sudo which adds another layer of things that can go wrong as environment variables don't follow through and permission conflicts arise etc.
Finally to simplify package/module installation I suggest doing a brew install cpanminus. If you had previously already installed this, you can ensure the paths etc are configured by doing a brew reinstall cpanminus
If you want to take it another step further then you can install perlbrew as well which will give you the ability to run multiple versions of Perl as your user and configure these with their own libs and modules which can be very useful particularly if aligning with your production environment for testing etc.
One problem you may face if moving from system Perl to this kind of approach is needing to deal with any hangovers from installing things with sudo. It wis worth taking a little time to get all this set up right though and your issues going forward will be greatly reduced and you won't be left with that nagging feeling that you don't want to change anything for fear of it all breaking.
I have also come across a Perl Blog Article that suggests a fix for XS issues with perlbrew on Mojave
This Gist described updating your cpan shell install root though this shouldn't be necessary unless your cpan is stuck in an old config after taking steps above.
I've also raised this as a new issue on PerlMonks
After reading https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624 and installing the Additional headers via
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
I successfully compiled without the missing 'EXTERN.h' error
In order to follow the common advice I also tried with Perlbrew to install a dedicated development version of Perl. Especially with the advice in mind First, do not use the system Perl on MacOS. The installed version is for Apple, not for you (see the discussion here: https://www.perlmonks.org/?node_id=1224727).
Unfortunately, the following error occurred:
Test Summary Report
-------------------
porting/libperl.t (Wstat: 65280 Tests: 35 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
Files=2653, Tests=1217766, 708 wallclock secs (52.74 usr 9.40 sys + 395.38 cusr 49.90 csys = 507.42 CPU)
Result: FAIL
make: *** [test_harness] Error 1
##### Brew Failed #####
Therefore, I decided to install it the following way (and not following the advice due to the error).
Even after having the above mentioned macOS SDK headers already installed on Catalina (macOS 10.15.2) it didn't work for me. I faced the issue during the installation of the Perl module Mac-SystemDirectory-0.13. The following steps (by identifying the missing file in hope of having a more generic approach for more or less equivalent issues) did the trick:
Locate the header file (in this case EXTERN.h)
sudo find /Library -type f -name EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
Ensure the installed Perl version (here 5.18) match the header file:
perl -v | grep version
This is perl 5, version 18, subversion 4 (v5.18.4) built for darwin-thread-multi-2level
Export the path for the C-Compiler (note MacOSX10.15.sdk for Catalina and Perl Version 5.18)
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
Invoke the Makefile.PL with perl
perl Makefile.PL
BTW — For anybody who's still struggling with this, my workaround was:
bash% module="Sub::Util" # For example
bash% cpanm --configure-args="INC=-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" "$module"
Please try this
CPATH=$(dirname $(find /usr/local/Cellar/ -name EXTERN.h)) cpan JSON::XS
For Big Sur and perl 5.30, EXTERN.h is at /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE
I'm trying to upgrade CPAN itself and got that error. But I have /usr/bin/cpan and I can't write there so I have to tweak it to write the updated version to /usr/local/bin/cpan.
No promises, but yum install perl-devel worked for me.
As #huyz has helpfully pointed out, if you hit this error on a Mac, you don't have this option, even though this is probably your issue, and you need to follow one of the above methods of getting a version of Perl that isn't missing important chunks, as per other answers.
But if, dear reader, you hit this error on a linux host, as I did, then this might be an option for you.
Building on what E Lisse suggested, you might also have luck looking in
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/
For example:
CPATH=$(dirname $(find /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/ -name EXTERN.h)) cpan JSON::XS
You could also find where EXTERN.h is located and add that to your shell by default, e.g. in your .bashrc or .zshrc file:
export CPATH=/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/

How to rebuild a Fedora package with a different compiler?

Similarly to this question ("How can I automatically rebuild a package with a different compiler?" on askubuntu.com), I would like to know how can I automate fetching source and compilation of a C program using Fedora build scripts using a specific, non-default compiler - in my case afl-gcc. I would definitely welcome an example of the pv program, but I would like the solution to work for other packages, like libreoffice as well, with minimal modifications. I would like to achieve something similar to aflize (which is for Debian only right now). I have heard of mock and it would be best if I could use it for that.
I do not know to do it automatically, but manually:
Prepare build environnement
$ rpmdev-setuptree
Download corresonding srpms
$ yumdownloader --source foo
Extract files from SRPMS
$ rpm -i foo*.src.rpm
Replace the compiler used
$ sed -i 's/make all/make CC=afl-gcc all/g' ~/rpmbuild/SPECS/foo.spec
setting CC var your corresponding compiler will do the jobs.
If you use cmake take a look to CMAKE_C_COMPILER
Rebuild
$ cd ~/rpmbuild/SPECS/
$ rpmbuild -ba foo.spec
Generated rpm files are located into ~/rpmbuild/RPMS