jafingerhut / p4-guide

Guide to p4lang repositories and some other public info about P4
530 stars 155 forks source link

[Question] Build error (potentially) due to version format in version file and Makefile processing #68

Closed zzmic closed 4 months ago

zzmic commented 7 months ago

Hi community/repository members,

I hope you are doing well!

I've encountered the following issue in all of the recent attempts I made running ./p4-guide/bin/install-p4dev-v6.sh |& tee log.txt and/or ./p4-guide/bin/install-p4dev-v7.sh |& tee log.txt (and following README-install-troubleshooting.md). In short, the installations stagnated (forever) at this particular point (I've also attached the entire "log.txt" file produced by the most recent installation with this issue log.txt): ../version:1:1: error: too many decimal points in number 1 | 1.15.0 | ^~ ../version:1:1: error: expected unqualified-id before numeric constant make[3]: [Makefile:579: gen-cpp/bm/Standard.lo] Error 1 make[3]: Leaving directory '/media/HostShared/behavioral-model/thrift_src' make[2]: [Makefile:480: all] Error 2 make[2]: Leaving directory '/media/HostShared/behavioral-model/thrift_src' make[1]: [Makefile:465: all-recursive] Error 1 make[1]: Leaving directory '/media/HostShared/behavioral-model' make: [Makefile:395: all] Error 2

I tried to leave the installations there for the whole nights and hoped they would turn out well, but they simply stuck on that step. Throughout the installation processes, the internet and battery statuses were stable. I ran the installations on Ubuntu 22.04 LTS for ARM64 on an Apple Silicon Mac via UTM virtualizations. I've configured the virtual machine so that it can use up to 8 cores and 10240 MB of storage.

To further clarify what commands I typed after the systems (Ubuntu 22.04 LTS) were freshly installed (most of the commands I adopted are from How To Install Ubuntu 22.10 On M1 or M2 Mac || RUN NEW Ubuntu On ANY Mac W/ Apple Silicon Using UTM), I state the following: $ sudo apt update && sudo apt upgrade -y $ sudo apt install ubuntu-desktop $ reboot $ sudo apt install spice-vdagent spice-webdavd $ reboot $ sudo mkdir /media/HostShared $ sudo mount -t 9p -o trans=virtio share /media/HostShared -oversion=9p2000.L (modify /etc/fstab by adding this line at the end of the file) share /media/HostShared 9p trans=virtio,version=9p2000.L,rw,netdev,nofail 0 0 $ sudo chown -R $USER /media/HostShared $ sudo apt install git # For Ubuntu $ git clone https://github.com/jafingerhut/p4-guide $ ./p4-guide/bin/install-p4dev-v7.sh |& tee log.txt ... (where the output stagnated) ... ... (after tapping Control-C) ..._ $ ls -l total 19164 drwxrwxr-x 58 (owner) (user group (identical to owner in this case)) 1856 Feb 6 01:04 behavioral-model drwxrwxr-x 2 (owner) (user group (identical to owner in this case)) 64 Feb 6 00:49 grpc -rw-r--r-- 1 (owner) (user group (identical to owner in this case)) 1328 Feb 5 21:37 libz3-4 -rw-r--r-- 1 (owner) (user group (identical to owner in this case)) 2030 Feb 5 21:37 libz3-4_4.8.12-1_all.deb -rw-r--r-- 1 (owner) (user group (identical to owner in this case)) 5798 Feb 5 21:37 libz3-4_4.8.12-1_arm64.buildinfo -rw-r--r-- 1 (owner) (user group (identical to owner in this case)) 1023 Feb 5 21:37 libz3-4_4.8.12-1_arm64.changes -rw-r--r-- 1 (owner) (user group (identical to owner in this case)) 1330 Feb 5 21:37 libz3-dev -rw-r--r-- 1 (owner) (user group (identical to owner in this case)) 2040 Feb 5 21:37 libz3-dev_4.8.12-1_all.deb -rw-r--r-- 1 (owner) (user group (identical to owner in this case)) 5808 Feb 5 21:37 libz3-dev_4.8.12-1_arm64.buildinfo -rw-r--r-- 1 (owner) (user group (identical to owner in this case)) 1041 Feb 5 21:37 libz3-dev_4.8.12-1_arm64.changes -rw-rw-r-- 1 (owner) (user group (identical to owner in this case)) 890023 Feb 6 17:28 log.txt drwxrwxr-x 7 (owner) (user group (identical to owner in this case)) 224 Feb 5 21:37 p4dev-python-venv drwxrwxr-x 86 (owner) (user group (identical to owner in this case)) 2752 Feb 5 21:22 p4-guide drwxrwxr-x 55 (owner) (user group (identical to owner in this case)) 1760 Feb 6 00:51 PI drwxrwxr-x 4 (owner) (user group (identical to owner in this case)) 128 Feb 5 21:37 snap2 -rw-rw-r-- 1 (owner) (user group (identical to owner in this case)) 2592738 Feb 5 21:38 usr-local-1-before-protobuf.txt -rw-rw-r-- 1 (owner) (user group (identical to owner in this case)) 2610081 Feb 5 21:38 usr-local-2-after-protobuf.txt -rw-rw-r-- 1 (owner) (user group (identical to owner in this case)) 2666916 Feb 6 00:16 usr-local-2b-before-grpc-req-pip3.txt -rw-rw-r-- 1 (owner) (user group (identical to owner in this case)) 2732532 Feb 6 00:17 usr-local-2c-before-grpc-pip3.txt -rw-rw-r-- 1 (owner) (user group (identical to owner in this case)) 2747746 Feb 6 00:49 usr-local-3-after-grpc.txt -rw-rw-r-- 1 (owner) (user group (identical to owner in this case)) 2771929 Feb 6 00:57 usr-local-4-after-PI.txt drwxrwxr-x 26 (owner) (user group (identical to owner in this case)) 832 Feb 5 21:37 z3

