cmake-maven-project / cmake-maven-project

Project to enable using CMake from a Maven build.
76 stars 13 forks source link

Odd failure to build on Arm64 VM running Ubuntu #65

Closed chrisdutz closed 3 months ago

chrisdutz commented 3 months ago

I am currently facing an odd error, which I am not sure where it's coming from.

I have managed to get the cmake-maven-plugin work on my Ubuntu VM running on my M2 Mac, with this update: https://github.com/apache/plc4x/blob/develop/plc4c/pom.xml#L382 It fetches the official CMake binaries for arm64 from the cmake page, unpacks it and re-packages it as jar and installs it locally, so the plugin can use it later in the build.

The problem that I am having however, is that when starting Cmake it tries to do a test-compile ... this fails as it seems to generate a directory and doesn't put a CmakeList.txt into it.

[INFO] --- cmake:3.29.3-b1:generate (cmake-generate-test-compile) @ plc4c ---
[INFO] Downloading binaries to /home/parallels/plc4x/plc4c/target/dependency/cmake
[INFO] Configured Artifact: com.googlecode.cmake-maven-project:cmake-binaries:linux-arm_64:3.29.3-b1:jar
Downloading from apache-snapshots: https://repository.apache.org/content/repositories/snapshots/org/apache/plc4x/plc4x-parent/0.13.0-SNAPSHOT/maven-metadata.xml
Downloading from apache.snapshots: https://repository.apache.org/snapshots/org/apache/plc4x/plc4x-parent/0.13.0-SNAPSHOT/maven-metadata.xml
Downloaded from apache-snapshots: https://repository.apache.org/content/repositories/snapshots/org/apache/plc4x/plc4x-parent/0.13.0-SNAPSHOT/maven-metadata.xml (819 B at 5.5 kB/s)
Downloaded from apache.snapshots: https://repository.apache.org/snapshots/org/apache/plc4x/plc4x-parent/0.13.0-SNAPSHOT/maven-metadata.xml (819 B at 4.4 kB/s)
Downloading from apache-snapshots: https://repository.apache.org/content/repositories/snapshots/org/apache/plc4x/plc4x-parent/0.13.0-SNAPSHOT/plc4x-parent-0.13.0-20240517.162417-1.pom
Downloaded from apache-snapshots: https://repository.apache.org/content/repositories/snapshots/org/apache/plc4x/plc4x-parent/0.13.0-SNAPSHOT/plc4x-parent-0.13.0-20240517.162417-1.pom (66 kB at 626 kB/s)
[INFO] Executing /home/parallels/plc4x/plc4c/target/dependency/cmake/bin/cmake
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
CMake Error: The source directory "/home/parallels/plc4x/plc4c/target/build/CMakeFiles/CMakeScratch/TryCompile-WoCrsz" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
CMake Error at target/dependency/cmake/share/cmake-3.29/Modules/CMakeDetermineCompilerABI.cmake:67 (try_compile):
  Failed to configure test project build system.
Call Stack (most recent call first):
  target/dependency/cmake/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
  CMakeLists.txt:23 (project)

-- Configuring incomplete, errors occurred!
[WARNING] Command: [/home/parallels/plc4x/plc4c/target/dependency/cmake/bin/cmake, -G, Unix Makefiles, -DUNITY_VERSION:STRING=2.5.2, -DBUILD_PHASE=test-compile, /home/parallels/plc4x/plc4c]
[WARNING] Directory: /home/parallels/plc4x/plc4c/target/build
[WARNING] Environment: {GNOME_SHELL_SESSION_MODE=ubuntu, DOTNET_BUNDLE_EXTRACT_BASE_DIR=/home/parallels/.cache/dotnet_bundle_extract, PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/parallels/.dotnet/tools, LESSCLOSE=/usr/bin/lesspipe %s %s, XDG_MENU_PREFIX=gnome-, LOGNAME=parallels, LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:, XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg, MAVEN_CMD_LINE_ARGS= -P with-c -pl :plc4c clean install, WAYLAND_DISPLAY=wayland-0, XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.Q6ODN2, JAVA_HOME=/usr/lib/jvm/java-21-openjdk-arm64, XMODIFIERS=@im=ibus, QT_ACCESSIBILITY=1, XDG_SESSION_DESKTOP=ubuntu, DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus, GNOME_SETUP_DISPLAY=:1, SSH_AGENT_LAUNCHER=gnome-keyring, USERNAME=parallels, SHLVL=1, XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop, SHELL=/bin/bash, GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/af7561c2_542e_4fbb_a798_69ed0e3feb03, SESSION_MANAGER=local/ubuntu-linux-22-04-02-desktop:@/tmp/.ICE-unix/2181,unix/ubuntu-linux-22-04-02-desktop:/tmp/.ICE-unix/2181, XDG_SESSION_CLASS=user, COLORTERM=truecolor, GTK_MODULES=gail:atk-bridge, MAVEN_PROJECTBASEDIR=/home/parallels/plc4x, DISPLAY=:0, HOME=/home/parallels, XDG_CURRENT_DESKTOP=ubuntu:GNOME, TERM=xterm-256color, QT_IM_MODULE=ibus, GNOME_TERMINAL_SERVICE=:1.102, LANG=C.UTF-8, GDMSESSION=ubuntu, LESSOPEN=| /usr/bin/lesspipe %s, GNOME_DESKTOP_SESSION_ID=this-is-deprecated, IM_CONFIG_PHASE=1, SYSTEMD_EXEC_PID=2204, SSH_AUTH_SOCK=/run/user/1000/keyring/ssh, XDG_RUNTIME_DIR=/run/user/1000, OLDPWD=/home/parallels/plc4x, DESKTOP_SESSION=ubuntu, USER=parallels, XDG_SESSION_TYPE=wayland, PWD=/home/parallels/plc4x, VTE_VERSION=6800, _=./mvnw}
[WARNING] Exit code: 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

If I manually run the command that the plugin wants to run on the commandline, that command works fine ... it just seems to fail when being executed by the plugin.

cowwoc commented 3 months ago

The plugin does not copy or generate CMakeLists.txt for you. It sounds to me like you need to either point sourceDirectory at the directory that does contain this file, or copy it into the target directory that you are currently pointing to.

chrisdutz commented 3 months ago

The problem is that this seems to be part of Cmake trying to figgure out the type of compiler available ... on other systems I can see it generate a little test project that compiles one file, it then runs the output and knows several things (Endianess, and if the compiler generally works). If I run the cmake command that the maven plugin executes in the maven build manually, it seems to work.

cowwoc commented 3 months ago

@chrisdutz Sorry, I still don't understand. Did you try passing the path of CMakeFiles.txt to the sourceDirectory parameter? What happened when you did.

Correction: the parameter is called sourcePath not sourceDirectory.

chrisdutz commented 3 months ago

I have asked other folks, if they can compile PLC4X on a Linux VM on an aarch64 host and nobody complained. I seem to be the only one with issues. So I am pretty sure the setup is working ... I would assume it's some sort of wierd situation on my VM ... perhaps I'll simply try setting up a new VM and see if I run into the same issues.

chrisdutz commented 3 months ago

Ok ... I setup a clean VM and the build worked like a charm ... sorry for the noise (And sorry about the time I wasted myself)

cowwoc commented 3 months ago

No worries. I'm glad it worked out in the end!