欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 国际 > Macos编译openjdk因berkeley-db版本问题失败解决办法

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

2025/2/8 4:31:06 来源:https://blog.csdn.net/aerror/article/details/145428356  浏览:    关键词: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* 

然后再编译,顺利通过。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com