Would you mind helping me out? Please feel free to raise any further questions regarding my issue. Thanks for your time!

jafingerhut commented 7 months ago

You can see a compiler error message shortly before it hangs. It is annoying that the script hangs like this in such a situation, but it does. I am pretty sure it is not because any compilation process is hanging.

It is not clear to me why you are getting a compilation error. I have tested these scripts recently on an Apple Silicon Mac running Ubuntu 22.04 Linux inside of UTM, and did not experience this compilation error. The behavioral-model project code does not change very often, so it isn't easy for me to imagine why you are getting such an error, unless you are going out of your way to install different versions of development tools like make, g++, etc.

You can see the logs from when I last ran install-p4dev-v7.sh in this environment here: https://github.com/jafingerhut/p4-guide/blob/master/bin/output/ubuntu22.04-arm64-install-p4dev-v7.txt

When it comes to using these scripts on an Apple Silicon Mac, the only way I have tried to do so is to run an aarch64 (aka arm64) Ubuntu or Fedora Linux VM inside of UTM, and then put all files into a "local" file system within the VM, not a file system stored on the host OS. That might not be the root cause of the problem you are experiencing, but I wanted to mention it.

Also, install-p4dev-v7.sh is the only script that has been enhanced to (maybe) be usable on an arm64 system. install-p4dev-v6.sh has not been enhanced in this way, and I have no plans to do so. I tend to create a new version of my install script with an explicit version number in its name (e.g. v6, v7), and while I do make some fixes and enhancements to one version of the script over a year or two that I support it, I do eventually retire them in favor of newer versions. I should probably add a check to the install-p4dev-v6.sh script so that it fails quickly on detecting an aarch64/arm64 system, to make it obvious that it is not expected to work.

zzmic commented 7 months ago

@jafingerhut Thanks for your reply and information, Andy!

It is indeed quite bizarre since I didn't install any development tools like make and g++ after I freshly installed Ubuntu 22.04 Linux inside of UTM. I did mount a file system stored on my host macOS to the VM after the system's installation, as you may have pointed out, so I will try to run through the whole procedure all over again without mounting one.

Would you mind leaving this issue open for a while? I may follow up if anything goes right or wrong regarding this issue. Thanks for your understanding!

jafingerhut commented 7 months ago

I do not mind at all leaving the issue open. Let me know if you have any other questions about this. I will try running install-p4dev-v7.sh again on macOS + UTM + Ubuntu 22.04 soon and report back my results here.

zzmic commented 7 months ago

@jafingerhut Thanks for your help, Andy! Surprisingly, mounting a folder stored on my host macOS to the VM (i.e., the folder was shared among my host macOS and the Ubuntu 22.04 VM) is precisely the issue. That was the only change I made in my installation procedure, and it turned out that everything ran smoothly and noticeably faster. I was able to test my installation through "Run tests included with p4c" and Send ping packets in the solution to basic exercise of p4lang/tutorials repository. Both of the testings turned out to be successful (with "Run tests included with p4c" having reasonable amount of failures).

jafingerhut commented 7 months ago

Excellent. It was a lucky guess on my part, but glad I mentioned it as a thing worth trying to change to see if it helped.

jafingerhut commented 4 months ago

Closing this issue since now I have documented a warning against running the install scripts in a folder that is shared between guest OS and host OS here: https://github.com/jafingerhut/p4-guide/commit/31473b80253584eee53f2585db712303ab6c5be3