How to use SSTATE_DUPWHITELIST variable in yocto - build

I'll try to explain it as easy as I can. I tried to include and build package "A" in my Yocto image, but package A depends on libftdi and ftdi-eeprom. Now, "ftdi-eeprom" depends on the "libftdi".
In the newer versions of the "libftdi" the tarball also includes the ftdi-eeprom sources too and when you build the libftdi it builds both of the packages. Although because of the way that package "A" is configured I need two different recipes for each of the dependencies.
long story short, I made the two bitbake recipes as best as I could and successfully built "libftdi". Now when I run the "ftdi-eeprom" recipe, it wants to populate some files into the sysroot that are already installed there by libftdi. Here is where the error occurs... duplicates!
Apparently I need to set a SSTATE_DUPWHITELIST variable and declare that these duplicate files are safe to replace the old ones in the image (this overwrite must happen). Can someone please help me with configuring the SSTATE_DUPWHITELIST? I am not that pro working with Yocto.
Errors that I get on screen are uploaded in Dropbox
Thanks in advance!

The answer is to not use SSTATE_DUPWHITELIST for this at all. Instead, in the libftdi recipe's do_install (or do_install_append, if the recipe itself doesn't define its own do_install) you should delete the duplicate files from within ${D} and then they won't get staged and the error won't occur.

I got it to work by using:
SSTATE_DUPWHITELIST = "/"
Dont forget the quotes. Here's my bb excerpt:
SSTATE_DUPWHITELIST = "/"
DEPENDS = ""
do_unpack() {
mkdir -pv ${S}
tar xvf ${DL_DIR}/${FILENAME}.tar -C ${S}
}
do_install() {
install -d -m 755 ${D}${includedir}
install -m 644 ${S}/${MYPATH}/inc/myHeader1.h ${D}${includedir}
install -m 644 ${S}/${MYPATH}/inc/myHeader2.h ${D}${includedir}
install -m 644 ${S}/${MYPATH}/inc/myHeader3.h ${D}${includedir}
}

I managed to solve this problem by adding the SSTATE_DUPWHITELIST to the bitbake recipe of the package as follows:
SSTATE_DUPWHITELIST = "${TMPDIR}/PATH/TO/THE/FILES"
I added the absolute path of all of the 6,7 files that had the conflict to the list. I did that because they were basically coming from a same source and it was all safe to do that. correct me if there is a better way though.
Hope this helps someone!

Related

Github Actions path does not update

