Macos编译openjdk因berkeley-db版本问题失败解决办法

brew install openjdk

最后编译失败,报错如下:

* For target support_native_jdk.hotspot.agent_libsaproc_symtab.o:

/private/tmp/openjdk-20250203-10040-wpec6/jdk23u-jdk-23.0.2-ga/src/jdk.hotspot.agent/macosx/native/libsaproc/symtab.c:69:67: error: too few arguments to function call, expected 5, have 4

(*symtab->hash_table->put)(symtab->hash_table, &key, &value, 0);

原因是berkeley-db最新的版本这个get的定义是多一个DB_TXN的参数,看名字是用于事务处理的。

头文件位于:

/usr/local/include/db.h

/usr//local/Cellar/berkeley-db/18.1.40_2/include/db.h

/*
 * Copyright (c) 1996, 2020 Oracle and/or its affiliates.  All rights reserved.
 *
 * See the file LICENSE for license information.
 *
 * $Id$
 *..

*/

一开始以为是版本低了,upgrade了一下没有解决,

后来找了一下xcode目录下,也有一个db.h

$ find /Applications/Xcode.app/Contents/Developer  -name "db.h"
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/db.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/db.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/db.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/db.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/db.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/db.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/db.h
(base) DanyMini:mybuild dany$ vi /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/db.h

打开看了一下,好像比较老的,

/*-
 * Copyright (c) 1990, 1993, 1994
 *      The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by the University of
 *      California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *      @(#)db.h        8.7 (Berkeley) 6/16/94
 * $FreeBSD: src/include/db.h,v 1.5 2002/03/26 01:35:05 bde Exp $
 */

同时get这个函数看起来也刚好是只有四个参数,

        int (*get)(const struct __db *, const DBT *, DBT *, unsigned int);

看来是优先使用/usr/local下的头文件了, 简单处理一下,看起来brew也有多份,直接删除一下/usr/local下的db.h及相关的头文件

 rm  /usr/local/include/db.h
rm /usr/local/include/db_185.h 
rm /usr/local/include/db_cxx.h 
rm /usr/local/include/dbstl* 

然后再编译,顺利通过。

相关推荐
Macle_Chen8 小时前
Mac服务器上创建Docker并安装宝塔环境
服务器·macos·docker
AskHarries12 小时前
Spring Boot中对接Twilio以实现发送验证码和验证短信码
ide·macos·xcode
存内计算开发者18 小时前
VLSI 2024论文详解:具有紧凑型MAC-SIMD和自适应竖式加法数据流的1T1C DRAM存内计算加速器Dyamond
数据结构·macos·深度优先·边缘计算·数据库架构·剪枝·迭代加深
黄豆匿zlib19 小时前
Python怎样安装,Windows/Mac/Linux系统安装教程
windows·python·macos
挪不动20 小时前
OpenCore Legacy Patcher 问题解决
macos
獨枭1 天前
macOS 安装 CMake GUI 后找不到 cmake 命令的解决方案
macos
软购商城1 天前
立即释放 Mac 空间!Duplicate File Finder 8 重复文件高速清理工具
macos·正版软件·mac 重复文件清理工具软件
水木姚姚2 天前
图形界面控件编程(iOS)
人工智能·python·macos·ios·xcode
skywalk81632 天前
MacOS Big Sur 11 新机安装brew wget python3.12 exo
人工智能·macos·exo
甜于酸2 天前
Bartender 5 for Mac 多功能菜单栏管理
macos