Bug 237376 - New port: emulators/pcem Accurate PC-compatible emulator
Summary: New port: emulators/pcem Accurate PC-compatible emulator
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kurt Jaeger
Depends on:
Reported: 2019-04-19 03:20 UTC by Salvador Pardiñas
Modified: 2019-05-06 06:58 UTC (History)
3 users (show)

See Also:

Port patch (4.71 KB, patch)
2019-04-19 03:20 UTC, Salvador Pardiñas
no flags Details | Diff
patch-v2 (4.07 KB, patch)
2019-05-04 08:34 UTC, Kurt Jaeger
no flags Details | Diff
patch-v3 (4.11 KB, patch)
2019-05-04 12:42 UTC, Kurt Jaeger
no flags Details | Diff
patch-v4 (4.26 KB, patch)
2019-05-04 13:22 UTC, Kurt Jaeger
pi: maintainer-approval?
Details | Diff
Log showing after failing with "Unsupported CPU". (79.36 KB, text/plain)
2019-05-05 03:20 UTC, ktullavik
no flags Details
Some improvements (2.46 KB, patch)
2019-05-06 06:58 UTC, Alex Kozlov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Salvador Pardiñas 2019-04-19 03:20:09 UTC
Created attachment 203782 [details]
Port patch

PCem is a PC and PC-compatible emulator with support ranging from the original IBM PC to Socket 7 motherboards. This port allows it to be packaged on FreeBSD (using a patch that has already been submitted as a pull request).

Patch summary:
- Set include and library paths
Comment 1 Kurt Jaeger freebsd_committer 2019-05-04 08:34:03 UTC
Created attachment 204211 [details]

This patch is cleaned up from portlint -AC warnings, and a bit simplified.

It still fails in poudriere with this:

checking for off64_t... no
./configure: 4330: Syntax error: word unexpected (expecting ")")

I'll investigate further.
Comment 2 Kurt Jaeger freebsd_committer 2019-05-04 12:42:51 UTC
Created attachment 204215 [details]

This version builds on 13 and 11.2, but fails on 12.0 with:

checking for glGetError in -lGL... yes
checking for alGetError in -lopenal... no
You need to install the OpenAL library.
exit: Illegal number: -1
===>  Script "configure" failed unexpectedly.
Comment 3 Kurt Jaeger freebsd_committer 2019-05-04 12:46:16 UTC
configure:5500: cc -o conftest -O3 -I/usr/local/include   -fstack-protector-strong  -L/usr/local/lib conftest.c -lopenal  -lGL -lpthread  >&5
/usr/bin/ld: error: cannot preempt symbol: alGetError
>>> defined in /usr/local/lib/libopenal.so
>>> referenced by conftest.c
>>>               /tmp/conftest-f6e9a9.o:(main)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 4 Kurt Jaeger freebsd_committer 2019-05-04 12:52:59 UTC


for pointers to a solution for this. Testbuilding right now.
Comment 5 Kurt Jaeger freebsd_committer 2019-05-04 13:22:24 UTC
Created attachment 204216 [details]

This version builds on 13/12/11.2 amd64. Please comment if it's OK to commit this version.
Comment 6 ktullavik 2019-05-05 03:20:55 UTC
Created attachment 204222 [details]
Log showing after failing with "Unsupported CPU".
Comment 7 ktullavik 2019-05-05 03:23:42 UTC
On up to date 13, configure fails for me with "Unsupported CPU". If it's picky about cpu that's fine, but I suspect it's just a bug. Attached my config.log.

CPU: Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz (2494.28-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x306c3  Family=0x6  Model=0x3c  Stepping=3
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x21<LAHF,ABM>
  Structured Extended Features=0x27ab<FSGSBASE,TSCADJ,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,NFPUSG>
  XSAVE Features=0x1<XSAVEOPT>
  TSC: P-state invariant, performance statistics
Comment 8 Kurt Jaeger freebsd_committer 2019-05-05 07:19:16 UTC
(In reply to ktullavik from comment #7)
what does uname -a show ?
Comment 9 ktullavik 2019-05-05 11:18:01 UTC
(In reply to Kurt Jaeger from comment #8)
# uname -a
FreeBSD galois 13.0-CURRENT FreeBSD 13.0-CURRENT e4bfebd8e9e(master) GALOIS  amd64
Comment 10 ktullavik 2019-05-05 17:00:29 UTC
Looking at it again. It seems I either used the original patch or otherwise somehow missed the bits that explicitly sets CPU=x86_64 in the updated patch. Sorry for the trouble. I must not try to help so late at night.
Comment 11 Kurt Jaeger freebsd_committer 2019-05-05 19:13:12 UTC
Did you do run-tests ? All fine ?
Comment 12 commit-hook freebsd_committer 2019-05-06 03:13:40 UTC
A commit references this bug:

Author: pi
Date: Mon May  6 03:13:23 UTC 2019
New revision: 500881
URL: https://svnweb.freebsd.org/changeset/ports/500881

  New port: emulators/pcem: PC-Compatible low-level emulator striving for accuracy

  A very accurate (and not very fast) PC and PC-compatible emulator.
  Support currently ranges from the original IBM PC to Socket 7 motherboards.
  It also supports a wide range of peripherals, including Voodoo Graphics!

  WWW: https://www.pcem-emulator.co.uk

  PR:		237376
  Submitted by:	Salvador Pardinas <darkfm@vera.com.uy>
  Reviewed by:	tobik

Comment 13 Kurt Jaeger freebsd_committer 2019-05-06 03:13:51 UTC
Committed, thanks to all involved!
Comment 14 ktullavik 2019-05-06 03:30:23 UTC
Just got around to testing a little. It segfaults too often to be usable, and there is seemingly multiple other problems as well. But I guess this PR is not the right place anymore. Have anyone done anything beyond booting into a bios?
Comment 15 Alex Kozlov freebsd_committer 2019-05-06 06:58:28 UTC
Created attachment 204234 [details]
Some improvements

Thanks. I've tried to port v13.1, but then pcem was practically unusable, it crashed constantly.
I've attached patch with some improvements:
- Remove PATCHDIR redefinition, it's unnecessary.
- Add amd64 cpu to x86_64 case
- Make  LOCALBASE clean and remove configure.ac patching and USES=autoreconf