Right now, I'm trying to build a tool from source and use it to build a C++ project. I'm able to extract the tar file (gcc-arm-none-eabi). But, when I try to add it to path (using $GITHUB_PATH, not add-path), the path doesn't apply on my next action and I can't build the file. The error states that it can't find the gcc-arm-none-eabi toolset, which means that it didn't go to path.
Here's the script for the entrypoint of the first function (make is ran in the next action to allow for path to apply)
echo "Downloading ARM Toolchain"
# The one from apt isn't updated so I have to build from source
curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -o gcc-arm-none-eabi.tar.bz2
tar -xjf gcc-arm-none-eabi.tar.bz2
echo "/github/workspace/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_PATH
I can't even debug by seeing what's in the path because running echo $(PATH) just says that PATH cannot be found. What should I do?
I can't even debug by seeing what's in the path because running echo $(PATH) just says that PATH cannot be found. What should I do?
First, PATH is not a command so if you want to print its value, it would be something like echo "${PATH}" or echo "$PATH"
Then, if you want to add a value to an existing environment variable, it would be something like
export PATH="${PATH}:/github/workspace/gcc-arm-none-eabi-10-2020-q4-major/bin"
EDIT: seems not a valid way to add something to the path using Github Actions, meanwhile it seems correct in the question. To get more details: https://docs.github.com/en/free-pro-team#latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path . Thanks to Benjamin W. for pointing this out in the comments.
Finally I think it would be a better fit if you use a docker image that already contains that kind of dependancies (you could easily write your own Dockerfile if this image doesn't already exists). Github action is designed to use docker (or OCI containers) image that contains the dependancies you need to perform your build actions. You should take a look here: https://docs.github.com/en/free-pro-team#latest/actions/creating-actions/dockerfile-support-for-github-actions

How to rename bazelisk to bazel

I am currently trying, without great success, to build tensorflow from source.
As suggested here: https://www.tensorflow.org/install/source, I tried to do so by installing bazelisk. Unfortunately, I wasn't able to do so as the ./compile cannot find bazel as bazelisk replaces it.
This link: https://github.com/bazelbuild/bazelisk/issues/122 suggested to alias or rename the environment variable to "bazel" in the PATH.
As described in the issue above, aliasing did not work out for the configure.py.
My next step would be to rename it but I, unfortunately, was not able to figure out how the renaming of environment works under Linux.
I did add the following:export PATH=$PATH:$(go env GOPATH)/bin
to my .profile under my /home folder, which, the way I understand it, adds the path to Bazelisk binaries to my environment path but I am not sure how the renaming would work in this situation.
Would it be possible to explain how I could proceed?
Download the bazelisk binary from the releases page and save the file as bazel in a directory somewhere in your $PATH.
For example, if you have export PATH=$PATH:$HOME/bin in your .profile/.bashrc/.bash_profile, and in $HOME/bin, store the bazelisk binary as $HOME/bin/bazel.
You can have 2 more options:
sudo ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel which makes a symlink to bazelisk (personally i prefer it, because its more explicit)
alias bazel='bazelisk' in your ~/.zshrc, ~/.bashrc or ~/.profile. This also works well, but there could be some issues if you want to run vim-bazel and such.

How to uninstall gtsam library

I have installed gtsam 4 library from : https://bitbucket.org/gtborg/gtsam.git and since I am facing troubles with compilation I want to uninstall it and link to a local version. The problem is that make uninstall does not exist. Is there a way to remove it or at least make the local version be used instead of it.
In CmakeLists.txt I have include_directories and link_directories pointing to the local version but still the gtsam which is installed is the one that is used.
I tried make -n install but the make prints about 700 lines which is difficult to follow and reverse what happened.
I found install_manifest.txt file in build directory. As I read here it contains all the files to be installed. However. I noticed that most of the files are .h and some are .cmake I do not know if just deleting those files will fix the problem or is going to mess it up.
This answer which is not the top one did the trick, it suggested to remove the files specified in the install_manifest.txt file using the following command :
cat install_manifest.txt | xargs echo sudo rm | sh
However, it has to be noted that in the comments, it is said it can be dangerous if the install_manifest had important files, so it is essential to have a look what is written there.

How to install 2 Opencv versions on one Ubuntu machine and How to activate one at a time for compilation?

I have installed two versions of opencv in my ubuntu12.04 machine , one in /usr/local/ (opencv3.0.0) and another in /usr/ (opencv2.4.9).
To activate particular version i am using these commands in terminals.
Example :To activate opencv2.4.9,
sudo sh -c 'echo "/usr/" > /etc/ld.so.conf.d/opencv.conf' (shell script)
sudo ldconfig
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
After executing these commands version is changing.
Checked with command, pkg-config --modversion opencv.
Then i compiled my code and checked used libraries, Using ldd command,
It is listing opencv3.0.0 version not opencv2.4.9.
Please help correct way of switching opencv versions.
Thanks in advance
Thank you,
I found a solution for this problem, but I am not sure the solution what iIfound is correct way or not. But it is working fine for me.
When we install two versions of opencv in different locations,we will found two opencv.pc file in {path}/lib/pkgconfig/opencv.pc.
In above example opencv2.4.9's opencv.pc file is in this path usr/lib/pkgconfig/opencv.pc.
and opencv3.0.0's opencv.pc file is in this path /usr/local/lib/pkgconfig/opencv.pc
When we compile a code it will search in both location for opencv.pc configuration file, it will use which ever first it is getting, neglecting second one.
so if want compile code with particular version we need to remove this opencv.pc file from that location.
If you want to use opencv2.4.9 remove(or rename)opencv.pc from opencv3.0.0's lib/pkgconfig/ location. Again if want activate opencv3.0.0 add opencv.pc to its lib/pkgconfig/ location and remove opencv2.4.9's opencv.pc file from /lib/pkgconfig/opencv.pc.
If somebody knows a better way to do this, please comment.
You still can install both versions and append on the environment path the path of the version you want to use.
If you don't know how to change system path check this ( How to permanently set $PATH on Linux? )

CSSTidy is driving me crazy!

I am on OS X + Python 2.6 + django 1.1.
I have tried all possible solution available on the net i.e.
http://thingsilearned.com/2009/01/02/installing-csstidy-and-scons-on-os-x-or-linux/
tried with python 2.5, 2.4 apple-python.. I just can't go past this error after installing scons
$ /usr/local/bin/scons
scons: *** No SConstruct file found.
File "/Library/Python/2.5/site-packages/SCons/Script/Main.py", line 829, in _main
I need csstidy for django-compress (yes I can turn that function off but why?) I mean the maintainer must see some value to have it in default and he knows better.
Unfortunately there is no port for csstidy...
Don't know if you managed to give up or not, or if you solved it.
For anybody who is still having trouble building CSSTidy, here was my solution. If you follow the tutorial in the URL linked above, there is one horrible error in it that I didn't realize until about an hour later.
$ wget http://downloads.sourceforge.net/csstidy/csstidy-source-1.4.zip?modtime=1184828155&big_mirror=0
$ unzip csstidy-source-1.4.zip
$ cd csstidy <<-- THIS IS WRONG. SConstruct isn't here. D:
$ scons
$ sudo cp release/csstidy/csstidy /usr/local/bin/
The errors the author ran into had nothing to do with the --standard-lib flag. When you unzip, the files don't get put into a subdirectory like tar usually does. So the SConstruct file that's magically missing is actually in the directory above csstidy, wherever you ran unzip in the first place.
Once I found that out, I saw the SConstruct file and was able to build it by running scons.
If you just want to build csstidy and don't care about incremental builds, just do this:
g++ *.cpp -o csstidy